homeassistant-homeconnect
homeassistant-homeconnect copied to clipboard
On/Off switch not in sync
I have a Siemens coffee maker. The attributes are right, but the on/off switch not.
Hmm, operation state is "ready" but power state is "off". I assume one of them is wrong. Can you monitor the event stream (e.g. by enabling debug logging) in which order and at what times which of those is reported?
The power state is wrong. Yes, I will do.
@DavidMStraub how can I give you the log file?
If you don't want to host it here because it contains sensitive information, you can send it to me via the e-mail address you can see in the git commits. Otherwise, just post it here or in a Gist.
Can I send it to the @tum address?
@DavidMStraub are there any news?
Hi, I finally had a look at the log file. The power state remains "Standby" all the time. I suspect that the event stream simply doesn't update this setting. Does the switch go to "on" state at all at any point? What happens when you manually switch it "on"?
If the coffemaker is on and the switch is off, the switch goes back to off, if I toggle it. If I restart ha then, the switch is on and is in sync for a certain time.
Curious. Right now, the pseudo code for determining the power state is as follows,
if PowerState == "on":
return "on"
if PowerState == "standby":
return "off"
if OperationState == "ready":
return "on"
Your problem could probably be fixed by changing the order of the 2nd and 3rd if statement, since your machine reports an updated operation state, but not power state. The problem is that I'm not sure whether this won't screw up any other devices, e.g. if the update their power state but not their operation state.
The best solution would be to check which value was changed most recently, but unfortunately this would require quite some refactoring of the underlying library.
I have changed the order in switch.py (from line 142) and will test.
def update(self):
"""Update the switch's status."""
if (
self.device.appliance.status.get("BSH.Common.Setting.PowerState", {}).get(
"value", None
)
== "BSH.Common.EnumType.PowerState.On"
):
self._state = True
elif self.device.appliance.status.get(
"BSH.Common.Status.OperationState", {}
).get("value", None) in [
"BSH.Common.EnumType.OperationState.Ready",
"BSH.Common.EnumType.OperationState.DelayedStart",
"BSH.Common.EnumType.OperationState.Run",
"BSH.Common.EnumType.OperationState.Pause",
"BSH.Common.EnumType.OperationState.ActionRequired",
"BSH.Common.EnumType.OperationState.Aborting",
"BSH.Common.EnumType.OperationState.Finished",
]:
self._state = True
elif (
self.device.appliance.status.get("BSH.Common.Setting.PowerState", {}).get(
"value", None
)
== self.device.power_off_state
):
self._state = False
It was not working.
I found out, it is only if I switch the maschine on directly on the maschine. If I switch it on with the home connect app or with ha, the switch state is right. So the problem occurs only if I switch it on with the button on the maschine.
Hi @DavidMStraub. I tested the last day and the problem is definitely only if use the button on the maschine. Have you any ideas?
Hi @DavidMStraub, I have more appliance connected to home assistant, the problme persist only for caffe maker, and only if I turn ON by the button on the machine like @Krocko reported. See in attached debug log file Button.txt: power on by button (directly from caffe machine) See in attached debug log file homeconnect_app.txt: power on by home connect app. The response by postman is always correct, see log: { "data": { "settings": [ { "key": "BSH.Common.Setting.PowerState", "value": "BSH.Common.EnumType.PowerState.On" } ] } }
Maibe this log can help you to find the problem.
homeconnect_app.txt button.txt
Many Thanks for your job, I'm avalible to made some trobleshotting test.
Reagards Ivan
In the button.txt
, the API reports PowerState.Standby
the whole time!
In the
button.txt
, the API reportsPowerState.Standby
the whole time!
Yes I see, I don't know where the integration take this value... the postam response always correct "PowerState.on", I don't know where cache it. Ïf I reboot HomeAssisatnt the intergration home_connect_beta work fine, see log in attacched. button.after_ha_restart.txt
Oh OK, perhaps the value is fetched initially by get_status
and then never updated by the API.
Can you post a log where the actual API response is shown, perhaps using Postman or the homeconnect
Python library? What is shown in the HA log is the appliance.status
dictionary which is always .update()
d by the API response but can also contain "old" values that never change.
Hi David in attacched debug log (homeassistant core and home_conect_beta) about the turn on caffe machine by button, following the output from postman, look like good:
debug_log.txt
Hi. Are there any news on this? @DavidMStraub, @badguy99, @Sjack-Sch, @SantaFox can anyone please look into this again?
To me, this looks like a bug in the firmware of your coffee machine. The messages show LocalControlActive going true, and then back to false. The docs say this will go back to false after a period of time, rather than after an action completing. However OperationState and PowerState never change, even though ProgramProgress is increasing. It may be worth contacting Siemens to see if there is an update that can be applied.
I don't think it is a bug in the coffee maker firmware. It is only if i turn on the device directly with the button on the device. If i turn on the device with home assistant or the home connect app it is working. Also if i turn on the device directly with the button on the device, the state in the home connect app is right but not in home assistant. If i restart home assistant after this, the state is also right in home assistant.