stas-demydiuk / domoticz-zigbee2mqtt-plugin

zigbee2mqtt plugin for domoticz
MIT License
136 stars 98 forks source link

'onMessage' failed 'KeyError' #1

Closed Tezzlicious closed 5 years ago

Tezzlicious commented 5 years ago

Aqara Door Sensor

On:

2018-09-28 19:05:35.375 (Zigbee2MQTT) MQTT message: zigbee2mqtt/0x00158d00020921ca {'battery': '88.33', 'voltage': 2965, 'linkquality': 0, 'contact': True}

These errors happen:

2018-09-28 19:05:35.376 Error: (Zigbee2MQTT) 'onMessage' failed 'KeyError'. 2018-09-28 19:05:35.376 Error: (Zigbee2MQTT) ----> Line 160 in '/home/pi/domoticz/plugins/zigbee2mqtt/plugin.py, function onMessage 2018-09-28 19:05:35.376 Error: (Zigbee2MQTT) ----> Line 106 in '/home/pi/domoticz/plugins/zigbee2mqtt/plugin.py, function onMessage 2018-09-28 19:05:35.376 Error: (Zigbee2MQTT) ----> Line 126 in '/home/pi/domoticz/plugins/zigbee2mqtt/mqtt.py, function onMessage 2018-09-28 19:05:35.377 Error: (Zigbee2MQTT) ----> Line 131 in '/home/pi/domoticz/plugins/zigbee2mqtt/plugin.py, function onMQTTPublish 2018-09-28 19:05:35.378 Error: (Zigbee2MQTT) ----> Line 12 in '/home/pi/domoticz/plugins/zigbee2mqtt/zigbee_message.py, function get_device_model

Same for contact: False event.

No device is being created under devices.

Tezzlicious commented 5 years ago

I've noticed just now that the Aqara door sensor support is not implemented yet.

stas-demydiuk commented 5 years ago

@Tezzlicious I don't see device information in your mqtt message. Most likely you haven't added mqtt > include_device_information : true to your configuration.yml file, or you are using zigbee2mqtt not from dev branch

As support for MiJia door & window contact sensor has already been implemented it will be easy to add aqara version as well. I just need example of MQTT message with device information.

Tezzlicious commented 5 years ago

Any idea how I can get my docker container to run from the dev branch?

And here are the MQTT messages for open/close:

{"battery":"100.00","voltage":3015,"linkquality":13,"contact":false}

{"battery":"100.00","voltage":3015,"linkquality":7,"contact":true}

Edit: So this ain't device info then :)

stas-demydiuk commented 5 years ago

If you are using official docker image, you may try latest-dev tag, I hope it should help. https://hub.docker.com/r/koenkk/zigbee2mqtt/tags/

Tezzlicious commented 5 years ago

2018-9-28 19:06:36 - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d00020921ca', payload: '{"contact":true,"linkquality":0,"device":{"ieeeAddr":"0x00158d00020921ca","friendlyName":"0x00158d00020921ca","type":"EndDevice","nwkAddr":32246,"manufId":4151,"manufName":"LUMI","powerSource":"Battery","modelId":"lumi.sensor_magnet.aq2","status":"online"}}'

stas-demydiuk commented 5 years ago

I've uploaded the new plugin version, it should now support aqara door sensor. I wonder if you could check

Tezzlicious commented 5 years ago

Working like a charm! :)

Can you make it a type 'Contact' instead of 'Door contact' ? Because it's not only used as a door contact ;) It then also matches the type that the Xiaomi Gateway plugin of domoticz uses.