pypck.lcn_defs
¶
Definitions and constants for pypck.
- class pypck.lcn_defs.AccessControlPeriphery(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Action types for LCN keys.
- class pypck.lcn_defs.BatteryStatus(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Battery status.
- class pypck.lcn_defs.BeepSound(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Beep sounds supported by LCN modules.
- class pypck.lcn_defs.BinSensorPort(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Binary sensor port of LCN module.
- class pypck.lcn_defs.HardwareType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
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(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Keys of LCN module.
- class pypck.lcn_defs.KeyAction(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Action types for LCN keys.
- class pypck.lcn_defs.KeyLockStateModifier(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Key-lock modifiers used in LCN commands.
- class pypck.lcn_defs.LcnEvent(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
LCN events.
- class pypck.lcn_defs.LedPort(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
LED port of LCN module.
- class pypck.lcn_defs.LedStatus(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Possible states for LCN LEDs.
- class pypck.lcn_defs.LogicOpPort(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Logic Operation port of LCN module.
- class pypck.lcn_defs.LogicOpStatus(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Possible states for LCN logic-operations.
- class pypck.lcn_defs.MotorPort(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Motor ports of LCN module.
- class pypck.lcn_defs.MotorPositioningMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Motor positioning mode used in LCN commands.
- class pypck.lcn_defs.MotorReverseTime(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Motor reverse time user in LCN commands.
For modules with FW<190C the release time has to be specified.
- class pypck.lcn_defs.MotorStateModifier(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Motor-state modifiers used in LCN commands.
LCN module has to be configured for motors connected to relays.
- class pypck.lcn_defs.OutputPort(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Output port of LCN module.
- class pypck.lcn_defs.OutputPortDimMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
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(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
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(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Value-reference for relative LCN variable commands.
- class pypck.lcn_defs.RelayPort(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Relay port of LCN module.
- class pypck.lcn_defs.RelayStateModifier(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Relay-state modifiers used in LCN commands.
- class pypck.lcn_defs.SendKeyCommand(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Command types used when sending LCN keys.
- class pypck.lcn_defs.TimeUnit(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Time units used for several LCN commands.
- class pypck.lcn_defs.Var(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
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:
- 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:
- 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:
- 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
- class pypck.lcn_defs.VarUnit(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Measurement units used with LCN variables.
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- static from_var_unit(value: float, unit: VarUnit, is_abs: bool) VarValue ¶
Create a variable value from any input.
- 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:
- 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