pypck.lcn_addr

Classes to store module and group addresses.

class pypck.lcn_addr.LcnAddr(seg_id: int, addr_id: int, is_group: bool = False)

Represents a LCN address (module or group).

If the segment id is 0, the address object points to modules/groups which are in the segment where the bus coupler is connected to. This is also the case if no segment coupler is present at all.

Parameters:
  • seg_id (int) – Segment id (0 = Local, 1..2 = Not allowed (but “seen in the wild”) 3 = Broadcast, 4 = Status messages, 5..127, 128 = Segment-bus disabled (valid value))

  • is_group (bool) – Indicates whether address point to a module (False) or a group (True)

If address represents a module:

Parameters:

addr_id (int) – Module id (1 = LCN-PRO, 2 = LCN-GVS/LCN-W, 4 = PCHK, 5..254, 255 = Unprog. (valid, but irrelevant here))

If address represents a group:

Parameters:

addr_id (int) – Group id (3 = Broadcast, 4 = Status messages, 5..254)

get_physical_seg_id(local_seg_id: int) int

Get the physical segment id (“local” segment replaced with 0).

Can be used to send data into the LCN bus.

Parameters:

local_seg_id (int) – The segment id of the local segment

Returns:

The physical segment id

Return type:

int