Ekman / home-assistant-pure-i9

Electrolux Pure i9 robot vacuum integration for Home Assistant.
MIT License
25 stars 5 forks source link

Discussion: `DustbinStates.full` is translated to state `ERROR` which might be misleading #58

Open Phype opened 7 months ago

Phype commented 7 months ago

This is more a discussion piece than an actual issue.

For me as a user - which might possibly ignore the robots request to empty the dustbin from time to time (🙈) - it is kind of misleading that homeassistant will report a full dustbin as state ERROR, as the robot is technically still operational - albeit with obviously reduced cleaning performance.

I'm bringing this up mainly because it makes it hard to distinguish between states which need immidiate action - ie. the robot getting stuck somewhere - and states which are less problematic - such as a full dustbin.

What do you think? I guess it would be best to have a seperate state, but HA does not support this. Maybe i just have to create a custom UI which differentiates based on the attribute.

Phype commented 7 months ago

For reference: This is the current implementation:

https://github.com/Ekman/home-assistant-pure-i9/blob/master/custom_components/purei9/purei9.py#L48

def state_to_hass(
    pure_i9_state: str,
    pure_i9_battery: str,
    purei9_dustbin: DustbinStates=DustbinStates.connected
    ) -> str:
    """Translate Pure i9 data into a Home Assistant state constant"""
    # The Pure i9 will become "Sleeping" when docked and charged 100% OR when stopped.
    # In order to detect if it's docket or if it's just idling in the middle of a room
    # check the battery level. If it's full then we're docked.
    if purei9_dustbin in (DustbinStates.empty, DustbinStates.full):
        return STATE_ERROR

    if pure_i9_state == RobotStates.Sleeping:
        return STATE_DOCKED if pure_i9_battery == BatteryStatus.High else STATE_IDLE

    return PURE_I9_STATE_MAP.get(pure_i9_state, STATE_IDLE)
Ekman commented 4 months ago

Thanks for the request! I get your point and maybe I was a bit quick when I implemented a full dustbin as an error. I'm a bit reluctant to change it though since I'm a strong believer in semantic versioning and, technically, this would be a breaking change.

I'm going to leave this open and I want people that agree to vote with a thumbs up on the original post. If more people feel the same way I'll look into changing it.

How does that sound?