Andre0512 / hon

Home Assistant integration for Haier hOn: support for Haier/Candy/Hoover home appliances like washing machines and air conditioners in 28 languages.
MIT License
1.23k stars 2.49k forks source link

Refrigerator HFW7819EWMP compatibility #93

Closed gabrielgo-ctf closed 10 months ago

gabrielgo-ctf commented 10 months ago

Hello, I have a Haier refrigerator (model HFW7819EWMP) and I have connected it to my Home assistant with your component. I have found some problems during the procces but I have fixed it modifying your code (but not maintaining the compatibility with old models). I write you to help to add compatibility with this kind of refrigerators, for sure it will be usefull to more people, and being selfish, for me is great if you add compatibility and I can update without patching my changes every time :)

I have prepared an image to help to understand the changes: imagen

Now i will explain you all the changes that I had to do:

  1. This model doesn’t have quickModeZ1 so I had an error in the core “pyhon”. I fixed it commenting in ref.py the “elif” where it checks this property. This is the log of the error in HA: imagen It was needed to be able to show the device info and to create the data archive

  2. In files binary_sensor.py and switch.py quickModeZ1 is “Super Freeze” mode and “quickModeZ2” is “Super Cool” Mode. For sure it is an error and they are swaped in these files (in ref.py they are correct). So I have fixed it in both files:

    HonBinarySensorEntityDescription(
     key="quickModeZ1",
     name="Super Cool",
     icon="mdi:snowflake",
     device_class=BinarySensorDeviceClass.RUNNING,
     on_value=1,
     translation_key="super_cool",
    ),
    HonBinarySensorEntityDescription(
     key="quickModeZ2",
     name="Super Freeze",
     icon="mdi:snowflake-variant",
     device_class=BinarySensorDeviceClass.RUNNING,
     on_value=1,
     translation_key="super_freeze",
    )
    HonSwitchEntityDescription(
    key="quickModeZ2",
    name="Super Freeze",
    icon="mdi:snowflake-variant",
    translation_key="super_freeze",
    ),
    HonSwitchEntityDescription(
    key="**quickModeZ1**",
    name="Super Cool",
    icon="mdi:snowflake",
    translation_key="super_cool",
    ),
  3. This model has more doors and with diferent meaning that you had in the component. In your code you had this imagen In this model it is: imagen So I adapted the binary_sensor.py file:

    HonBinarySensorEntityDescription(
    key="doorStatusZ1",
    name="Door1 Status Fridge",
    device_class=BinarySensorDeviceClass.DOOR,
    icon="mdi:fridge-top",
    on_value=1,
    translation_key="fridge_door",
    ),
    HonBinarySensorEntityDescription(
    key="door2StatusZ1",
    name="Door2 Status Fridge",
    icon="mdi:fridge-top",
    device_class=BinarySensorDeviceClass.DOOR,
    on_value=1,
    translation_key="fridge_door",
    ),
    HonBinarySensorEntityDescription(
    key="doorStatusZ2",
    name="Door1 Status Freezer",
    icon="mdi:fridge-bottom",
    device_class=BinarySensorDeviceClass.DOOR,
    on_value=1,
    translation_key="freezer_door",
    ),
    HonBinarySensorEntityDescription(
    key="door2StatusZ2",
    name="Door2 Status Freezer",
    icon="mdi:fridge-bottom",
    device_class=BinarySensorDeviceClass.DOOR,
    on_value=1,
    translation_key="freezer_door",
    ),
  4. This model has a new sensor with the Humidity of one box of the fridge. I added it… sensor.py

    HonSensorEntityDescription(
    key="humidityLevel",
    name="Humidity Level",
    icon="mdi:water-outline",
    device_class=SensorDeviceClass.ENUM,
    translation_key="humidity_level",
    option_list=const.REF_HUMIDITY_LEVELS,
    ),

    const.py

    REF_HUMIDITY_LEVELS = {
    1: "Low",
    2: "Mid",
    3: "High"
    }

    en.json

    "humidity_level": {
       "name": "Humidity Level"
    },

    es.json

    “humidity_level": {
       "name": "Nivel de Humedad"
    },

I attach the files modified by my (only the "hon" component files, not the ref.py of pyhon) and the ref_581.zip with the data extracted by the plugin. files_patched.zip ref_571.zip

Andre0512 commented 10 months ago

Hi, thanks for your work and your good descriptions! I have added it now :slightly_smiling_face: