# `pypck.input`

Parsers for incoming PCK messages.

class pypck.inputs.AuthFailed

  Authentication failed message received from PCHK.

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.AuthOk

  Authentication ok message received from PCHK.

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.AuthPassword

  Authentication password message received from PCHK.

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs

    Return type:

      List with instances of `Input`

class pypck.inputs.AuthUsername

  Authentication username message received from PCHK.

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs

    Return type:

      List with instances of `Input`

class pypck.inputs.CommandError(message: str)

  Command error received from PCHK.

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.DecModeSet

  Decimal mode set received from PCHK.

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.Input

  Parent class for all input data read from LCN-PCHK.

  An implementation of `Input` has to provide easy accessible attributes and/or methods to expose the PCK command properties to the user. Each Input object provides an implementation of `try_parse()` static method, to parse the given plain text PCK command. If the command can be parsed by the Input object, a list of instances of `Input` is returned. Otherwise, nothing is returned.

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

class pypck.inputs.InputParser

  Parse all input objects for given input data.

  static parse(data: str) → list[Input]

    Parse all input objects for given input data.

    Parameters:

      data (str) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.LcnConnState(is_lcn_connected: bool)

  LCN bus connected message received from PCHK.

  property is_lcn_connected: bool

    Return the LCN bus connection status.

    Returns:

      True if connection to hardware bus was established, otherwise False.

    Return type:

      bool

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.LicenseError

  LCN bus connected message received from PCHK.

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.ModAck(physical_source_addr: LcnAddr, code: AcknowledgeErrorCode)

  Acknowledge message received from module.

  get_code() → AcknowledgeErrorCode

    Return the acknowledge code.

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.ModInput(physical_source_addr: LcnAddr)

  Parent class of all inputs having an LCN module as its source.

  The class in inherited from `Input`

