pypck.lcn_defs

Definitions and constants for pypck.

class pypck.lcn_defs.AccessControlPeriphery(*values)

Action types for LCN keys.

class pypck.lcn_defs.BatteryStatus(*values)

Battery status.

class pypck.lcn_defs.BeepSound(*values)

Beep sounds supported by LCN modules.

class pypck.lcn_defs.BinSensorPort(*values)

Binary sensor port of LCN module.

class pypck.lcn_defs.HardwareType(*values)

Hardware types as returned by serial number request.

property description: str

Get the LCN hardware name.

property identifier: Any

Get the LCN hardware identifier.

class pypck.lcn_defs.Key(*values)

Keys of LCN module.

class pypck.lcn_defs.KeyAction(*values)

Action types for LCN keys.

class pypck.lcn_defs.KeyLockStateModifier(*values)

Key-lock modifiers used in LCN commands.

class pypck.lcn_defs.LcnEvent(*values)

LCN events.

class pypck.lcn_defs.LedPort(*values)

LED port of LCN module.

class pypck.lcn_defs.LedStatus(*values)

Possible states for LCN LEDs.

class pypck.lcn_defs.LogicOpPort(*values)

Logic Operation port of LCN module.

class pypck.lcn_defs.LogicOpStatus(*values)

Possible states for LCN logic-operations.

class pypck.lcn_defs.MotorPort(*values)

Motor ports of LCN module.

class pypck.lcn_defs.MotorPositioningMode(*values)

Motor positioning mode used in LCN commands.

class pypck.lcn_defs.MotorReverseTime(*values)

Motor reverse time user in LCN commands.

For modules with FW<190C the release time has to be specified.

class pypck.lcn_defs.MotorStateModifier(*values)

Motor-state modifiers used in LCN commands.

LCN module has to be configured for motors connected to relays.

class pypck.lcn_defs.OutputPort(*values)

Output port of LCN module.

class pypck.lcn_defs.OutputPortDimMode(*values)

LCN dimming mode.

If solely modules with firmware 170206 or newer are present, LCN-PRO automatically programs STEPS200. Otherwise the default is STEPS50. Since LCN-PCHK doesn’t know the current mode, it must explicitly be set.

class pypck.lcn_defs.OutputPortStatusMode(*values)

Tells LCN-PCHK how to format output-port status-messages.

PERCENT: allows to show the status in half-percent steps (e.g. “10.5”). NATIVE: is completely backward compatible and there are no restrictions concerning the LCN module generations. It requires LCN-PCHK 2.3 or higher though.

class pypck.lcn_defs.RelVarRef(*values)

Value-reference for relative LCN variable commands.

class pypck.lcn_defs.RelayPort(*values)

Relay port of LCN module.

class pypck.lcn_defs.RelayStateModifier(*values)

Relay-state modifiers used in LCN commands.

class pypck.lcn_defs.SendKeyCommand(*values)

Command types used when sending LCN keys.

class pypck.lcn_defs.TimeUnit(*values)

Time units used for several LCN commands.

static parse(unit: str) TimeUnit

Parse the given time_unit into a time unit.

It supports several alternative terms.

Parameters:

time_unit (str) – The text to parse

Returns:

TimeUnit enum

Return type:

TimeUnit

class pypck.lcn_defs.Var(*values)

LCN variable types.

static has_type_in_response(var: Var, software_serial: int) bool

Module-generation check.

Check if the given variable type would receive a typed response if its status was requested.

Parameters:
  • var (Var) – The variable type to check

  • swAge (int) – The target LCN-modules firmware version

Returns:

True if a response would contain the variable’s type, otherwise False

Return type:

bool

static is_event_based(var: Var, software_serial: int) bool

Module-generation check.

Check if the given variable type automatically sends status-updates on value-change. It must be polled otherwise.

Parameters:
  • var (Var) – The variable type to check

  • swAge (int) – The target LCN-module’s firmware version

Returns:

True if the LCN module supports automatic status-messages for this var, otherwise False

Return type:

bool

static is_lockable_regulator_source(var: Var) bool

Check if the the given variable type is lockable.

Parameters:

var (Var) – The variable type to check

Returns:

True if lockable, otherwise False

Return type:

bool

static s0_id_to_var(s0_id: int) Var

Translate a given id into a LCN S0-input variable type.

Parameters:

s0_id (int) – S0 id 0..3

Returns:

The translated var

Return type:

Var

static set_point_id_to_var(set_point_id: int) Var

Translate a given id into a LCN set-point variable type.

Parameters:

set_point_id (int) – Set-point id 0..1

Returns:

The translated var

Return type:

Var

static should_poll_status_after_command(var: Var, is2013: bool) bool

Module-generation check.

Check if the target LCN module would automatically send status-updates if the given variable type was changed by command.

Parameters:
  • var (Var) – The variable type to check

  • is2013 (bool) – The target module’s-generation

Returns:

True if a poll is required to get the new status-value, otherwise False

Return type:

bool

static should_poll_status_after_regulator_lock(software_serial: int, lock_state: int) bool

Module-generation check.

Check if the target LCN module would automatically send status-updates if the given regulator’s lock-state was changed by command.

Parameters:
  • swAge (int) – The target LCN-module’s firmware version

  • lockState (int) – The lock-state sent via command

Returns:

True if a poll is required to get the new status-value, otherwise False

Return type:

bool

static thrs_id_to_var(register_id: int, thrs_id: int) Var

Translate given ids into a LCN threshold variable type.

Parameters:
  • register_id (int) – Register id 0..3

  • thrs_id (int) – Threshold id 0..4 for register 0, 0..3 for registers 1..3

Returns:

The translated var

Return type:

Var

static to_s0_id(var: Var) int

Translate a given variable type into an S0-input id.

Parameters:

var (Var) – The variable type to translate

Returns:

S0 id 0..3 or -1 if wrong type

Return type:

int

static to_set_point_id(var: Var) int

Translate a given variable type into a set-point id.

Parameters:

var (Var) – The variable type to translate

Returns:

Variable id 0..1 or -1 if wrong type

Return type:

int

static to_thrs_id(var: Var) int

Translate a given variable type into a threshold id.

Parameters:

var (Var) – The variable type to translate

Returns:

Threshold id 0..4 or -1 if wrong type

Return type:

int

static to_thrs_register_id(var: Var) int

Translate a given variable type into a threshold register id.

Parameters:

var (Var) – The variable type to translate

Returns:

Register id 0..3 or -1 if wrong type

Return type:

int

static to_var_id(var: Var) int

Translate a given variable type into a variable id.

Parameters:

var (Var) – The variable type to translate

Returns:

Variable id 0..11 or -1 if wrong type

Return type:

int

static use_lcn_special_values(var: Var) bool

Check if the given variable type uses special values.

Examples for special values: ‘No value yet’, ‘sensor defective’ etc.

Parameters:

var (Var) – The variable type to check

Returns:

True if special values are in use, otherwise False

Return type:

bool

static var_id_to_var(var_id: int) Var

Translate a given id into a variable type.

Parameters:

varId (int) – The variable id (0..11)

Returns:

The translated variable enum.

Return type:

Var

class pypck.lcn_defs.VarUnit(*values)

Measurement units used with LCN variables.

static parse(unit: str) VarUnit

Parse the given unit string and return VarUnit.

Parameters:

unit (str) – The input unit

class pypck.lcn_defs.VarValue(native_value: int)

A value of an LCN variable.

It internally stores the native LCN value and allows to convert from/into other units. Some conversions allow to specify whether the source value is absolute or relative. Relative values are used to create varvalues that can be added/subtracted from other (absolute) varvalues.

Parameters:

native_value (int) – The native value

static from_ampere(value: float) VarValue

Create a variable value from A input.

Parameters:

value (float) – The input value

Returns:

The variable value (never null)

Return type:

VarValue

static from_celsius(value: float, is_abs: bool = True) VarValue

Create a variable value from Celsius input.

Parameters:
  • value (float) – The input value

  • is_abs (bool) – True for absolute values (relative values are used to add/subtract from other VarValues), otherwise False

Returns:

The variable value (never null)

Return type:

VarValue

static from_degree(value: float, is_abs: bool = True) VarValue

Create a variable value from degree (angle) input.

Parameters:
  • value (float) – The input value

  • is_abs (bool) – True for absolute values (relative values are used to add/subtract from other VarValues), otherwise False

Returns:

The variable value (never null)

Return type:

VarValue

static from_fahrenheit(value: float, is_abs: bool = True) VarValue

Create a variable value from Fahrenheit input.

Parameters:
  • value (float) – The input value

  • is_abs (bool) – True for absolute values (relative values are used to add/subtract from other VarValues), otherwise False

Returns:

The variable value (never null)

Return type:

VarValue

static from_kelvin(value: float, is_abs: bool = True) VarValue

Create a variable value from Kelvin input.

Parameters:
  • value (float) – The input value

  • is_abs (bool) – True for absolute values (relative values are used to add/subtract from other VarValues), otherwise False

Returns:

The variable value (never null)

Return type:

VarValue

static from_lux_i(lux: float) VarValue

Create a variable value from lx input.

Target must be connected to I-port.

Parameters:

l (float) – The input value

Returns:

The variable value (never null)

Return type:

VarValue

static from_lux_t(lux: float) VarValue

Create a variable value from lx input.

Target must be connected to T-port.

Parameters:

l (float) – The input value

Returns:

The variable value (never null)

Return type:

VarValue

static from_meters_per_second(value: float) VarValue

Create a variable value from m/s input.

Used for LCN-WIH wind speed.

Parameters:

value (float) – The input value

Returns:

The variable value (never null)

Return type:

VarValue

