embyt / enocean-mqtt

Receives messages from an enOcean serial interface (USB) and provides selected messages to an MQTT broker.
GNU General Public License v3.0
42 stars 21 forks source link

ERROR 'address' with PTM200 DA #25

Closed brummbaer closed 2 years ago

brummbaer commented 2 years ago

Can anyone help me with this? Something is wrong with the configuration of the PTM200 DA in enocean-mqtt. What am I doing wrong?

[switch]
address         = 0x00126E5A
rorg            = 0xf6
func            = 0x02
type            = 0x02
log_learn       = 1
publish_rssi    = 1
2021-12-03 22:21:51,196 INFO: Logging to file: /enoceanmqtt/../enoceanmqtt.log
2021-12-03 22:21:51,197 INFO: Logging debug to console
2021-12-03 22:21:51,197 INFO: Loading config file /enoceanmqtt-default.conf
2021-12-03 22:21:51,198 INFO: Loading config file /config/enoceanmqtt.conf
2021-12-03 22:21:51,199 DEBUG: Created sensor: {'name': 'enocean/switch', 'address': 1207898, 'rorg': 246, 'func': 2, 'type': 2, 'log_learn': 1, 'publish_rssi': 1}
2021-12-03 22:21:51,200 DEBUG: Created sensor: {'name': 'enocean/shutter'}
2021-12-03 22:21:51,200 DEBUG: Global config: {'enocean_port': '/dev/enocean', 'log_packets': '1', 'mqtt_host': '192.168.3.12', 'mqtt_port': '1883', 'mqtt_prefix': 'enocean/', 'mqtt_client_id': 'enocean', 'mqtt_keepalive': '60', 'mqtt_user': 'xxx', 'mqtt_pwd': '*****', 'mqtt_debug': 'true'}
2021-12-03 22:21:51,200 INFO: Authenticating: xxx
2021-12-03 22:21:51,201 DEBUG: Connecting to host 192.168.3.12, port 1883, keepalive 60
2021-12-03 22:21:51,206 INFO: SerialCommunicator started
2021-12-03 22:21:51,206 WARNING: Replacing Packet.optional with default value.
2021-12-03 22:21:51,207 DEBUG: Sending CONNECT (u1, p1, wr0, wq0, wf0, c1, k60) client_id=b'enocean'
2021-12-03 22:21:51,209 DEBUG: Received CONNACK (0, 0)
2021-12-03 22:21:51,209 INFO: Succesfully connected to MQTT broker.
2021-12-03 22:21:51,209 DEBUG: Sending SUBSCRIBE (d0, m1) [(b'enocean/switch/req/#', 0)]
2021-12-03 22:21:51,209 DEBUG: Sending SUBSCRIBE (d0, m2) [(b'enocean/shutter/req/#', 0)]
2021-12-03 22:21:51,210 DEBUG: Received SUBACK
2021-12-03 22:21:51,210 DEBUG: Received SUBACK
2021-12-03 22:21:51,308 INFO: Sending packet
2021-12-03 22:21:51,308 DEBUG: 0x05 ['0x8'] [] OrderedDict()
2021-12-03 22:21:51,409 DEBUG: 0x02 ['0x0', '0xff', '0xfd', '0x7b', '0x0'] ['0xa'] OrderedDict()
2021-12-03 22:21:51,409 INFO: got response packet: OK
2021-12-03 22:21:52,011 DEBUG: 0x02 ['0x0'] [] OrderedDict()
2021-12-03 22:21:52,011 INFO: got response packet: OK
2021-12-03 22:22:51,275 DEBUG: Sending PINGREQ
2021-12-03 22:22:51,276 DEBUG: Received PINGRESP
2021-12-03 22:22:52,753 DEBUG: 00:12:6E:5A->FF:FF:FF:FF (-86 dBm): 0x01 ['0xf6', '0x30', '0x0', '0x12', '0x6e', '0x5a', '0x30'] ['0x1', '0xff', '0xff', '0xff', '0xff', '0x56', '0x0'] OrderedDict()
2021-12-03 22:22:52,756 ERROR: Traceback (most recent call last):
  File "/enoceanmqtt/enoceanmqtt.py", line 113, in main
    com.run()
  File "/enoceanmqtt/communicator.py", line 265, in run
    self._process_radio_packet(packet)
  File "/enoceanmqtt/communicator.py", line 224, in _process_radio_packet
    if enocean.utils.combine_hex(packet.sender) == cur_sensor['address']:
KeyError: 'address'

2021-12-03 22:22:52,992 DEBUG: 00:12:6E:5A->FF:FF:FF:FF (-86 dBm): 0x01 ['0xf6', '0x0', '0x0', '0x12', '0x6e', '0x5a', '0x20'] ['0x1', '0xff', '0xff', '0xff', '0xff', '0x56', '0x0'] OrderedDict()
romor commented 2 years ago

The shutter sensor is missing the mandatory address field in the config file: 2021-12-03 22:21:51,200 DEBUG: Created sensor: {'name': 'enocean/shutter'}

This triggers the error.