Closed wijnandtop closed 4 years ago
I think I've found the issue.
In GardenaSmartIrrigationControl each instance gets a reference to the device and the specific valve that entity represents. The valve is stored as self._valve. That is just a regular dict.
In SmartIrrigationControl.update_device_specific_data() (in py-smart-gardena2) it actually replaces that dict with a new dict:
if device_map["type"] == "VALVE":
self.valves[device_map["id"]] = {
...
If the irrigation control works after commit f1d581065fbee6dd839952c4a03b39528ed39edd I think this PR can be closed (as that commit has all fixes).
agree, tested and works!
Should fix #3
During initialisation the received "activity" corresponds with actual status of the valve, the "activity" is now properly mapped to the HASS entity state (this is fixed now). When an updated message of type "VALVE" is received the value of the activity isn't properly "inserted" into the "valve object". No updated object means no updated state.
Could be due to an issues in the python lib.
Received message:
{"id":"93870374-2d16-4909-ba4a-b86067770a70:4","type":"VALVE","attributes":{"name":{"value":"Druppel midden"},"activity":{"value":"MANUAL_WATERING","timestamp":"2020-05-25T20:48:01.316+0000"},"state":{"value":"OK","timestamp":"2020-05-25T19:28:00.100+0000"},"lastErrorCode":{"value":"NO_MESSAGE","timestamp":"2020-05-25T19:28:00.100+0000"},"duration":{"value":777,"timestamp":"2020-05-25T20:48:01.316+0000"}}}
Full log: https://gist.github.com/wijnandtop/d3c39b8e118ce6548f8f2ac5b49b0c5b