static from_native(value: int) VarValue

Create a variable value from native input.

Parameters:

value (int) – The input value

Returns:

The variable value (never null)

Return type:

VarValue

static from_percent(value: float) VarValue

Create a variable value from % input.

Parameters:

value (float) – The input value

Returns:

The variable value (never null)

Return type:

VarValue

static from_ppm(value: float) VarValue

Create a variable value from ppm input.

Used for CO2 sensors.

Parameters:

value (float) – The input value

Returns:

The variable value (never null)

Return type:

VarValue

static from_var_unit(value: float, unit: VarUnit, is_abs: bool) VarValue

Create a variable value from any input.

Parameters:
  • value (float) – The input value

  • unit (VarUnit) – The input value’s unit

  • is_abs (bool) – True for absolute values (relative values are used to add/subtract from other VarValues), otherwise False

Returns:

The variable value (never null)

Return type:

VarValue

static from_volt(value: float) VarValue

Create a variable value from V input.

Parameters:

value (float) – The input value

Returns:

The variable value (never null)

Return type:

VarValue

is_locked_regulator() bool

Return if regulator is locked.

to_ampere() float

Convert to A value.

Returns:

The converted value

Return type:

float

to_celsius() float

Convert to Celsius value.

Returns:

The converted value

Return type:

float

to_degree() float

Convert to degree value.

Returns:

The converted value

Return type:

float

to_fahrenheit() float

Convert to Fahrenheit value.

Returns:

The converted value

Return type:

float

to_kelvin() float

Convert to Kelvin value.

Returns:

The converted value

Return type:

float

to_lux_i() float

Convert to lx value.

Source must be connected to I-port.

Returns:

The converted value

Return type:

float

to_lux_t() float

Convert to lx value.

Source must be connected to T-port.

Returns:

The converted value

Return type:

float

to_meters_per_second() float

Convert to m/s value.

Returns:

The converted value

Return type:

float

to_native() int

Convert to native value.

Returns:

The converted value

Return type:

int

to_percent() int

Convert to % value.

Returns:

The converted value

Return type:

int

to_ppm() int

Convert to ppm value.

Returns:

The converted value

Return type:

int

to_var_unit(unit: VarUnit, is_lockable_regulator_source: bool = False) int | float

Convert the given unit to a VarValue.

Parameters:
  • unit (VarUnit) – The variable unit

  • is_lockable_regulator_source (bool) – Is lockable source

Returns:

The variable value

Return type:

Union[int,float]

to_var_unit_string(unit: VarUnit, is_lockable_regulator_source: bool = False, use_lcn_special_values: bool = False) str

Convert the given unit into a string representation.

Parameters:
  • unit (VarUnit) – The input unit

  • is_lockable_regulator_source (bool) – Is lockable source

  • use_lcn_special_values (bool) – Use LCN special values

Returns:

The string representation of input unit.

Return type:

str

to_volt() float

Convert to V value.

Returns:

The converted value

Return type:

float

pypck.lcn_defs.hw_type_new(cls, value)

Replace Hardwaretype.__new__.

pypck.lcn_defs.motor_position_time_to_native_value(time_msec: int) int

Convert time to native LCN time value.

Scales the given time value in milliseconds to a two-byte value.

Parameters:

time_msec (int) – Duration of timer in milliseconds (1001..65535000)

Returns:

The duration in native LCN units

Return type:

int

pypck.lcn_defs.native_value_to_motor_position_time(value: int) int

Convert native LCN value to time.

Scales the given two-byte value (1..65535) to a time value in milliseconds.

Parameters:

value (int) – Duration of timer in native LCN units

Returns:

The duration in milliseconds

Return type:

int

pypck.lcn_defs.native_value_to_time(value: int) int

Convert native LCN value to time.

Scales the given byte value (0..255) to a time value in milliseconds.

Parameters:

value (int) – Duration of timer in native LCN units

Returns:

The duration in milliseconds

Return type:

int

pypck.lcn_defs.ramp_value_to_time(ramp_value: int) int

Convert the given LCN ramp value into a time.

Parameters:

ramp_value (int) – The LCN ramp value (0..250).

Returns:

The ramp time in milliseconds.

Return type:

int

pypck.lcn_defs.split_port_pin(portpin: str) tuple[str, int]

Split the port and the pin from the given input string.

Parameters:

portpin (str) – Input string

pypck.lcn_defs.time_to_native_value(time_msec: int) int

Convert time to native LCN time value.

Scales the given time value in milliseconds to a byte value (0..255). Used for RelayTimer.

Parameters:

time_msec (int) – Duration of timer in milliseconds

Returns:

The duration in native LCN units

Return type:

int

pypck.lcn_defs.time_to_ramp_value(time_msec: int) int

Convert the given time into an LCN ramp value.

Parameters:

time_msec (int) – The time in milliseconds.

Returns:

The (LCN-internal) ramp value (0..250).

Return type:

int