DavidMStraub / homeassistant-homeconnect

Custom component for Home Assistant to connect appliances supporting the Home Connect standard
MIT License
117 stars 29 forks source link

On/off status not available #41

Closed immert20 closed 4 years ago

immert20 commented 4 years ago

Error while trying to turn on device: {'key': 'SDK.Error.InvalidSettingState', 'description': 'BSH.Common.Setting.PowerState currently not available or writable'}

DavidMStraub commented 4 years ago

Details please. Which device? This is expected e.g. for hobs since the API doesn't support it.

immert20 commented 4 years ago

How do you mean? It's an Bosch Coffee machine. So On switching works fine and off works also but will niet display in the switch in HASS.

DavidMStraub commented 4 years ago

It depends on the type of machine whether switching on or off via the API is supported. I don't have a HC coffee machine, so I cannot test it, but "not writeable" usually means that it is not supported. Are you sure that remote start is enabled?

immert20 commented 4 years ago

Remote start is enabled. I can switch the coffee machine on and off but the switch will not retain the status.

DavidMStraub commented 4 years ago

You mean switching on and off works in Home Assistant but the switch goes back immediately?

Can you please enable debug logging and check what values of PowerState and OperationState are reported before and after switching, respectively?

By the way: that HA might not pick up a change in power state that is effected directly on the machine is a separate issue.

MarcusKapun commented 4 years ago

David,

I had somehow the same problem (appliance was starting, but switch was switching back to "off" immediately) and not updating automatically ("listening" to API) if something changed directly on the device. I've tried (&error) some things and changed the switch.py as following - both working now with my appliances (coffee machine, oven, dishwasher) w/o any issues.

`async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the Home Connect switch."""

def get_entities():
    """Get a list of entities."""
    entities = []
    data = hass.data[DOMAIN]
    for device_dict in data.get(DEVICES, []):
        entity_dicts = device_dict.get("entities", {}).get("switch", [])
        entity_list = [HomeConnectProgramSwitch(**d) for d in entity_dicts] + [HomeConnectPowerSwitch(device_dict["device"])]
        device = device_dict["device"]
        device.entities += entity_list
        entities += entity_list
    return entities

async_add_entities(await hass.async_add_executor_job(get_entities), True)

` Please let me know if helpful for the project, thanks.

immert20 commented 4 years ago

Maybe you can make an pull request for the new code?

DavidMStraub commented 4 years ago

Yes, that would be useful, also to see more easily what has changed. Thanks

Krocko commented 4 years ago

I have the same problem with a coffee maschine. But if I turn the coffee maschine on with the developer tools it stays on.

duftstenen commented 4 years ago

I had similar issues, then updated to version 2.0.4, and everything seems to work with no problems. I was happy. After about two days, it stopped working again. Neither did a reboot of HA work. What changes do a version update do, to make it work a couple of days, and then stop working again?

Krocko commented 4 years ago

Hello. Are there any news for this? @DavidMStraub is there any useful for us in this plugin code? https://github.com/thoukydides/homebridge-homeconnect

DavidMStraub commented 4 years ago

Actually I think this issue is fixed by @MarcusKapun's pull request #45, we just forgot to close it.

The problems mentioned in the recent comments are probably related to https://github.com/DavidMStraub/homeconnect/issues/3, which is still not fixed.

Thanks for the link @Krocko, but I looked into it some time ago and don't think I found anything to reuse (but let me know in case you did).

Krocko commented 4 years ago

But the problem still persist. The states don‘t update after some time.

Edit: You are right. This problem belong to https://github.com/DavidMStraub/homeconnect/issues/3