ofalvai / home-assistant-candy

Unofficial Candy/Haier appliance integration for Home Assistant
119 stars 27 forks source link

Washing machine state isn't universal #33

Open terminet85 opened 2 years ago

terminet85 commented 2 years ago

I noticed that MachineState isn't applicable for each Machine. I got an state 6 that is a self-test in Tumble Dryer. Will be better create a class and extend it for each machine I guess.

{
        "statusTD":
{"StatoWiFi":"1",
                "StatoTD":"6",
                "CodiceErrore":"0",
                "Pr":"1",
                "PrPh":"2",
                "RemTime":"150",
                "DryLev":"2",
                "Time":"0",
                "Rapido":"0",
                "Opt1":"1",
                "Opt2":"1",
                "Opt3":"0",
                "Opt4":"0",
                "Opt5":"0",
                "Opt6":"0",
                "Opt7":"0",
                "Opt8":"0",
                "Refresh":"0",
                "CleanFilter":"0",
                "WaterTankFull":"0",
                "DryingManagerLevel":"2",
                "DelVal":"0",
                "DoorState":"1",
                "RecipeId":"NULL",
                "CheckUpState":"1"
        }
}
class MachineState(Enum):
    IDLE = 1
    RUNNING = 2
    PAUSED = 3
    DELAYED_START_SELECTION = 4
    DELAYED_START_PROGRAMMED = 5
    ERROR = 6
    FINISHED1 = 7
    FINISHED2 = 8
ofalvai commented 2 years ago

Yes, MachineState was initially the washing machine state only, but as we added more appliance types some of them reused MachineState. Some appliances have their own state enum in model.py (ovens for example), so if tumble dryers need their own state enum, I'm more than happy to fix this if you send me the list of values and their meaning.

TheBisk commented 2 years ago

hello, for the washing machine it would be useful to have a binary sensor that indicates the status of the door, open or closed. it's possible? Thank you.

ofalvai commented 2 years ago

@TheBisk does your washing machine expose this information in the API? My washing machine doesn't have this information in the response, but based on contributions from others, dishwashers and tumble dryers expose this.