chrishrb/hoval-gateway

Implementation of arbitration ID is incorrect

Opened this issue · 0 comments

The arbitration ID is composed of a sender_id and a receiver_mask:

Explanation using the can id 0x1FE40801

hex:       1    F    E    4    0    8    0    1
binary: 0001 1111 1110 0100 0000 1000 0000 0001
index:    28   24   20   16   12    8    4    0
  • [31, 22]: is always 0001 1111 11
  • [21, 11]: device id of sender
    b10 0100 0000 1 = 1153, in this example the sender would be a Gateway (GW)
  • [10, 0]: receiver mask
    b000 0000 0001 = 1, the receiver is a heat generator (WEZ). I think b111 1111 1111 can be used to address all devices on the bus.

image

Current implementation

def build_arbitration_id(message_id, priority, device_type, device_id):
    return (message_id << 24) | (priority << 16) | (device_type << 8) | device_id

Should be:

def build_arbitration_id(sender_id, receiver_mask):
    return (0x7F << 22) | (sender_id << 11) | receiver_mask;