Closed SylvainPer closed 5 years ago
Very nice, I will checkout the branch, try it out and merge it if it all works:)
By thinking about it, the thermostat adapter must be reworked on the pushstate but I don't know how yet, I don't have one and don't know what the json from domoticz look like.
You mean the TemperatureAdapter right? I have one and I will do the rework somewhere this weekend.
Exactly. You can look at temperature_sensor_adapter.py but I don't update mode & setpoint. I don't know if a conversion is needed for the mode state names.
Merged and I made the following changes, which are pushed to develop as well:
Fix publishing the state in the temperature adapter and on/off switch adapter Revert logic of determining domoticz_mqtt_used so its also usable when hosting gbridge locally using multiple machines Use the domoticz id instead of the name when determining the adapter when handling domoticz/out messages so it also works for devices which have a different friendlyName (in description) Use adapter.publishState instead of calling self.mqttClient.Publish directly when not using§ domoticz/out topic Only subscribe to domoticz/out when hosting gBridge locally Fix dimmableAdapter publishState not always having an svalue1 inside message
If you're using idx, the problem is that scenes/groups could share the same. I don't know if it's a bug on domoticz side but it could be a problem here.
For the other points, I'm pleased to see your updates. I'll update to test it.
I checked and all my groups and scenes have different id's, are you on the latest domoticz?
Latest beta. I've created a scene for test:
domoticz/out { "LastUpdate" : "2019-04-06 16:03:24", "Name" : "TEst", "Status" : "On", "Timers" : "false", "Type" : "Scene", "idx" : 4 }
and this idx already exist through another hardware (zigate).
I was sawing outside and thought about it, it's a major issue as the plugin use the idx to identify the device with gbridge...
So when you go to devices and sort the devices by index, the same index appears twice?
Edit, I googled and indeed it might be a problem for groups and scenes. Maybe we should prefix the id for groups and scenes?
My device list:
A prefix is a good idea. To get the scenes/groups, we can use json.htm?type=scenes to get them and change the parameters on json.htm?type=devices. It implies to update the way the plugin parse the devices.
I have pushed a (possible) fix to Develop
I'll have a look tonight. Maybe we should open an Issue to follow it, the problem is not linked to this PR.
Tested at home, it works. Thanks for the correction !
I hope this could help, I enjoy this bevahior as I have some scripts that update my devices and Home didn't see those updates.