disforw / goveelife

Home Assistant Govee integration using the newest API for ALL Govee WiFi devices
32 stars 3 forks source link

Add Support for Dehumidifier H7151 #8

Open Mdleal opened 6 months ago

disforw commented 6 months ago

Sweet, can you post an API response? We can put this in humidifier.py only change the attr_device_class = HumidifierDeviceClass.HUMIDIFIER if it shows it as different in your response.

Mdleal commented 6 months ago

{ "code": 200, "message": "success", "data": [{ "sku": "H7151", "device": "1C:23:D4:AD:FC:F2:F8:40", "deviceName": "Smart Dehumidifier Max", "type": "devices.types.dehumidifier", "capabilities": [{ "type": "devices.capabilities.on_off", "instance": "powerSwitch", "parameters": { "dataType": "ENUM", "options": [{ "name": "on", "value": 1 }, { "name": "off", "value": 0 }] } }, { "type": "devices.capabilities.range", "instance": "humidity", "parameters": { "unit": "unit.percent", "dataType": "INTEGER", "range": { "min": 30, "max": 80, "precision": 1 } } }, { "type": "devices.capabilities.work_mode", "instance": "workMode", "parameters": { "dataType": "STRUCT", "fields": [{ "fieldName": "workMode", "dataType": "ENUM", "options": [{ "name": "gearMode", "value": 1 }, { "name": "Auto", "value": 3 }, { "name": "Dryer", "value": 8 }], "required": true }, { "fieldName": "modeValue", "dataType": "ENUM", "options": [{ "name": "gearMode", "options": [{ "name": "Low", "value": 1 }, { "name": "Medium", "value": 2 }, { "name": "High", "value": 3 }] }, { "name": "Auto", "range": { "min": 80, "max": 80 } }, { "defaultValue": 0, "name": "Dryer" }], "required": true }] } }, { "type": "devices.capabilities.event", "instance": "waterFullEvent", "alarmType": 58, "eventState": { "options": [{ "name": "waterFull", "value": 1, "message": "Water bucket is full or has been pulled out" }] } }] }] }

disforw commented 6 months ago

Adding new beta 2.9.3 that will add dehumidifier to device class

Mdleal commented 6 months ago

dehumidifier added as unavoidable.

ERROR (MainThread) [custom_components.goveelife.entities] GoveeLife - 1c23d4adfcf2f840_humidifier: init failed: 'value' (builtins.KeyError)

[homeassistant.helpers.entity_registry] Registered new humidifier.goveelife entity: humidifier.smart_dehumidifier_max_2 2024-05-23 22:36:56.454 ERROR (MainThread) [homeassistant.components.humidifier] Error adding entity humidifier.smart_dehumidifier_max_2 for domain humidifier with platform goveelife Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 580, in _async_add_entities await coro File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 892, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1359, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1009, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1015, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1665, in state if (is_on := self.is_on) is None: ^^^^^^^^^^ File "/config/custom_components/goveelife/humidifier.py", line 149, in is_on if self.state == STATE_ON: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1665, in state if (is_on := self.is_on) is None: ^^^^^^^^^^ File "/config/custom_components/goveelife/humidifier.py", line 149, in is_on if self.state == STATE_ON: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1665, in state if (is_on := self.is_on) is None: ^^^^^^^^^^ File "/config/custom_components/goveelife/humidifier.py", line 149, in is_on if self.state == STATE_ON: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1665, in state if (is_on := self.is_on) is None: ^^^^^^^^^^ File "/config/custom_components/goveelife/humidifier.py", line 149, in is_on if self.state == STATE_ON: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1665, in state if (is_on := self.is_on) is None: ^^^^^^^^^^ File "/config/custom_components/goveelife/humidifier.py", line 149, in is_on if self.state == STATE_ON: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1665, in state if (is_on := self.is_on) is None: ^^^^^^^^^^ .......