Govee Appliances (Heaters, Fans, Purifiers)

Got this working today with HA 2023.4.2 and a Govee H7121 Air Purifier

First, get your Govee API key from the ‘Govee Home’ App: User - About Us - Request API Key. The key is delivered by mail within seconds.

Next, get the device id by using your API key in a curl command against the govee appliance endpoint:

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

Create 3 scripts with the device id from previous step:

script:
  office_air_purifier_on:
    alias: 'Office Air Purifier: On'
    sequence:
    - service: rest_command.office_air_purifier
      data:
        device: AA:BB:CC:DD:EE:FF:AA:BB
        model: H7121
        cmd_name: turn
        cmd_value: 'on'
      enabled: true
    - delay:
        hours: 0
        minutes: 0
        seconds: 0
        milliseconds: 500
    - service: input_boolean.turn_on
      target:
        entity_id: input_boolean.office_purifier_state
    mode: single

  office_air_purifier_off:
    alias: 'Office Air Purifier: Off'
    sequence:
    - service: rest_command.office_air_purifier 
      data:
        device: AA:BB:CC:DD:EE:FF:AA:BB
        model: H7121
        cmd_name: turn
        cmd_value: 'off'
      enabled: true
    - delay:
        hours: 0
        minutes: 0
        seconds: 0
        milliseconds: 500
    - service: input_boolean.turn_off
      target:
        entity_id: input_boolean.office_purifier_state
    - service: input_select.select_option
      entity_id: input_select.office_air_purifier_mode
      data:
            option: 'Off'
    mode: single

  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 = {16 : ''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:EE:FF:AA:BB
        model: H7121
        cmd_name: mode
        cmd_value: '{{ office_purifier_mode }}'
    - service: input_boolean.turn_on
      target:
        entity_id: input_boolean.office_purifier_state
    mode: single
    icon: mdi:air-purifier

Then, create a new secret (e.g. govee_api_key) with the API key and update your configuration.yaml

rest_command: 
  office_air_purifier:
    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

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' : 16, 'Low': 1, 'Medium': 2, 'High': 3} %}
            {{ mapper[preset_mode] }}
      speed_count: 4
      preset_modes:
        - 'Low'
        - 'Medium'
        - 'High'
        - 'Sleep'

Then you just need to create the input_boolean and input_select and restart HA.

input_boolean:
  office_purifier_state:
    name: Office Purifier State
    initial: on
    icon: mdi:air-filter

input_select:
  office_air_purifier_mode:
    name: Office Air Purifier Mode
    options:
      - "Low"
      - "Medium"
      - "High"
      - "Sleep"
      - "Off"
    icon: mdi:air-filter

After the restart, you’ll have a few new entities one of which is the glorious fan.office_air_purifier

Also made a pretty awesome little custom:button-card which is working perfectly for the Govee H7121 Air Purifier
Screenshot 2023-04-09 151906

  - type: 'custom:button-card'
    color_type: label-card
    styles:
      card:
        - padding: 0
      name:
        - border-radius: 0.4em 0.4em 0 0
        - padding: 0.1em
        - width: 100%
        - font-weight: bold
      grid:
        - grid-template-areas: '"i" "n" "buttons"'
        - grid-template-columns: 1fr
        - grid-template-rows: 1fr min-content min-content
      custom_fields:
        buttons:
          - background-color: 'rgba(0,0,0,0.2)'
          - margin: 0
          - padding: 0.3em
    color: rgb(67, 73, 82)
    name: Office Air Purifier
    custom_fields:
      buttons:
        card:
          type: horizontal-stack
          cards:
          - type: "custom:button-card"
            entity: input_select.office_air_purifier_mode
            color_type: card
            name: Sleep
            state:
            - value: 'Sleep'
              icon: mdi:power-sleep
              color: rgb(46, 204, 64)
            - value: 'Low'
              icon: mdi:power-sleep
              color: rgb(67, 73, 82)
            - value: 'Medium'
              icon: mdi:power-sleep
              color: rgb(67, 73, 82)
            - value: 'High'
              icon: mdi:power-sleep
              color: rgb(67, 73, 82)
            - value: 'Off'
              icon: mdi:power-sleep
              color: rgb(67, 73, 82)
            style:
            - color: var(--icon-off-color)
            tap_action:
              action: call-service
              service: fan.set_preset_mode
              service_data:
                entity_id: fan.office_air_purifier
                preset_mode: Sleep
          - type: "custom:button-card"
            entity: input_select.office_air_purifier_mode
            color_type: card
            name: Low
            state:
            - value: 'Sleep'
              icon: mdi:fan-speed-1
              color: rgb(67, 73, 82)
            - value: 'Low'
              icon: mdi:fan-speed-1
              color: rgb(46, 204, 64)
            - value: 'Medium'
              icon: mdi:fan-speed-1
              color: rgb(67, 73, 82)
            - value: 'High'
              icon: mdi:fan-speed-1
              color: rgb(67, 73, 82)
            - value: 'Off'
              icon: mdi:fan-speed-1
              color: rgb(67, 73, 82)
            style:
            - color: var(--icon-off-color)
            tap_action:
              action: call-service
              service: fan.set_preset_mode
              service_data:
                entity_id: fan.office_air_purifier
                preset_mode: Low
          - type: "custom:button-card"
            entity: input_select.office_air_purifier_mode
            color_type: card
            name: Medium
            state:
            - value: 'Sleep'
              icon: mdi:fan-speed-2
              color: rgb(67, 73, 82)
            - value: 'Low'
              icon: mdi:fan-speed-2
              color: rgb(67, 73, 82)
            - value: 'Medium'
              icon: mdi:fan-speed-2
              color: rgb(46, 204, 64)
            - value: 'High'
              icon: mdi:fan-speed-2
              color: rgb(67, 73, 82)
            - value: 'Off'
              icon: mdi:fan-speed-2
              color: rgb(67, 73, 82)
            style:
            - color: var(--icon-off-color)
            tap_action:
              action: call-service
              service: fan.set_preset_mode
              service_data:
                entity_id: fan.office_air_purifier
                preset_mode: Medium
          - type: "custom:button-card"
            entity: input_select.office_air_purifier_mode
            color_type: card
            name: High
            state:
            - value: 'Sleep'
              icon: mdi:fan-speed-3
              color: rgb(67, 73, 82)
            - value: 'Low'
              icon: mdi:fan-speed-3
              color: rgb(67, 73, 82)
            - value: 'Medium'
              icon: mdi:fan-speed-3
              color: rgb(67, 73, 82)
            - value: 'High'
              icon: mdi:fan-speed-3
              color: rgb(46, 204, 64)
            - value: 'Off'
              icon: mdi:fan-speed-3
              color: rgb(67, 73, 82)
            style:
            - color: var(--icon-off-color)
            tap_action:
              action: call-service
              service: fan.set_preset_mode
              service_data:
                entity_id: fan.office_air_purifier
                preset_mode: High
          - type: "custom:button-card"
            icon: mdi:power
            color_type: card
            entity: input_boolean.office_purifier_state
            name: Power
            tap_action:
              action: call-service
              service: fan.turn_off
              service_data:
                entity_id: fan.office_air_purifier
            state:
            - value: 'off'
              color: rgb(255, 220, 0)
            - value: 'on'
              color: rgb(255, 65, 54)
            style:
            - color: var(--icon-off-color)
              

TL;DR: Govee H7121 Air Purifier · ntalekt/homeassistant@ec11422 · GitHub

1 Like

I have now thanks to @ntalekt his post, it has put me on the correct path and I see where I had messed up.

Now the only thing I need assistance with is being able to change the speeds, I will see if I can figure it out on my free time or if @ntalekt can see if he can add speeds or not.

Here is my setup currently.

  • When adding multiple devices for fans you will only need the first initial fan: then each device you may start off with - platform to have multiple fans added in your config yaml.
  • I create these from the scripts under Home Assistants Settings Panel. I just create and name my Script as needed and then click the 3 dots at the top right and just edit the yaml if the UI is a bit confusing or you just want to copy & paste what I have provided.

Smart Tower Fan (H7100)

Config.yml

fan:
  - platform: template
    fans:
      master_bedroom_fan:
        friendly_name: "Master Bedroom Fan"
        value_template: "{{ states('input_boolean.master_bedroomfan_state') }}"
        preset_mode_template: "{{ states('input_select.master_bedroom_fan_mode') }}"
        turn_on:
          service: script.master_bedroom_fan_on
        turn_off:
          service: script.master_bedroom_fan_off
        set_preset_mode:
          service: script.master_bedroom_fan_mode
          data:
            master_bedroom_fan_mode: >
              {% set mapper = {'Custom' : 2, 'Auto': 3, 'Sleep': 5, 'Nature': 6} %}
              {{ mapper[preset_mode] }}
        speed_count: 8
        preset_modes:
          - 'Custom'
          - 'Auto'
          - 'Sleep'
          - 'Nature'

Scripts

Fan On

alias: Master Bedroom Fan On
sequence:
  - service: rest_command.rest_govee_appliance
    data:
      device: ENTER_DEVICE_ID_HERE
      model: H7100
      cmd_name: turn
      cmd_value: "on"
    enabled: true
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - service: input_boolean.turn_on
    target:
      entity_id: input_boolean.master_bedroom_fan_state
    data: {}
mode: single

Fan Off

alias: Master Berdoom Off
sequence:
  - service: rest_command.rest_govee_appliance
    data:
      device: ENTER_DEVICE_ID_HERE
      model: H7100
      cmd_name: turn
      cmd_value: "off"
    enabled: true
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - service: input_boolean.turn_off
    target:
      entity_id: input_boolean.master_bedroom_fan_state
    data: {}
  - service: input_select.select_option
    entity_id: input_select.master_bedroom_fan_mode
    data:
      option: "Off"
mode: single

Fan Mode

alias: Master Bedroom Fan Mode
sequence:
  - service: input_select.select_option
    entity_id: input_select.master_bedroom_fan_mode
    data:
      option: >-
        {% set mapper = {2 : 'Custom', 3: 'Auto', 5: 'Sleep', 6: 'Nature'} %} {{
        mapper[master_bedroom_fan_mode] }}
    enabled: true
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - service: rest_command.rest_govee_appliance
    data:
      device: ENTER_DEVICE_ID_HERE
      model: H7100
      cmd_name: mode
      cmd_value: "{{ master_bedroom_fan_mode }}"
  - service: input_boolean.turn_on
    target:
      entity_id: input_boolean.master_bedroom_fan_state
    data: {}
mode: single

Helpers
Fan Mode

* Select Dropdown Option
* Name Helper (Verify that Entity ID matches same as your scripts and config.yml)
* Add Preset Mode Names (Including a Off option)

Fan State

* Select Toggle Option
* Name Helper (Verify that Entity ID matches same as your scripts and config.yml)

Tower Fan (H7101)

Config.yml

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'

Scripts

Fan On

alias: Office Fan On
sequence:
  - service: rest_command.rest_govee_appliance
    data:
      device: ENTER_DEVICE_ID_HERE
      model: H7101
      cmd_name: turn
      cmd_value: "on"
    enabled: true
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - service: input_boolean.turn_on
    target:
      entity_id: input_boolean.office_fan_state
    data: {}
mode: single

Fan Off

alias: Office Fan Off
sequence:
  - service: rest_command.rest_govee_appliance
    data:
      device: ENTER_DEVICE_ID_HERE
      model: H7101
      cmd_name: turn
      cmd_value: "off"
    enabled: true
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - service: input_boolean.turn_off
    target:
      entity_id: input_boolean.office_fan_state
    data: {}
  - service: input_select.select_option
    entity_id: input_select.office_fan_mode
    data:
      option: "Off"
mode: single

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.rest_govee_appliance
    data:
      device: ENTER_DEVICE_ID_HERE
      model: H7101
      cmd_name: mode
      cmd_value: "{{ office_fan_mode }}"
  - service: input_boolean.turn_on
    target:
      entity_id: input_boolean.office_fan_state
    data: {}
mode: single

Helpers
Fan Mode

* Select Dropdown Option
* Name Helper (Verify that Entity ID matches same as your scripts and config.yml)
* Add Preset Mode Names (Including a Off option)

Fan State

* Select Toggle Option
* Name Helper (Verify that Entity ID matches same as your scripts and config.yml)

Air Purifier (H7121)
Config.yml

fan:
  - platform: template
    fans:
      master_bedroom_air_purifier:
        friendly_name: "Master Bedroom Air Purifier"
        value_template: "{{ states('input_boolean.master_bedroom_air_purifier_state') }}"
        preset_mode_template: "{{ states('input_select.master_bedroom_air_purifier_mode') }}"
        turn_on:
          service: script.master_bedroom_air_purifier_on
        turn_off:
          service: script.master_bedroom_air_purifier_off
        set_preset_mode:
          service: script.master_bedroom_air_purifier_mode
          data:
            master_bedroom_air_purifier_mode: >
              {% set mapper = {'Low' : 1, 'Medium': 2, 'High': 3, 'Sleep': 16} %}
              {{ mapper[preset_mode] }}
        speed_count: 4
        preset_modes:
          - 'Low'
          - 'Medium'
          - 'High'
          - 'Sleep'

Scripts

Fan On

alias: Master Bedroom Air Purifier On
sequence:
  - service: rest_command.rest_govee_appliance
    data:
      device: ENTER_DEVICE_ID_HERE
      model: H7121
      cmd_name: turn
      cmd_value: "on"
    enabled: true
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - service: input_boolean.turn_on
    target:
      entity_id: input_boolean.master_bedroom_air_purifier_state
    data: {}
mode: single

Fan Off

alias: Master Bedroom Air Purifier Off
sequence:
  - service: rest_command.rest_govee_appliance
    data:
      device: ENTER_DEVICE_ID_HERE
      model: H7121
      cmd_name: turn
      cmd_value: "off"
    enabled: true
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - service: input_boolean.turn_off
    target:
      entity_id: input_boolean.master_bedroom_air_purifier_state
    data: {}
  - service: input_select.select_option
    entity_id: input_select.master_bedroom_air_purifier_mode
    data:
      option: "Off"
mode: single

Fan Mode

alias: Master Bedroom Air Purifier Mode
sequence:
  - service: input_select.select_option
    entity_id: input_select.master_bedroom_air_purifier_mode
    data:
      option: >-
        {% set mapper = {1 : 'Low', 2: 'Medium', 3: 'High', 16: 'Sleep'} %} {{
        mapper[master_bedroom_air_purifier_mode] }}
    enabled: true
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - service: rest_command.rest_govee_appliance
    data:
      device: ENTER_DEVICE_ID_HERE
      model: H7121
      cmd_name: mode
      cmd_value: "{{ master_bedroom_air_purifier_mode }}"
  - service: input_boolean.turn_on
    target:
      entity_id: input_boolean.master_bedroom_air_purifier_state
    data: {}
mode: single

Helpers
Fan Mode

* Select Dropdown Option
* Name Helper (Verify that Entity ID matches same as your scripts and config.yml)
* Add Preset Mode Names (Including a Off option)

Fan State

* Select Toggle Option
* Name Helper (Verify that Entity ID matches same as your scripts and config.yml)

Air Purifier (H7123)
Config.yml

fan:
    - platform: template
    fans:
      office_air_purifier:
        friendly_name: "Office Air Purifier"
        value_template: "{{ states('input_boolean.office_air_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_air_purifier_mode: >
              {% set mapper = {'Low' : 1, 'Medium': 2, 'High': 3, 'Auto': 4, 'Sleep': 5} %}
              {{ mapper[preset_mode] }}
        speed_count: 5
        preset_modes:
          - 'Low'
          - 'Medium'
          - 'High'
          - 'Auto'
          - 'Sleep'

Scripts

Fan On

alias: Office Air Purifier On
sequence:
  - service: rest_command.rest_govee_appliance
    data:
      device: ENTER_DEVICE_ID_HERE
      model: H7123
      cmd_name: turn
      cmd_value: "on"
    enabled: true
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - service: input_boolean.turn_on
    target:
      entity_id: input_boolean.office_air_purifier_state
    data: {}
mode: single

Fan Off

alias: Office Air Purifier Off
sequence:
  - service: rest_command.rest_govee_appliance
    data:
      device: ENTER_DEVICE_ID_HERE
      model: H7123
      cmd_name: turn
      cmd_value: "off"
    enabled: true
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - service: input_boolean.turn_off
    target:
      entity_id: input_boolean.office_air_purifier_state
    data: {}
  - service: input_select.select_option
    entity_id: input_select.office_air_purifier_mode
    data:
      option: "Off"
mode: single

Fan Mode

alias: Office Air Purifier Mode
sequence:
  - service: input_select.select_option
    entity_id: input_select.office_air_purifier_mode
    data:
      option: >-
        {% set mapper = {1 : 'Low', 2: 'Medium', 3: 'High', 4: 'Auto', 5:
        'Sleep'} %} {{ mapper[office_air_purifier_mode] }}
    enabled: true
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - service: rest_command.rest_govee_appliance
    data:
      device: ENTER_DEVICE_ID_HERE
      model: H7123
      cmd_name: mode
      cmd_value: "{{ office_air_purifier_mode }}"
  - service: input_boolean.turn_on
    target:
      entity_id: input_boolean.office_air_purifier_state
    data: {}
mode: single

Helpers
Fan Mode

* Select Dropdown Option
* Name Helper (Verify that Entity ID matches same as your scripts and config.yml)
* Add Preset Mode Names (Including a Off option)

Fan State

* Select Toggle Option
* Name Helper (Verify that Entity ID matches same as your scripts and config.yml)

Humidifier (H7141)
Config.yml

fan:
      - platform: template
    fans:
      master_bedroom_humidifier:
        friendly_name: "Master Bedroom Humidifier"
        value_template: "{{ states('input_boolean.master_bedroom_humidifier_state') }}"
        preset_mode_template: "{{ states('input_select.master_bedroom_humidifier_mode') }}"
        turn_on:
          service: script.master_bedroom_humidifier_on
        turn_off:
          service: script.master_bedroom_humidifier_off
        set_preset_mode:
          service: script.master_bedroom_humidifier_mode
          data:
            master_bedroom_humidifier_mode: >
              {% set mapper = {'Custom': 2, 'Auto': 3} %}
              {{ mapper[preset_mode] }}
        speed_count: 8
        preset_modes:
          - 'Custom'
          - 'Auto'

Scripts

Fan On

alias: Master Bedroom Humidifier On
sequence:
  - service: rest_command.rest_govee_appliance
    data:
      device: ENTER_DEVICE_ID_HERE
      model: H7141
      cmd_name: turn
      cmd_value: "on"
    enabled: true
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - service: input_boolean.turn_on
    target:
      entity_id: input_boolean.master_bedroom_humidifier_state
    data: {}
mode: single

Fan Off

alias: Master Bedroom Humidifier Off
sequence:
  - service: rest_command.rest_govee_appliance
    data:
      device: ENTER_DEVICE_ID_HERE
      model: H7141
      cmd_name: turn
      cmd_value: "off"
    enabled: true
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - service: input_boolean.turn_off
    target:
      entity_id: input_boolean.master_bedroom_humidifier_state
    data: {}
  - service: input_select.select_option
    entity_id: input_select.master_bedroom_humidifier_mode
    data:
      option: "Off"
mode: single

Fan Mode

alias: Master Bedroom Humidifier Mode
sequence:
  - service: input_select.select_option
    entity_id: input_select.master_bedroom_humidifier_mode
    data:
      option: >-
        {% set mapper = {2: 'Custom', 3: 'Auto'} %} {{
        mapper[master_bedroom_humidifier_mode] }}
    enabled: true
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - service: rest_command.rest_govee_appliance
    data:
      device: ENTER_DEVICE_ID_HERE
      model: H7141
      cmd_name: mode
      cmd_value: "{{ master_bedroom_humidifier_mode }}"
  - service: input_boolean.turn_on
    target:
      entity_id: input_boolean.master_bedroom_humidifier_state
    data: {}
mode: single

Helpers
Fan Mode

* Select Dropdown Option
* Name Helper (Verify that Entity ID matches same as your scripts and config.yml)
* Add Preset Mode Names (Including a Off option)

Fan State

* Select Toggle Option
* Name Helper (Verify that Entity ID matches same as your scripts and config.yml)

Any questions do let me know, right now I am confused on adding the speeds but will try taking a look or if anyone can assist please do. I will also add my other devices.

2 Likes

I just wanted to say thank you! I was pulling out my hair where I was messing up and see I wasn’t far off but I am so happy you have posted these and have helped. I have now included my 4 devices I own below and hope this will help others.

I am missing one thing is the speed selections for the humidifier and fan. They use the command Gear instead but accept the values of 1-8 (for each speed). I am unsure how I would add this and have tried looking around. I believe it might be related to the percentage command but if you by chance might be able to help, it would be much appreciated!

Thanks again either way and I love the custom button card addition too :slight_smile:

Glad you got it somewhat working @KyleStilkey. I just added some automations to control the H7121 in my office: homeassistant/office_purifier.yaml at b42b46eb5a56d22993203b746dd5c4cb0ebdb5bd · ntalekt/homeassistant · GitHub

For the fan what was the output when you connected to the appliance API? That should give us an indicator.

Thanks.

{
            "device": "(REMOVED)",
            "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"],
          },
        ],
    },
  "message": "Success",
  "code": 200,
}

This is the output, it looks to take the command gear and values used 1-8. I’m going to guess to make the fan template show a slider I need to use the percentage command in the config yaml and create a script and helper similar to the modes option?

Hope this helps!

Maybe something like this?

input_select:
  office_fan_gear:
    name: Office Fan Gear
    options:
      - "1"
      - "2"
      - "3"
      - "4"
      - "5"
      - "6"
      - "7"
      - "8"
    icon: mdi:fan
	
script:
  office_air_fan_gear:
    alias: 'Office Fan: Gear'
    sequence:
    - service: input_select.select_option
      entity_id: input_select.office_fan_gear
      data:
            option: '{% set mapper = {1: ''gear'', 2: ''gear'', 3: ''gear'', 4: ''gear'', 5: ''gear'', 6: ''gear'', 7: ''gear'', 8: ''gear''} %} {{ mapper[office_purifier_gear] }}'
      enabled: true
    - delay:
        hours: 0
        minutes: 0
        seconds: 0
        milliseconds: 500
    - service: rest_command.rest_govee_appliance
      data:
        device: AA:BB:CC:DD:EE:FF:AA:BB
        model: H7101
        cmd_name: gear
        cmd_value: '{{ office_purifier_gear }}'
    - service: input_boolean.turn_on
      target:
        entity_id: input_boolean.office_fan_state
    mode: single
    icon: mdi:air-purifier

thank you for all your hard work, im super new to this. i did get hung up on script “rest_command.rest_govee_appliance” because in the config.yaml its “- service: rest_command.office_air_purifier” but i got it in the end. but no joke thanks a ton the auto mode on the govee h7123 with automations, I am getting this down. right now when its cool out side actuators open the windows which opens a whole house fan and turns on this filter then when the whole house fan turns off and the reverse when its too cold or to hot. Next will be to do a sensor for presence detections to turn off when no one is in the room. any ways thanks again and wish me luck.

1 Like

Sounds great @bsession1014 and welcome. Here are some of my occupancy automations if they help: homeassistant/occupancy.yaml at c404fb89bb33f1ecf4fb5728abf50085136bcef1 · ntalekt/homeassistant · GitHub

Sorry for the delay but how would I add this to my config.yaml? I can’t add a second set of modes and I believe that’s where I have to use percentage_template and use the number input helper too and that’s where I believe I am getting lost as I’m confused.

I’ve got my fan being controlled at this point, at least the on/off. I’m going to modify the fan mode to take speed controls since I don’t really care much about the specific modes, but my question is:

How do I get it to add a card to the dashboard that’s like the card it displays when you look at it in the Entities list? I try and add a card to the dashboard, I select the entity and it shows exactly what I’d like it to add, but putting a checkmark next to the entity, click Continue and the Suggested card is just the small toggle. I can use another card to get the toggle and a basic dropdown, but nothing like the view you see when you look at the entity.

cool thank you

I’ve tried your instructions exactly (i believe) how you’ve listed them above. I’ve kept the same name as you.

All i changed from yours was my device ID and my model (H7102). The H7102 gives the same states as your H7101.

I get the entities, but when i turn the fan on, nothing happens :frowning:

Copy all your codes here and we can take a look see if something is wrong.

Hey Sam,

Did you get any further with this? I have the same fan so would also like to control it via HASS.

Kyle and ntalekt - thanks for walking me through this. I’ve created the config, scripts and helpers according to your instructions. I can see the entities created but they are listed as scripts. I created an entities card but it just has Run selections for each script. How do I convert this into a normal Fan control card? There is no device or entity that I can assign to the card in order to control it.

I’d really like to get this API in to an actual integration natively. Does anyone have information on if Govee API offers status on appliance devices? I’ll write the integration if yes.
I cant. Find any information online, but I dont have access to their community. Maybe we should all inqure about this. They offer status for the lights…

Govee’s API does not give us a way to retrieve the status of any appliance. Most likely because they think it isn’t important to know the current status of the device when we can just change the setting however we please.

I have had some success with feature requests in the past through their support email. So we’ll see if they respond/update the support on those devices.

1 Like

That’s based on the configuration.yaml being set up correctly for your fan template then selecting your office fan entity as a card. I use the tile card myself as that’s where it seems most of the works being pushed towards and recent updates have added fan support for it. So I can easily toggle my fan off and on and open up the card to see my presets. The only issue I am having is setting up the speeds. I will one day take a look at it or hopefully someone just adds this into an integration.

