Services

Decode from bus messages

knx_stack.decode.layer.application.a_group_value_read.ind.decode(state: knx_stack.State, msg: knx_stack.Msg) Iterable[knx_stack.definition.layer.application.a_group_value_read.ind.Msg]
>>> import knx_stack
>>> asap = knx_stack.ASAP(1)
>>> address_table = knx_stack.AddressTable(knx_stack.Address(0x0001), [], 255)
>>> association_table = knx_stack.AssociationTable(address_table, {})
>>> association_table.associate(asap, [knx_stack.GroupAddress(free_style=0x0002)])
>>> state = knx_stack.State(knx_stack.Medium.usb_hid, association_table,
...                         knx_stack.GroupObjectTable({asap: knx_stack.datapointtypes.DPT_Switch}))
>>> ind = knx_stack.decode_msg(state, knx_stack.usb_hid.Msg.make_from_str("0113130008000B01030000290096E000000002010000"))
>>> ind
[GroupValueReadInd (DPT_Switch {'action': 'off'} for asap 1)]
knx_stack.decode.layer.application.a_group_value_read.con.decode(state: knx_stack.State, msg: knx_stack.Msg) Iterable[knx_stack.definition.layer.application.a_group_value_read.con.Msg]
>>> import knx_stack
>>> asap = knx_stack.ASAP(1)
>>> address_table = knx_stack.AddressTable(knx_stack.Address(0x0001), [], 255)
>>> association_table = knx_stack.AssociationTable(address_table, {})
>>> association_table.associate(asap, [knx_stack.GroupAddress(free_style=0x0002)])
>>> state = knx_stack.State(knx_stack.Medium.usb_hid, association_table,
...                         knx_stack.GroupObjectTable({asap: knx_stack.datapointtypes.DPT_Switch}))
>>> con = knx_stack.decode_msg(state, knx_stack.usb_hid.Msg.make_from_str("0113130008000B010300002E0096E000000002010000"))
>>> con
[GroupValueReadCon status 0 (DPT_Switch {'action': 'off'} for asap 1)]
knx_stack.decode.layer.application.a_group_value_response.ind.decode(state: knx_stack.State, msg: knx_stack.Msg) Iterable[knx_stack.definition.layer.application.a_group_value_response.ind.Msg]
knx_stack.decode.layer.application.a_group_value_response.con.decode(state: knx_stack.State, msg: knx_stack.Msg) Iterable[knx_stack.definition.layer.application.a_group_value_response.con.Msg]
knx_stack.decode.layer.application.a_group_value_write.ind.decode(state: knx_stack.State, msg: knx_stack.Msg) Iterable[knx_stack.definition.layer.application.a_group_value_write.ind.Msg]
>>> import knx_stack
>>> asap = knx_stack.ASAP(1, "example asap")
>>> address_table = knx_stack.AddressTable(knx_stack.Address(0x0001), [], 255)
>>> association_table = knx_stack.AssociationTable(address_table, {})
>>> association_table.associate(asap, [knx_stack.GroupAddress(0x0002)])
>>> state = knx_stack.State(knx_stack.Medium.usb_hid, association_table,
...                         knx_stack.GroupObjectTable({asap: knx_stack.datapointtypes.DPT_Switch}))
>>> ind = knx_stack.decode_msg(state, knx_stack.usb_hid.Msg.make_from_str("0113130008000B01030000290096E000000002010081"))
>>> ind
[GroupValueWriteInd (DPT_Switch {'action': 'on'} for asap 1 (example asap))]
knx_stack.decode.layer.application.a_group_value_write.con.decode(state: knx_stack.State, msg: knx_stack.Msg) Iterable[knx_stack.definition.layer.application.a_group_value_write.con.Msg]
>>> import knx_stack
>>> asap = knx_stack.ASAP(1, "example asap")
>>> address_table = knx_stack.AddressTable(knx_stack.Address(0x0001), [], 255)
>>> association_table = knx_stack.AssociationTable(address_table, {})
>>> association_table.associate(asap, [knx_stack.GroupAddress(0x0002)])
>>> state = knx_stack.State(knx_stack.Medium.usb_hid, association_table,
...                         knx_stack.GroupObjectTable({asap: knx_stack.datapointtypes.DPT_Switch}))
>>> con = knx_stack.decode_msg(state, knx_stack.usb_hid.Msg.make_from_str("0113130008000B010300002E0096E000000002010081"))
>>> con
[GroupValueWriteCon status 0 (DPT_Switch {'action': 'on'} for asap 1 (example asap))]
knx_stack.decode.layer.application.a_property_value_read.ind.decode(state: knx_stack.State, msg: knx_stack.Msg) Iterable[knx_stack.definition.layer.application.a_property_value_read.ind.Msg]
>>> import knx_stack
>>> asap = knx_stack.ASAP(0)
>>> address_table = knx_stack.AddressTable(knx_stack.Address(0x102C), [], 255)
>>> association_table = knx_stack.AssociationTable(address_table, {})
>>> state = knx_stack.State(knx_stack.Medium.usb_hid, association_table, knx_stack.GroupObjectTable())
>>> ind = knx_stack.decode_msg(state, knx_stack.usb_hid.Msg.make_from_str("0113170008000F0103000029009660102C00000503D5007B1021"))
>>> ind
[PropertyValueReadInd (object index 0, property id 123, number of elements 1, start index 33 for asap 0)]
knx_stack.decode.layer.application.a_property_value_read.con.decode(state: knx_stack.State, msg: knx_stack.Msg) Iterable[knx_stack.definition.layer.application.a_property_value_read.con.Msg]
>>> import knx_stack
>>> asap = knx_stack.ASAP(0)
>>> address_table = knx_stack.AddressTable(knx_stack.Address(0x102C), [], 255)
>>> association_table = knx_stack.AssociationTable(address_table, {})
>>> state = knx_stack.State(knx_stack.Medium.usb_hid, association_table, knx_stack.GroupObjectTable())
>>> con = knx_stack.decode_msg(state, knx_stack.usb_hid.Msg.make_from_str("0113170008000F010300002E0096600000102C0503D5007B1021"))
>>> con
[PropertyValueReadCon status 0 (object index 0, property id 123, number of elements 1, start index 33 for asap 0)]
knx_stack.decode.layer.application.a_property_value_response.ind.decode(state: knx_stack.State, msg: knx_stack.Msg) Iterable[knx_stack.definition.layer.application.a_property_value_response.ind.Msg]
knx_stack.decode.layer.application.a_property_value_response.con.decode(state: knx_stack.State, msg: knx_stack.Msg) Iterable[knx_stack.definition.layer.application.a_property_value_response.con.Msg]
knx_stack.decode.layer.application.a_property_value_write.ind.decode(state: knx_stack.State, msg: knx_stack.Msg) Iterable[knx_stack.definition.layer.application.a_property_value_write.ind.Msg]
>>> import knx_stack
>>> asap = knx_stack.ASAP(0)
>>> address_table = knx_stack.AddressTable(knx_stack.Address(0x102C), [], 255)
>>> association_table = knx_stack.AssociationTable(address_table, {})
>>> state = knx_stack.State(knx_stack.Medium.usb_hid, association_table, knx_stack.GroupObjectTable())
>>> ind = knx_stack.decode_msg(state, knx_stack.usb_hid.Msg.make_from_str("011318000800100103000029009660102C00000603D7007B1021FF"))
>>> ind
[PropertyValueWriteInd FF (object index 0, property id 123, number of elements 1, start index 33 for asap 0)]
knx_stack.decode.layer.application.a_property_value_write.con.decode(state: knx_stack.State, msg: knx_stack.Msg) Iterable[knx_stack.definition.layer.application.a_property_value_write.con.Msg]
>>> import knx_stack
>>> asap = knx_stack.ASAP(0)
>>> address_table = knx_stack.AddressTable(knx_stack.Address(0x102C), [], 255)
>>> association_table = knx_stack.AssociationTable(address_table, {})
>>> state = knx_stack.State(knx_stack.Medium.usb_hid, association_table, knx_stack.GroupObjectTable())
>>> con = knx_stack.decode_msg(state, knx_stack.usb_hid.Msg.make_from_str("01131800080010010300002E0096600000102C0603D7007B1021FF"))
>>> con
[PropertyValueWriteCon FF status 0 (object index 0, property id 123, number of elements 1, start index 33 for asap 0)]

