Skip to content
This repository has been archived by the owner on Oct 11, 2022. It is now read-only.

On/Off switch not in sync #68

Open
Krocko opened this issue Apr 7, 2020 · 21 comments
Open

On/Off switch not in sync #68

Krocko opened this issue Apr 7, 2020 · 21 comments

Comments

@Krocko
Copy link
Contributor

Krocko commented Apr 7, 2020

I have a Siemens coffee maker.
The attributes are right, but the on/off switch not.

A56EAB67-A696-4F4D-8CF2-F0003993E67D

@DavidMStraub
Copy link
Owner

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?

@Krocko
Copy link
Contributor Author

Krocko commented Apr 10, 2020

The power state is wrong.
Yes, I will do.

@Krocko
Copy link
Contributor Author

Krocko commented Apr 12, 2020

@DavidMStraub how can I give you the log file?

@DavidMStraub
Copy link
Owner

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.

@Krocko
Copy link
Contributor Author

Krocko commented Apr 12, 2020

Can I send it to the @tum address?

@Krocko
Copy link
Contributor Author

Krocko commented Apr 20, 2020

@DavidMStraub are there any news?

@DavidMStraub
Copy link
Owner

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"?

@Krocko
Copy link
Contributor Author

Krocko commented May 2, 2020

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.

@DavidMStraub
Copy link
Owner

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.

@Krocko
Copy link
Contributor Author

Krocko commented May 2, 2020

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

@Krocko
Copy link
Contributor Author

Krocko commented May 3, 2020

It was not working.

@Krocko
Copy link
Contributor Author

Krocko commented May 8, 2020

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.

@Krocko
Copy link
Contributor Author

Krocko commented May 12, 2020

Hi @DavidMStraub.
I tested the last day and the problem is definitely only if use the button on the maschine.
Have you any ideas?

@zufivan
Copy link
Contributor

zufivan commented Oct 13, 2020

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

@DavidMStraub
Copy link
Owner

In the button.txt, the API reports PowerState.Standby the whole time!

@zufivan
Copy link
Contributor

zufivan commented Oct 13, 2020

In the button.txt, the API reports PowerState.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

@DavidMStraub
Copy link
Owner

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.

@zufivan
Copy link
Contributor

zufivan commented Oct 14, 2020

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:
image
debug_log.txt

@Krocko
Copy link
Contributor Author

Krocko commented Feb 4, 2021

Hi. Are there any news on this?
@DavidMStraub, @badguy99, @Sjack-Sch, @SantaFox can anyone please look into this again?

@badguy99
Copy link
Contributor

badguy99 commented Feb 4, 2021

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.

@Krocko
Copy link
Contributor Author

Krocko commented Feb 5, 2021

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants