Closed russdan closed 2 years ago
Hi @stas-demydiuk I have identified the problem which is how features are handled in adapter.py
.. there were two issues:
Error: zigbee2mqtt: (zigbee2mqtt) Hive_Controller: can not process binary item "temperature_setpoint_hold"
This needed an entry creating to handle this as an on/off switch;temperature_setpoint_hold_duration
is a numeric value but has no unit as its just a number, so the code fails with
Error: zigbee2mqtt: (zigbee2mqtt) 'onMessage' failed 'KeyError':'('unit',)'.
as it assumes all keys with setpoint in them contain a unit, so I added a try/except
to read feature['unit']
and add as a custom value in the except.All devices identified after the failure of temperature_setpoint_hold_duration
were therefore not processed which is why they don't have any features.
I have fixed these issues on my local branch but don't have permission to push to create a PR - can you give me permission to do so please?
As I can't create a PR I created a diff patch so you can check and apply if you're happy with the changes...
git diff adapter.py ~/adapter.py
diff --git a/adapter.py b/home/pi/adapter.py
index 9e96e39..420bf13 100644
--- a/adapter.py
+++ b/home/pi/adapter.py
@@ -171,6 +171,11 @@ class UniversalAdapter(Adapter):
self._add_device(alias, feature, ContactSensor, ' (Consumer Connected)')
return
+ if (feature['name'] == 'temperature_setpoint_hold' and state_access and write_access):
+ alias = self._generate_alias(feature, 'temphld')
+ self._add_device(alias, feature, OnOffSwitch)
+ return
+
if (feature['name'] == 'state' and state_access and write_access):
alias = self._generate_alias(feature, 'state')
self._add_device(alias, feature, OnOffSwitch)
@@ -257,16 +262,25 @@ class UniversalAdapter(Adapter):
self._add_device(alias, feature, CurrentSensor, ' (Current)')
return
- if 'setpoint' in feature['name'] and feature['unit'] == '<C2><B0>C' and write_access:
- alias = self._generate_alias(feature, 'spoint')
- self._add_device(alias, feature, SetPoint, ' (Setpoint)')
+ if 'setpoint' in feature['name']:
+ try:
+ unit=feature['unit']
+ except:
+ unit=''
+
+ if unit == '<C2><B0>C' and write_access:
+ alias = self._generate_alias(feature, 'spoint')
+ self._add_device(alias, feature, SetPoint, ' (Setpoint)')
+ elif unit == '':
+ alias = self._generate_alias(feature, 'duration')
+ self._add_device(alias, feature, CustomSensor, ' (Hold Duration)')
return
if (feature['name'] == 'position' and state_access):
alias = self._generate_alias(feature, 'level')
self._add_device(alias, feature, LevelSwitch)
return
-
+
if (feature['name'] == 'color_temp_startup' and state_access):
return
Hi, even though this was about sensors, do you think the root cause is the same as here: https://github.com/stas-demydiuk/domoticz-zigbee2mqtt-plugin/issues/707
Possibly - what I had in the logs which I'd dismissed as irrelevant was
2021-09-28 12:51:00.435 Error: zigbee2mqtt: (zigbee2mqtt) Hive Controller: can not process binary item "temperature_setpoint_hold"
2021-09-28 12:51:00.435 Error: zigbee2mqtt: (zigbee2mqtt) 'onMessage' failed 'KeyError':'('unit',)'.
2021-09-28 12:51:00.435 Error: zigbee2mqtt: (zigbee2mqtt) Exception traceback:
2021-09-28 12:51:00.435 Error: zigbee2mqtt: (zigbee2mqtt) ----> Line 298 in '/home/pi/domoticz/plugins/zigbee2mqtt-plugin/plugin.py', function onMessage
2021-09-28 12:51:00.435 Error: zigbee2mqtt: (zigbee2mqtt) ----> Line 137 in '/home/pi/domoticz/plugins/zigbee2mqtt-plugin/plugin.py', function onMessage
2021-09-28 12:51:00.436 Error: zigbee2mqtt: (zigbee2mqtt) ----> Line 167 in '/home/pi/domoticz/plugins/zigbee2mqtt-plugin/mqtt.py', function onMessage
2021-09-28 12:51:00.436 Error: zigbee2mqtt: (zigbee2mqtt) ----> Line 166 in '/home/pi/domoticz/plugins/zigbee2mqtt-plugin/plugin.py', function onMQTTPublish
2021-09-28 12:51:00.436 Error: zigbee2mqtt: (zigbee2mqtt) ----> Line 45 in '/home/pi/domoticz/plugins/zigbee2mqtt-plugin/devices_manager.py', function set_devices
2021-09-28 12:51:00.436 Error: zigbee2mqtt: (zigbee2mqtt) ----> Line 47 in '/home/pi/domoticz/plugins/zigbee2mqtt-plugin/adapter.py', function __init__
2021-09-28 12:51:00.436 Error: zigbee2mqtt: (zigbee2mqtt) ----> Line 59 in '/home/pi/domoticz/plugins/zigbee2mqtt-plugin/adapter.py', function _add_features
2021-09-28 12:51:00.436 Error: zigbee2mqtt: (zigbee2mqtt) ----> Line 71 in '/home/pi/domoticz/plugins/zigbee2mqtt-plugin/adapter.py', function _add_feature
2021-09-28 12:51:00.436 Error: zigbee2mqtt: (zigbee2mqtt) ----> Line 260 in '/home/pi/domoticz/plugins/zigbee2mqtt-plugin/adapter.py', function add_numeric_device
but actually this caused the feature creation to stop for any devices after/including the Hive Controller device, so it could be the same for your devices - as @stas-demydiuk asked in #707 what do you see in the domoticz.log? If you see adapter.py
messages in the domoticz.log its probably a similar condition which needs trapping / handling in the code...
I would say remove the plugin (Delete it from Devices), re-add the plugin again (to ensure all devices cleared) and then ensure you capture the zigbee2mqtt messages from the log - I have Domoticz logging to /var/log/domoticz.log
so its easy to cat
the log and grep
for a pattern (eg cat /var/log/domoticz.log | grep adapter.py
).... adapter.py
is where the features get added so if there's an issue its likely to be in that class...
@russdan, anyone could create a PR to this repo, you just need to fork it, push your changes to the fork and then create a PR. But nevermind, thanks to your diff, I've already pushed the update, thanks!
DIYRuZ_Flower still do not show soil_moisture DIYRuZ_Geiger still do not show radioactive_events_per_minute etc. thank you
Issue description Having upgraded to latest v3.1.0 beta some devices have no Domoticz features created even though the device appears in the zigbee2mqtt custom page and
api_transport
. So far I have:Some of the same model of zigbee sensors have Domoticz devices, some have nothing. These sensors were all working and recognised prior to the upgrade to v3.1.0 beta.
Looking at the Plugin Configuration tab the devices with no features are missing (see log from plugin configuration in logs section).
Full device list:
Devices marked with a
*
have no Domoticz features. Even devices of the same type have some which are OK and some which aren't, for example00158d00054d2f08
is a RTCGQ11LM PIR which has all its Domoticz features, but0x00158d0004876875
,0x00158d000632d41c
,0x00158d0004514c0e
and0x00158d00054d2f08
are missing all Domoticz features...All of the devices appear in the
api_transport
device, for example:"friendly_name": "Garage PIR", "ieee_address": "0x00158d000632d41c", "interview_completed": true, "interviewing": false, "manufacturer": "LUMI", "model_id": "lumi.sensor_motion", "network_address": 5685, "power_source": "Battery", "supported": true, "type": "EndDevice"}, {"definition": {"description": "Aqara human body movement and illuminance sensor", "exposes": [{"access": 1, "description": "Remaining battery in %", "name": "battery", "property": "battery", "type": "numeric", "unit": "%", "value_max": 100, "value_min": 0}, {"access": 1, "description": "Indicates whether the device detected occupancy", "name": "occupancy", "property": "occupancy", "type": "binary", "value_off": false, "value_on": true}, {"access": 1, "description": "Measured temperature value", "name": "temperature", "property": "temperature", "type": "numeric", "unit": "\u00b0C"}, {"access": 1, "description": "Voltage of the battery in millivolts", "name": "voltage", "property": "voltage", "type": "numeric", "unit": "mV"}, {"access": 1, "description": "Measured illuminance in lux", "name": "illuminance_lux", "property": "illuminance", "type": "numeric", "unit": "lx"}, {"access": 1, "description": "Measured illuminance in lux", "name": "illuminance", "property": "illuminance", "type": "numeric", "unit": "lx"}, {"access": 1, "description": "Link quality (signal strength)", "name": "linkquality", "property": "linkquality", "type": "numeric", "unit": "lqi", "value_max": 255, "value_min": 0}], "model": "RTCGQ11LM", "supports_ota": false, "vendor": "Xiaomi"}, "endpoints": {"1": {"bindings": [], "clusters": {"input": [], "output": []}
Additional information Zigbee2MQTT version: 1.21.1 commit: 4a51e0c0 Python version: PluginSystem: Python version '3.7.3'. Domoticz version: Domoticz V2021.1 (build 13639) (c)2012-2021 GizMoCuz Status: Build Hash: d20f51ba2, Date: 2021-09-29 06:58:52 Plugin version: plugin: v.3.1.0-beta, zigbee2mqtt: v.1.21.1 (zStack3x0 20210319)
Logs Attach any additional logs here which might be useful: mqtt, domoticz, plugin logs
domoticz.log for the start-up phase of the plugin: