Govee Appliances (Heaters, Fans, Purifiers)

I am starting a new Govee thread to address appliances which is not currently included in the Govee lights integration available on HACS. The appliances are available in the API, but using a slightly different URI. I have found a way to CONTROL the devices using the Rest integration, but not get STATUS back from them.
The appliance URIs are as follows:
List Govee appliances: GET https://developer-api.govee.com/v1/appliance/devices/
Control applicance: PUT https://developer-api.govee.com/v1/appliance/devices/control

6 Likes

Here is the Rest service I setup that is able to control my H7130 heater. Add this to your configuration.yaml file and your API key to the secrets file. Please let me know below if this works for you and what the model number of your device is so we can start a list of working devices.

rest_command: 
  rest_govee_appliance:
    url: https://developer-api.govee.com/v1/appliance/devices/control
    method: PUT
    headers:
        Content-Type: application/json
        Govee-API-Key: !secret govee_api_key
    content_type:  'application/json; charset=utf-8'
    payload: '{"device": "{{ device }}","model": "{{ model }}","cmd": {"name": "{{ cmd_name }}","value": "{{ cmd_value }}"}}'
    verify_ssl: true

Call this service as follows

  - service: rest_command.rest_govee_appliance
    data:
      device: 14:F7:D4:AD:AA:CC:00:00
      model: H7130
      cmd_name: turn
      cmd_value: on
1 Like

Awesome, good share

Iā€™m getting a H7120 tomorrow, will give a whirl and report what I find

Got this working to my liking, although it has a few helper entities as dependencies

Unfortunately getState is limited to lights, so we have to work with assumed state which seems to be fine.

I setup the rest command the same as you, then did the below

Required Helpers:

  • Input Boolean - To Track On/Off State
  • Input Select - To Track Current Mode

Script

office_air_purifier_mode:
  alias: 'Office Air Purifier: Mode'
  sequence:
  - service: input_select.select_option
    entity_id: input_select.office_air_purifier_mode
    data:
      option: >
        {% set mapper = {5 : ''Sleep'', 1: ''Low'', 2: ''Medium'', 3: ''High''} %}
        {{ mapper[office_purifier_mode] }}
    enabled: true
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - service: rest_command.office_air_purifier
    data:
      device: AA:BB:CC:DD:11:22:33:44
      model: H7120
      cmd_name: mode
      cmd_value: '{{ office_purifier_mode }}'
  mode: single
  icon: mdi:air-purifier

Template Fan

fan:
  platform: template
  fans:
    office_air_purifier:
      friendly_name: "Office Air Purifier"
      value_template: "{{ states('input_boolean.office_purifier_state') }}"
      preset_mode_template: "{{ states('input_select.office_air_purifier_mode') }}"
      turn_on:
        service: script.office_air_purifier_on
      turn_off:
        service: script.office_air_purifier_off
      set_preset_mode:
        service: script.office_air_purifier_mode
        data:
          office_purifier_mode: >
            {% set mapper = {'Sleep' : 5, 'Low': 1, 'Medium': 2, 'High': 3} %}
            {{ mapper[preset_mode] }}
      speed_count: 4
      preset_modes:
        - 'Low'
        - 'Medium'
        - 'High'
        - 'Sleep'
2 Likes

I was able to get the heater and a humidifier in HA using Homebridge and the homebridge-govee plugin.

Itā€™s not perfect, but a lot less work needed to make this work, and you do get the device state. For the heater, you can control the device, see the state, but thereā€™s no option to set the mode to low/medium/high, which I didnā€™t touch much anyway after setting it once.

2 Likes

I tried copying your script and no luck I get a error.

Message malformed: extra keys not allowed @ data[ā€˜office_air_purifier_modeā€™]

Am I missing something here? I do know I have to change some of the data fields to my device info but I was hoping to at least save this script as a starting point then start making changes based on my device but no luck.

I have many different Govee devices and Iā€™d love to get this working and see what more we can provide and get functioning. Any help would be amazing!

List of my current devices I have Iā€™d love to test are
H7121 (Air Purifier)
H7141 (Humidifier)
H7123 (Pet Air Purifier)
H7101 (Tower Fan)
H5040 (Gateway) + H5054 (Sensors)
H5082 - (Dual Smart Plug)

I hope to see what we can get working and or added this way. Appreciate any help at all!

Also where do you find the Device ID?

Update

Same issue when trying to copy your template you made.

You can try entering it like this, I think itā€™ll still work, but it may not work/pass at all until you have the template fan entity and input_select helper defined in your config

data:
      option: '{% set mapper = {5 : ''Sleep'', 1: ''Low'', 2: ''Medium'', 3: ''High''} %} {{ mapper[office_purifier_mode] }}'

I have many different Govee devices and Iā€™d love to get this working and see what more we can provide and get functioning. Any help would be amazing!
List of my current devices I have Iā€™d love to test are
H7121 (Air Purifier)
H7141 (Humidifier)
H7123 (Pet Air Purifier)
H7101 (Tower Fan)
H5040 (Gateway) + H5054 (Sensors)
H5082 - (Dual Smart Plug)

Check out the API which will detail some more per device specifics https://govee-public.s3.amazonaws.com/developer-docs/GoveeDeveloperAPIReference.pdf

Also where do you find the Device ID?

You have to call the API with your api key, the example below uses a fake API key

curl --request GET \
  --url https://developer-api.govee.com/v1/appliance/devices/ \
  --header 'Content-Type: application/json' \
  --header 'Govee-API-Key: 00000000-729c-4b82-b536-000000000'

Which would return a response of something like:

{
 "data": {
  "devices": [
   {
     "device": "99:E5:A4:C1:38:29:DA:7B",
     "model": "H6159",
     "deviceName": "test light",
     "controllable": true,
     "retrievable": true,
     "supportCmds": [
      "turn",
      "brightness",
      "color",
      "colorTem"
     ],
      "properties": {
       "colorTem": {
        "range": {
         "min": 2000,
         "max": 9000
        }
       }
     }
   },
   {
    "device": "34:20:03:2e:30:2b",
    "model": "H5081",
    "deviceName": "Smart Plug",
    "controllable": true,
    "retrievable": true,
    "supportCmds": [
     "turn"
    ]
   }
   ]
  },
 "message": "Success",
 "code": 200
}

Same issue when trying to copy your template you made.

Youā€™re looking at the ā€˜template formula testerā€™ - that is only used for verifying the output of template functions. It doesnā€™t really have any relation to the ā€˜Template Integrationā€™ which is the creation of a new entity (in this case a fan) through the aggregation of many different sensors/switches/scripts. This is setup in your configuration yaml, not through the GUI

Ah ok I go it, Iā€™ve just never worked with making templates or anything so I got it, I will take a look at what you have provided any questions or issues I will respond back. Appreciate it!

Any half decent network router will give you the Mac address of a device. You can also run a network scanning tool from your computer to try and find them.

Yes!!! Iā€™d LOVE to know the outcome for each of these please.

Iā€™ve checked this out, canā€™t seem to understand why there is no getState for appliances??

Ok so I have a call back with many devices but the issue I am having is my callback with the code doesnā€™t format at all in terminal like this and is just one long string. My devices have many options not even listed in your example so manually formatting the code so I can read it is a nightmare.[/u]

Is there a way to make terminal format it correctly or somewhere else I should be making this call to see this in a much better way of reading?

I donā€™t know why I didnā€™t think of it, Visual Studio can do this with the format document settings. Just leaving this for anyone in the future as good information.

Ok so lets take my Office Fan as an example and if you could help me set this up I think I can get the others going and post my results and functions.

        "device": "1C:25:D4:AD:FC:44:80:1A",
        "model": "H7101",
        "deviceName": "Office Fan",
        "controllable": true,
        "retrievable": false,
        "properties":
          {
            "mode":
              {
                "options":
                  [
                    { "name": "Custom", "value": 2 },
                    { "name": "Auto", "value": 3 },
                    { "name": "Sleep", "value": 5 },
                    { "name": "Nature", "value": 6 },
                  ],
              },
            "gear":
              {
                "options":
                  [{ "name": "gear", "value": [1, 2, 3, 4, 5, 6, 7, 8] }],
              },
          },
        "supportCmds": ["turn", "mode", "gear"],
      },
    ],
},

This was my response for one of my fans, I have taken your template and put it in my config and now I am a little lost on where I would put options.

fan:
  - platform: template
    fans:
      office_fan:
        friendly_name: "Office Fan"
        value_template: "{{ states('input_boolean.office_fan_state') }}"
        preset_mode_template: "{{ states('input_select.office_fan_mode') }}"
        turn_on:
          service: script.office_fan_on
        turn_off:
          service: script.office_fan_off
        set_preset_mode:
          service: script.office_fan_mode
          data:
            office_fan_mode: >
              {% set mapper = {'Sleep' : 5, 'Low': 1, 'Medium': 2, 'High': 3} %}
              {{ mapper[preset_mode] }}
        speed_count: 8
        preset_modes:
          - 'auto'
          - 'smart'
          - 'whoosh'

I am a little lost once I hit the data and preset modes option.

Also once I have the template created what would be the next step to start making these calls I saw you mentioned helpers and I know you have a script but I guess a step by step would be amazing if you could provide them. If I get my devices working, I will report and share my set up for others to use as well to get started. :slight_smile:

Thanks again so far youā€™ve been amazing help through this process!

Updating:
Iā€™m going to guess that preset_modes are the options in my response I got, so I would be custom, auto, sleep and nature. If thatā€™s the case, I got that fixed and change.

Now with the data section, that I have not got a clue.

I am completely lost, I canā€™t figure out how to script this but this is what I have so far.

This was my devices response.

          {
            "device": "1C:25:D4:AD:FC:44:80:1A",
            "model": "H7101",
            "deviceName": "Office Fan",
            "controllable": true,
            "retrievable": false,
            "properties":
              {
                "mode":
                  {
                    "options":
                      [
                        { "name": "Custom", "value": 2 },
                        { "name": "Auto", "value": 3 },
                        { "name": "Sleep", "value": 5 },
                        { "name": "Nature", "value": 6 },
                      ],
                  },
                "gear":
                  {
                    "options":
                      [{ "name": "gear", "value": [1, 2, 3, 4, 5, 6, 7, 8] }],
                  },
              },
            "supportCmds": ["turn", "mode", "gear"],
          },
        ],
    },

This is what I put in my configuration.yaml