Encode to bus messages

knx_stack.encode.layer.application.a_group_value_read.req.encode(state: knx_stack.State, msg: knx_stack.layer.application.a_group_value_read.req.Msg) knx_stack.Msg
>>> import knx_stack
>>> asap = knx_stack.ASAP(1)
>>> address_table = knx_stack.AddressTable(knx_stack.Address(0x0001), [], 255)
>>> association_table = knx_stack.AssociationTable(address_table, {})
>>> association_table.associate(asap, [knx_stack.GroupAddress(free_style=0x0002)])
>>> state = knx_stack.State(knx_stack.Medium.usb_hid, association_table,
...                         knx_stack.GroupObjectTable({asap: knx_stack.datapointtypes.DPT_Switch}))
>>> req_msg = knx_stack.layer.application.a_group_value_read.req.Msg(asap=asap)
>>> req = knx_stack.encode_msg(state, req_msg)
>>> req
0113130008000B01030000110096E000000002010000
knx_stack.encode.layer.application.a_group_value_write.req.encode(state: knx_stack.State, msg: knx_stack.layer.application.a_group_value_write.req.Msg) knx_stack.Msg
>>> import knx_stack
>>> asap = knx_stack.ASAP(1)
>>> address_table = knx_stack.AddressTable(knx_stack.Address(0x0001), [], 255)
>>> association_table = knx_stack.AssociationTable(address_table, {})
>>> association_table.associate(asap, [knx_stack.GroupAddress(0x0002)])
>>> state = knx_stack.State(knx_stack.Medium.usb_hid, association_table,
...                         knx_stack.GroupObjectTable({asap: knx_stack.datapointtypes.DPT_Switch}))
>>> switch = knx_stack.datapointtypes.DPT_Switch()
>>> switch.bits.action = knx_stack.datapointtypes.DPT_Switch.Action.on
>>> req_msg = knx_stack.layer.application.a_group_value_write.req.Msg(asap=asap, dpt=switch)
>>> req = knx_stack.encode_msg(state, req_msg)
>>> req
0113130008000B01030000110096E000000002010081
knx_stack.encode.layer.application.a_property_value_read.req.encode(state: knx_stack.State, msg: knx_stack.layer.application.a_property_value_read.req.Msg) knx_stack.Msg
>>> import knx_stack
>>> asap = knx_stack.ASAP(0)
>>> address_table = knx_stack.AddressTable(knx_stack.Address(0x102C), [], 255)
>>> association_table = knx_stack.AssociationTable(address_table, {})
>>> state = knx_stack.State(knx_stack.Medium.usb_hid, association_table, knx_stack.GroupObjectTable())
>>> req_msg = knx_stack.layer.application.a_property_value_read.req.Msg(asap=asap, object_index=0, property_id=0x7B,
...                                                                     number_of_elements=1, start_index=0x21)
>>> req = knx_stack.encode_msg(state, req_msg)
>>> req
0113170008000F01030000110096600000102C0503D5007B1021
knx_stack.encode.layer.application.a_property_value_write.req.encode(state: knx_stack.State, msg: knx_stack.layer.application.a_property_value_write.req.Msg) knx_stack.Msg
>>> import knx_stack
>>> asap = knx_stack.ASAP(0)
>>> address_table = knx_stack.AddressTable(knx_stack.Address(0x102C), [], 255)
>>> association_table = knx_stack.AssociationTable(address_table, {})
>>> state = knx_stack.State(knx_stack.Medium.usb_hid, association_table, knx_stack.GroupObjectTable())
>>> req_msg = knx_stack.layer.application.a_property_value_write.req.Msg(asap=asap, object_index=0, property_id=0x7B,
...                                                                      number_of_elements=1, start_index=0x21,
...                                                                      data='FF')
>>> req = knx_stack.encode_msg(state, req_msg)
>>> req
0113180008001001030000110096600000102C0603D7007B1021FF