class pypck.inputs.ModNameComment(physical_source_addr: LcnAddr, command: str, block_id: int, text: str)

  Name or comment received from an LCN module.

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.ModSendCommandHost(physical_source_addr: LcnAddr, parameters: tuple[int, ...])

  Send command to host message from module.

  get_parameters() → tuple[int, ...]

    Return the received parameters.

    Returns:

      Parameters

    Return type:

      List with parameters of type int.

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.ModSendKeysHost(physical_source_addr: LcnAddr, actions: list[SendKeyCommand], keys: list[bool])

  Send command to host message from module.

  get_actions() → list[SendKeyCommand]

    Get key actions for each table.

    Returns:

      List of length 3 with key actions for each table A, B, C.

    Return type:

      list(`SendKeyCommand`)

  get_keys() → list[bool]

    Get keys which should be triggered.

    Returns:

      List of booleans (length 8) for each key (True: trigger, False: do nothing).

    Return type:

      list(bool)

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.ModSk(physical_source_addr: LcnAddr, reported_seg_id: int)

  Segment information received from an LCN segment coupler.

  get_reported_seg_id() → int

    Return the segment id reported from segment coupler.

    Returns:

      Reported segment id.

    Return type:

      int

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.ModSn(physical_source_addr: LcnAddr, hardware_serial: int, manu: int, software_serial: int, hardware_type: HardwareType)

  Serial number and firmware version received from an LCN module.

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.ModStatusAccessControl(physical_source_addr: LcnAddr, periphery: AccessControlPeriphery, code: str, level: int | None = None, key: int | None = None, action: KeyAction | None = None, battery: BatteryStatus | None = None)

  Status of a transmitter, transponder or fingerprint sensor.

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.ModStatusBinSensors(physical_source_addr: LcnAddr, states: list[bool])

  Status of 8 binary sensors received from an LCN module.

  get_state(bin_sensor_id: int) → bool

    Get the state of a single binary-sensor.

    Parameters:

      bin_sensor_id (int) – Binary sensor id (0..7)

    Returns:

      The binary-sensor’s state

    Return type:

      bool

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.ModStatusGroups(physical_source_addr: LcnAddr, dynamic: bool, max_groups: int, groups: list[LcnAddr])

  Group memberships status received from an LCN module.

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.ModStatusKeyLocks(physical_source_id: LcnAddr, states: list[list[bool]])

  Status of locked keys received from an LCN module.

  Parameters:

    - physicalSourceAddr (int) – The source address

    - states (list(list(bool))) – The 4x8 key-lock states

  get_state(table_id: int, key_id: int) → bool

    Get the lock-state of a single key.

    Parameters:

      - tableId (int) – Table id: (0..3 => A..D)

      - keyId (int) – Key id (0..7 => 1..8)

    Returns:

      The key’s lock-state

    Return type:

      bool

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.ModStatusLedsAndLogicOps(physical_source_addr: LcnAddr, states_led: list[LedStatus], states_logic_ops: list[LogicOpStatus])

  Status of LEDs and logic-operations received from an LCN module.

  Parameters:

    - physicalSourceAddr (int) – The physical source address

    - states_led (list(`LedStatus`)) – The 12 LED states

    - states_logic_ops (list(`LogicOpStatus`)) – The 4 logic-operation states

  get_led_state(led_id: int) → LedStatus

    Get the status of a single LED.

    Parameters:

      led_id (int) – LED id (0..11)

    Returns:

      The LED’s status

    Return type:

      list(`LedStatus`)

  get_logic_op_state(logic_op_id: int) → LogicOpStatus

    Get the status of a single logic operation.

    Parameters:

      logic_op_id (int) – Logic operation id (0..3)

    Returns:

      The logic-operation’s status

    Return type:

      list(`LogicOpStatus`)

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.ModStatusMotorPositionBS4(physical_source_addr: LcnAddr, motor: int, position: float, limit: float | None = None, time_down: int | None = None, time_up: int | None = None)

  Status of motor positions (if BS4 connected) received from an LCN module.

  Position and limit is in percent. 0%: cover closed, 100%: cover open.

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.ModStatusMotorPositionModule(physical_source_addr: LcnAddr, motor: int, position: float)

  Status of motor positions received from an LCN module.

  Position is in percent. 0%: cover closed, 100%: cover open.

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.ModStatusOutput(physical_source_addr: LcnAddr, output_id: int, percent: float)

  Status of an output-port in percent received from an LCN module.

  get_output_id() → int

    Return the output port id.

    Returns:

      Output port id.

    Return type:

      int

  get_percent() → float

    Return the output brightness in percent.

    Returns:

      Brightness in percent.

    Return type:

      float

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.ModStatusOutputNative(physical_source_addr: LcnAddr, output_id: int, value: int)

  Status of an output-port in native units received from an LCN module.

  get_output_id() → int

    Return the output port id.

    Returns:

      Output port id.

    Return type:

      int

  get_value() → int

    Return the output brightness in native units.

    Returns:

      Brightness in percent.

    Return type:

      float

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.ModStatusRelays(physical_source_addr: LcnAddr, states: list[bool])

  Status of 8 relays received from an LCN module.

  Includes helper functions for motor states based on LCN wiring.

  get_motor_onoff_relay(motor_id: int) → int

    Get the motor on/off relay id.

  get_motor_updown_relay(motor_id: int) → int

    Get the motor up/down relay id.

  get_state(relay_id: int) → bool

    Get the state of a single relay.

    Parameters:

      relay_id (int) – Relay id (0..7)

    Returns:

      The relay’s state

    Return type:

      bool

  is_assumed_closed(motor_id: int) → bool

    Check if a motor is closed.

    The closed state is assumed if the motor direction is down and the motor is switched off.”

  is_closing(motor_id: int) → bool

    Check if a motor is closing.

  is_opening(motor_id: int) → bool

    Check if a motor is opening.

  motor_is_on(motor_id: int) → bool

    Check if a motor is on.

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.ModStatusSceneOutputs(physical_source_addr: LcnAddr, scene_id: int, values: list[int], ramps: list[int])

  Status of the output values and ramp values received from an LCN module.

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.ModStatusVar(physical_source_addr: LcnAddr, orig_var: Var, value: VarValue)

  Status of a variable received from an LCN module.

  get_value() → VarValue

    Get the variable’s value.

    Returns:

      The value of the variable.

    Return type:

      int

  get_var() → Var

    Get the variable’s real type.

    Returns:

      The real type

    Return type:

      `Var`

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.Ping(count: int | None)

  Ping message received from PCHK.

  property count: int | None

    Return the ping count.

    Returns:

      Ping count

    Return type:

      int | None

  static try_parse(data: str) → list[Input] | None

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`

class pypck.inputs.Unknown(data: str)

  Handle all unknown input data.

  property data: str

    Return the received data.

    Returns:

      Received data.

    Return type:

      str

  static try_parse(data: str) → list[Input]

    Try to parse the given input text.

    Will return a list of parsed Inputs. The list might be empty (but not null).

    Parameters:

      str (data) – The input data received from LCN-PCHK

    Returns:

      The parsed Inputs (never null)

    Return type:

      List with instances of `Input`