fan:
  - platform: template
    fans:
      office_fan:
        friendly_name: "Office Fan"
        value_template: "{{ states('input_boolean.office_fan_state') }}"
        preset_mode_template: "{{ states('input_select.office_fan_mode') }}"
        turn_on:
          service: script.office_fan_on
        turn_off:
          service: script.office_fan_off
        set_preset_mode:
          service: script.office_fan_mode
          data:
            office_fan_mode: >
              {% set mapper = {'Custom' : 2, 'Auto': 3, 'Sleep': 5, 'Nature': 6}
              {{ mapper[preset_mode] }}
        speed_count: 8
        preset_modes:
          - 'custom'
          - 'auto'
          - 'sleep'
          - 'nature'

This is what I have in my script.yaml

office_fan_mode:
  alias: 'Office Fan: Mode'
  sequence:
  - service: input_select.select_option
    entity_id: input_select.office_fan_mode
    data:
      option: >
        {% set mapper = {2 : ''Custom'', 3: ''Auto'', 5: ''Sleep'', 6: ''Nature''} %}
        {{ mapper[office_fan_mode] }}
    enabled: true
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - service: rest_command.office_fan
    data:
      device: 1C:25:D4:AD:FC:44:80:1A
      model: H7101
      cmd_name: mode
      cmd_value: '{{ office_fan_mode }}'
  mode: single
  icon: mdi:fan

This is my helper drop down set up.

Iā€™ve been trying to figure out where I am going wrong, probably missing something or messed something up I might not be seeing. Any suggestion or help would be fantastic.

UPDATE

I got the On and Off set up and working, I canā€™t get modes working. I canā€™t get my script to call one of the commands I tried using yours in the script editor but I keep getting errors and it can not save.

It looks like you are using a mapper to send the selected option as a command but when I go to put yours in as you have it, I canā€™t save the option and use it. I think this is where I am stuck.

alias: Office Fan Modes
sequence:
  - service: input_select.select_option
    data:
      option: Custom,Auto,Sleep,Nature '{{ mapper[offic_preset_mode] }}'
    target:
      entity_id: input_select.office_fan_modes
  - service: rest_command.rest_govee_appliance
    data:
      device: 1C:25:D4:AD:FC:44:80:1A
      model: H7101
      cmd_name: mode
      cmd_value: "{{ office_preset_mode }}"
mode: single

Where I put ā€œ{{ office_preset_mode }}ā€ is just to highlight the two spots I believe where I am having issues and setting it up wrong.

Thanks again!

For the H7130 heater, is it possible to set the thermostat mode temperature via either the REST API or via homebridge? Rather than just turning the heater on/off?

This is not currently available in the API, hopefully shortly.

fan:
  - platform: template
    fans:
      office_fan:
        friendly_name: "Office Fan"
        value_template: "{{ states('input_boolean.office_fan_on_off') }}"
        percentage_template: "{{ states('input_number.office_fan_speed') }}"
        preset_mode_template: "{{ states('input_select.office_fan_modes') }}"
        oscillating_template: "{{ states('input_select.osc') }}"
        turn_on:
          service: script.office_fan_on
        turn_off:
          service: script.office_fan_off
        set_percentage:
          service: script.office_fan_speeds
          data:
            percentage: "{{ percentage }}"
        set_preset_mode:
          service: script.office_fan_modes
          data:
            office_fan_modes: "{{ preset modes }}"
        set_oscillating:
          service: script.office_fan_oscillating
          data:
            oscillating: "{{ oscillating }}"
        speed_count: 8
        preset_modes:
          - 'Custom'
          - 'Auto'
          - 'Sleep'
          - 'Nature'

Ok so this is where I am lost but maybe someone can give me some pointers. I have on and off working, modes and speeds (percentage) I think is where I am getting stuck on what I would put here.

The fan I am working with had 4 modes, listed at the bottom and my script has them set up to call the commands and I believe I have the script set up for the speed commands, the fan I have has 8 speed options, but when I pull the template entity I only get a toggle which I believe is due to having no data set at these other points but I am unsure what I should put in.

Any help would be appreciated!

Will this be released as an integration in hacs or something like that?

Not unless someone has the knowledge to do so.

I created this with the creator of the Govee LAN integration due to the original one seeming to be dead at this point and he said he doesnā€™t own any appliances so I would need to add it but I do not have enough skills to do this myself. It looks like reading through the code the calls and pulls are very similar to their lights but the calls for appliances need to be added.

If anyone has some knowledge they are more than welcome to read through this and do what was asked and we could probably have proper support vs this hacked in way.

I wish I was good enough, I can read and kind of understand whatā€™s happening but I just have no idea how to add a new function to his code without breaking it but I do hope someone can step in and help.

Hi @KyleStilkey, were you able to make the fan work?

For folks looking to get the fan working, Release v8.1.0 Ā· bwp91/homebridge-govee Ā· GitHub added support for H7100. It provides on/off and speed controls.

im newā€¦ is there a file i can use to upload?