disforw / goveelife

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

Add Support H7106 Fan #14

Open KyleStilkey opened 4 months ago

KyleStilkey commented 4 months ago
{
        "sku": "H7106",
        "device": "xxxx",
        "deviceName": "Office Fan",
        "type": "devices.types.fan",
        "capabilities": [{
            "type": "devices.capabilities.on_off",
            "instance": "powerSwitch",
            "parameters": {
                "dataType": "ENUM",
                "options": [{
                    "name": "on",
                    "value": 1
                }, {
                    "name": "off",
                    "value": 0
                }]
            }
        }, {
            "type": "devices.capabilities.toggle",
            "instance": "oscillationToggle",
            "parameters": {
                "dataType": "ENUM",
                "options": [{
                    "name": "on",
                    "value": 1
                }, {
                    "name": "off",
                    "value": 0
                }]
            }
        }, {
            "type": "devices.capabilities.work_mode",
            "instance": "workMode",
            "parameters": {
                "dataType": "STRUCT",
                "fields": [{
                    "fieldName": "workMode",
                    "dataType": "ENUM",
                    "options": [{
                        "name": "FanSpeed",
                        "value": 1
                    }, {
                        "name": "Auto",
                        "value": 2
                    }, {
                        "name": "Sleep",
                        "value": 3
                    }, {
                        "name": "Nature",
                        "value": 4
                    }, {
                        "name": "Custom",
                        "value": 5
                    }],
                    "required": true
                }, {
                    "fieldName": "modeValue",
                    "dataType": "ENUM",
                    "options": [{
                        "name": "FanSpeed",
                        "options": [{
                            "value": 1
                        }, {
                            "value": 2
                        }, {
                            "value": 3
                        }, {
                            "value": 4
                        }, {
                            "value": 5
                        }, {
                            "value": 6
                        }, {
                            "value": 7
                        }, {
                            "value": 8
                        }]
                    }, {
                        "defaultValue": 0,
                        "name": "Auto"
                    }, {
                        "name": "Sleep",
                        "options": [{
                            "value": 1
                        }, {
                            "value": 2
                        }, {
                            "value": 3
                        }, {
                            "value": 4
                        }, {
                            "value": 5
                        }, {
                            "value": 6
                        }, {
                            "value": 7
                        }, {
                            "value": 8
                        }]
                    }, {
                        "name": "Nature",
                        "options": [{
                            "value": 1
                        }, {
                            "value": 2
                        }, {
                            "value": 3
                        }, {
                            "value": 4
                        }, {
                            "value": 5
                        }, {
                            "value": 6
                        }, {
                            "value": 7
                        }, {
                            "value": 8
                        }]
                    }, {
                        "defaultValue": 0,
                        "name": "Custom"
                    }],
                    "required": true
                }]
            }
        }]
    },
KyleStilkey commented 4 months ago

Nevermind looks like it's supported, just pulled. Closing.

Booza1981 commented 3 months ago

Is it fully supported? I only get power and oscillation controls.

disforw commented 3 months ago

No. There seems to be something wrong here. You should be seeing a FAN entity, then I would turn off the power switch entity. Everything looks correct based on your API response, but it is difficult​ for me to figure out this problem as I do not have a fan. I do, however, have an air filter, which gives me a fan entity, so I know the code works. It must be something really simple.

KyleStilkey commented 3 months ago

This does work, it's added as a fan entity and clicking on the devices fan (power) shows the modes, besides the duplicated mode bug, it does work. They are not like what you may have seen on others where they create a separate modes list entity but maybe that is something that could be added to this.

Also this doesn't seem to support any speeds for any devices, a lot of Govee Air Purifiers and Fans have speed controls but this is not implemented.

image image image

Booza1981 commented 3 months ago

Thanks for the responses.

I can see preset button in the fan controls pop-up but it only contains "Fan Speed" and when I select that I get "Failed to call service fan_set_preset mode. 'fan speed'".

Kinda weird as I've checked my API response and it's the same as @KyleStilkey

I've a few errors and warnings in my log (below) which are likely culpable but I can't get anything meaningful out of it.

Not a huge issue for me as I've managed to get it integrated using the govee2mtqq.

024-08-07 22:24:33.687 INFO (MainThread) [custom_components.goveelife.light] 01J4Q8DZWVSFC4K74G3DGEJDCS - async_setup_entry: setup 0 light entities
2024-08-07 22:24:33.687 INFO (MainThread) [homeassistant.components.fan] Setting up goveelife.fan
2024-08-07 22:24:33.688 ERROR (MainThread) [custom_components.goveelife.entities] GoveeLife - 1ca7d0c90700713e_fan: __init__ failed: 'value' (builtins.KeyError)
2024-08-07 22:24:33.688 INFO (MainThread) [homeassistant.components.sensor] Setting up goveelife.sensor
2024-08-07 22:24:33.695 INFO (MainThread) [homeassistant.components.humidifier] Setting up goveelife.humidifier
2024-08-07 22:24:33.695 INFO (MainThread) [custom_components.goveelife.humidifier] 01J4Q8DZWVSFC4K74G3DGEJDCS - async_setup_entry: setup 0 humidifier entities
2024-08-07 22:24:33.696 INFO (MainThread) [custom_components.goveelife.switch] 01J4Q8DZWVSFC4K74G3DGEJDCS - async_setup_entry: setup 1 switch entities
2024-08-07 22:24:33.697 INFO (MainThread) [custom_components.goveelife.fan] 01J4Q8DZWVSFC4K74G3DGEJDCS - async_setup_entry: setup 1 fan entities
2024-08-07 22:24:33.698 WARNING (MainThread) [homeassistant.components.fan] Entity None (<class 'custom_components.goveelife.fan.GoveeLifeFan'>) does not set FanEntityFeature.TURN_OFF but implements the turn_off method. Please report it to the author of the 'goveelife' custom integration
2024-08-07 22:24:33.698 WARNING (MainThread) [homeassistant.components.fan] Entity None (<class 'custom_components.goveelife.fan.GoveeLifeFan'>) does not set FanEntityFeature.TURN_ON but implements the turn_on method. Please report it to the author of the 'goveelife' custom integration
2024-08-07 22:24:33.700 WARNING (MainThread) [custom_components.goveelife.fan] GoveeLife - 1ca7d0c90700713e_fan: preset_mode: invalid value: {'workMode': 4, 'modeValue': 1}
2024-08-07 22:24:33.702 INFO (MainThread) [custom_components.goveelife.sensor] 01J4Q8DZWVSFC4K74G3DGEJDCS - async_setup_entry: setup 0 sensor entities
2024-08-07 22:24:46.568 WARNING (MainThread) [custom_components.goveelife.fan] GoveeLife - 1ca7d0c90700713e_fan: preset_mode: invalid value: {'workMode': 4, 'modeValue': 1}
File "/config/custom_components/goveelife/fan.py", line 166, in async_set_preset_mode
File "/config/custom_components/goveelife/fan.py", line 166, in async_set_preset_mode
2024-08-07 22:25:33.972 WARNING (MainThread) [custom_components.goveelife.fan] GoveeLife - 1ca7d0c90700713e_fan: preset_mode: invalid value: {'workMode': 4, 'modeValue': 1}
File "/config/custom_components/goveelife/fan.py", line 166, in async_set_preset_mode