stas-demydiuk / domoticz-zigbee2mqtt-plugin

zigbee2mqtt plugin for domoticz
MIT License
137 stars 97 forks source link

Aqara curtain motor ZNCLDJ11LM Open/Close issue. #725

Closed Art531 closed 2 years ago

Art531 commented 3 years ago

Issue description Zigbee Aqara curtain motor ZNCLDJ11LM added successfully as "Blinds percentage" in Domoticz, can be controlled via slider and thru Events with "Level =" option (1 to 100). But it cannot be controlled with "Open" and "Close" options (so both "open" and "close" icons on this switch in "Switches" are useless). Looks like this motor uses "Open" and "Close" state descriptions as it was described in https://www.zigbee2mqtt.io/devices/ZNCLDJ11LM.html but zigbee2mqtt plugins try to switch it "On" and "Off" as it can be seen in log below:

Additional information Zigbee2MQTT version: 1.21.2 Python version: 3.7.3 Domoticz version: 2021.1 (Docker installation on Synology) Plugin version: 3.0

Logs

  1. Control motor via slider (works good): 2021-10-08 16:29:37.222 Z2M: (Z2M) onCommand: Set Level, level (1) Color: 2021-10-08 16:29:37.224 Z2M: (Z2M) Command "Set Level" from device "Motor1" 2021-10-08 16:29:37.226 Z2M: (Z2M) MqttClient::publish zigbee2mqtt/HallCurtain2/set ({"position": 99}) 2021-10-08 16:29:37.186 Status: User: Admin (IP: 192.168.100.2) initiated a switch command (480/Motor1/Set Level)

  2. Control motor via "Close" switch icon (not working): 2021-10-08 16:37:40.763 Status: User: Admin (IP: 192.168.100.2) initiated a switch command (480/Motor1/On) 2021-10-08 16:37:40.803 Error: Z2M: (Z2M) 'onCommand' failed 'KeyError'. 2021-10-08 16:37:40.803 Error: Z2M: (Z2M) ----> Line 291 in '/opt/domoticz/userdata/plugins/zigbee2mqtt/plugin.py', function onCommand 2021-10-08 16:37:40.804 Error: Z2M: (Z2M) ----> Line 104 in '/opt/domoticz/userdata/plugins/zigbee2mqtt/plugin.py', function onCommand 2021-10-08 16:37:40.805 Error: Z2M: (Z2M) ----> Line 75 in '/opt/domoticz/userdata/plugins/zigbee2mqtt/devices_manager.py', function handle_command 2021-10-08 16:37:40.806 Error: Z2M: (Z2M) ----> Line 423 in '/opt/domoticz/userdata/plugins/zigbee2mqtt/adapter.py', function handle_command 2021-10-08 16:37:40.807 Error: Z2M: (Z2M) ----> Line 33 in '/opt/domoticz/userdata/plugins/zigbee2mqtt/devices/switch/blind_percentages_switch.py', function generate_command

  3. Control motor via "Open" switch icon (not working): 2021-10-08 16:37:47.209 Status: User: Admin (IP: 192.168.100.2) initiated a switch command (480/Motor1/Off) 2021-10-08 16:37:47.241 Error: Z2M: (Z2M) 'onCommand' failed 'KeyError'. 2021-10-08 16:37:47.242 Error: Z2M: (Z2M) ----> Line 291 in '/opt/domoticz/userdata/plugins/zigbee2mqtt/plugin.py', function onCommand 2021-10-08 16:37:47.243 Error: Z2M: (Z2M) ----> Line 104 in '/opt/domoticz/userdata/plugins/zigbee2mqtt/plugin.py', function onCommand 2021-10-08 16:37:47.243 Error: Z2M: (Z2M) ----> Line 75 in '/opt/domoticz/userdata/plugins/zigbee2mqtt/devices_manager.py', function handle_command 2021-10-08 16:37:47.244 Error: Z2M: (Z2M) ----> Line 423 in '/opt/domoticz/userdata/plugins/zigbee2mqtt/adapter.py', function handle_command 2021-10-08 16:37:47.245 Error: Z2M: (Z2M) ----> Line 37 in '/opt/domoticz/userdata/plugins/zigbee2mqtt/devices/switch/blind_percentages_switch.py', function generate_command

Art531 commented 3 years ago

Looks like i've found a solution: file _/opt/domoticz/userdata/plugins/zigbee2mqtt/devices/switch/blind_percentagesswitch.py lines 31 and 37 needs to be changed from: _if cmd == 'ON': return { state_value_key: self.state_feature['value_on'] } elif cmd == 'OFF': return { state_value_key: self.state_feature['value_off'] }_

To: _if cmd == 'ON': return { state_value_key: 'close' } elif cmd == 'OFF': return { state_valuekey: 'open' }

Now with this changes "Open" and "Close" buttons are working prefectly, but "Timers" in "Blinds switch" not working any more :)

stas-demydiuk commented 2 years ago

Do you still have the issue with plugin 3.1-beta from the master branch?

Art531 commented 2 years ago

Haven't tested it with 3.1-beta, i'm using 3.0.0 latest plugin.