I updated my original post to include the H7100 fan as I now have that, pretty much is the exact same as the H7101 for setting up but still added for anyone that finds this thread through searching.

1 Like

Ok I am slowly getting fan speeds working, this is what I have to have % show up in my tiles for the fan and I have a helper create for input % now I believe the issue is with my script, I don’t know how I would go about setting up a variable selection to then call for a set command like we do for preset modes.

If we can get the script figured out to say kind of like how we are calling for modes in the input select type but with input numbers instead.

### Master Bedroom Fan
  - platform: template
    fans:
      master_bedroom_fan:
        friendly_name: "Master Bedroom Fan"
        value_template: "{{ states('input_boolean.master_bedroom_fan_state') }}"
        preset_mode_template: "{{ states('input_select.master_bedroom_fan_mode') }}"
        turn_on:
          service: script.master_bedroom_fan_on
        turn_off:
          service: script.master_bedroom_fan_off
        set_preset_mode:
          service: script.master_bedroom_fan_mode
          data:
            master_bedroom_fan_mode: >
              {% set mapper = {'Custom' : 2, 'Auto': 3, 'Sleep': 5, 'Nature': 6} %}
              {{ mapper[preset_mode] }}
        percentage_template: "{{ states('input_number.master_bedroom_fan_speed') }}"
        speed_count: 8
        set_percentage:
          service: script.master_bedroom_fan_speed
          data:
            percentage: "{{ percentage }}"
        preset_modes:
          - 'Custom'
          - 'Auto'
          - 'Sleep'
          - 'Nature'

This is currently what I have set for my master bedroom fan, I have a input helper created for a % and it goes in steps of 12 (might have to change to something else as these fans use 8 steps) and I can make it call the script but I clearly need to figure out how to set up variables for it so say it goes to 12% it will then call the command gear for 1 (as that’s the speed command for Govee) but I am unsure how.

Much appreciate if anyone can give any input or help but as of now I am slowly getting it figured out.