IR FAN (Dyson AM07) Harmony Full Control

@CloudHoang your formatting is probably wrong but I can’t tell unless you use the </> tag in the toolbar above. Yaml needs the correct spacing otherwise the file will produce errors. Try pasting your yaml here and use the code tag and I’ll help get it working for you

1 Like

Hi @Jer78

Really thanks for your help
Please check my config yaml

homeassistant:
  name: Home
  latitude: xx
  longitude: xx
  elevation: 5
  unit_system: metric
  time_zone: xxx

  
  
# Customization file
  customize: !include config/customizes.yaml
#  customize_glob: !include config/custom-ui.yaml

#########################################################################################################
#Configuration file in config/#

#FAN Switch
#fan: !include config/fan.yaml
#climate: !include config/climate.yaml

################# other config ###########################################################################
# Enables the frontend
frontend:
  extra_html_url:
    - /local/custom_ui/state-card-custom-ui.html
    - /local/custom_ui/state-card-with-speed.html
    - /local/custom_ui/state-card-custom_fan.html
  extra_html_url_es5:
    - /local/custom_ui/state-card-custom-ui-es5.html

# Enables configuration UI
config:

http:
  # Secrets are defined in the file secrets.yaml
  api_password: !secret http_password
  # Uncomment this if you are using SSL/TLS, running in Docker container, etc.
  # base_url: example.duckdns.org:8123

# Checks for available updates
# Note: This component will send some information about your system to
# the developers to assist with development of Home Assistant.
# For more information, please see:
# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/
updater:
  # Optional, allows Home Assistant developers to focus on popular components.
  # include_used_components: true

# Discover some devices automatically
discovery:

# Allows you to issue voice commands from the frontend in enabled browsers
conversation:

# Enables support for tracking state changes over time
history:

# View all events in a logbook
logbook:

#loger
logger:
    default: critical
    logs:
        homeassistant.components.switch.broadlink: info
        
# Enables a map showing the location of tracked devices
map:

# Track the sun
sun:

# Weather prediction
sensor:
  - platform: yr

# Text to speech
tts:
  - platform: google

# Cloud
#cloud:

 
#Configurator
#panel_iframe:
#  configurator:
#    title: Configurator
#    icon: mdi:wrench
#    url: http://192.168.1.90:3218

### Don't know where to input ####
input_number:
  dyson_fan_speed:
    name: Fan Speed
    icon: mdi:fan
    min: 0
    max: 10
    step: 1
    
  default_fan_speed:
    name: Default Fan Speed
    icon: mdi:speedometer
    options:
      - 1
      - 2
      - 3
      - 4
      - 5
      - 6
      - 7
      - 8
      - 9
      - 10

######### Switch #########
switch:
  dyson_fan_power:
    value_template: "{{ states('input_number.dyson_fan_speed') | int > 0 }}"
    turn_on:
      service: script.turn_on
      entity_id: script.dyson_on
    turn_off:
      service: script.turn_on
      entity_id: script.dyson_off

######### Group #########
group: #!include config/groups.yaml
  dyson_fan:
    control: hidden
    view: no
    name: Dyson Fan
    entities:
      - switch.dyson_fan_power
      - input_select.default_fan_speed
      - input_number.dyson_fan_speed
      - script.dyson_oscillate

######### automation #########
automation: #!include config/automations.yaml
  - alias: "Dyson Fan Speed Up"
    initial_state: on
    trigger:
      - platform: state
        entity_id: input_number.dyson_fan_speed
    condition:
      condition: and
      conditions:
        - condition: template
          value_template: '{{ trigger.from_state.state | int < trigger.to_state.state | int }}'
    action:
      - service: remote.send_command
        entity_id: remote.bedroom
        data_template:
          command: FanSpeedUp
          delay_secs: '0.25'
          device: '37710632'
          num_repeats: >
            {% set from_speed = (trigger.from_state.state | int) %}
            {% set to_speed = (trigger.to_state.state | int) %}
            {% if  from_speed == 0 %}
              {% set repeats = (to_speed - 1) %}
            {% else %}
              {% set repeats = to_speed - from_speed %}
            {% endif %}
            {{repeats}}

  - alias: "Dyson Fan Speed Down"
    initial_state: on
    trigger:
      - platform: state
        entity_id: input_number.dyson_fan_speed
    condition:
      condition: and
      conditions:
        - condition: template
          value_template: '{{ trigger.from_state.state | int > trigger.to_state.state | int }}'
        - condition: template
          value_template: '{{ 0 < trigger.from_state.state | int }}'
    action:
      - service: remote.send_command
        entity_id: remote.bedroom
        data_template:
          command: FanSpeedDown
          delay_secs: '0.25'
          device: '37710632'
          num_repeats: >
            {% set from_speed = (trigger.from_state.state | int) %}
            {% set to_speed = (trigger.to_state.state | int) %}
            {% if  to_speed == 0 %}
              {% set repeats = 10 %}
            {% else %}
              {% set repeats = from_speed - to_speed %}
            {% endif %}
            {{repeats}}
            
######### Script #########
script: #!include config/scripts.yaml
  dyson_on:
    sequence:
      - service: remote.send_command
        entity_id: remote.bedroom
        data:
          device: "37710632"
          command: "PowerToggle"
      - service: input_number.select_value
        data_template:
          entity_id: input_number.dyson_fan_speed
          value: '{{ states.input_select.default_fan_speed.state | int }}'
      - service: remote.send_command
        entity_id: remote.bedroom
        data:
          device: "37710632"
          command: "Oscillate"

  dyson_off:
    sequence:
      - service: input_number.select_value
        data_template:
          entity_id: input_number.dyson_fan_speed
          value: 0
      - delay:
          seconds: 5
      - service: remote.send_command
        entity_id: remote.bedroom
        data:
          device: "37710632"
          command: "PowerToggle"

Ah ok, you need to use them under template switches. Try this:

  switch:
    - platform: template
      switches:
        dyson_fan_power:
          value_template: "{{ states('input_number.dyson_fan_speed') | int > 0 }}"
          turn_on:
            service: script.turn_on
            entity_id: script.dyson_on
          turn_off:
            service: script.turn_on
            entity_id: script.dyson_off
1 Like

Hi @Jer78
Thanks for your help… It’s worked :slight_smile:

From your help, I can understand more about script and automation

1 Like

could this be done with a harmony hub device, using multiple commands (Turn on, press heat, press color, press backlight)?

52670895 - Fireplace
PowerToggle
Backlight
Flame Color
Flame Color
Heat

@Corey_Maxim I’m not quite sure what you want it to do, but yes, you can use any commands from your harmony remote.

I was trying to use this switch to create a on/Off switch for my ir controlled fireplace using multiple commands to turn on.

Ie; turn on fireplace, press heat, press backlight, press flame color twice.

Then send that to homekit via Homebridge however I can’t seem to figure out how to get the switch to do anything or what to put in each file to get it to work.

I honestly have been trying. I would like to use the device itself instead of using a activity because it turns off other activities when starting a new one. Heck I can’t even figure out hot to get the remote toggle to turn my tv on. Lol

I won’t give up I’m just frustrated. I’m sure once I get this it will be a good stepping stone to figure out the rest.

OK, it should actually be less complicated than the Dyson fan since you won’t have to deal with speed levels. What I’d suggest is use an input_boolean rather than a switch and 2 automations, one to turn on the fireplace and the other to turn it off. With Power Toggle’s there’s no real way to get the state so if another remote is used, it will not get it’s correct state, but there’s no real way to solve that. Just replace the HARMONY_REMOTE_NAME with the name of your remote.

Once you get the following set up, we can get the Homebridge config working for you. But try this first.

input_boolean:
  fireplace:
    name: 'Fireplace'
    icon: mdi:fire

automation:
  - id: fireplace_on
    alias: Turn on Fireplace
    initial_state: 'on'
    trigger:
    - platform: state 
      entity_id: input_boolean.fireplace
      to: 'on'
    action:
    - service: remote.send_command
      entity_id: remote.HARMONY_REMOTE_NAME
      data:
        device: "52670895"
        command: "PowerToggle"
    - service: remote.send_command
      entity_id: remote.HARMONY_REMOTE_NAME
      data:
        device: "52670895"
        command: "Backlight"
    - service: remote.send_command
      entity_id: remote.HARMONY_REMOTE_NAME
      data:
        device: "52670895"
        command: "Flame Color"
        num_repeats: 2
    - service: remote.send_command
      entity_id: remote.HARMONY_REMOTE_NAME
      data:
        device: "52670895"
        command: "Heat"

  - id: fireplace_off
    alias: Turn off Fireplace
    initial_state: 'on'
    trigger:
    - platform: state 
      entity_id: input_boolean.fireplace
      to: 'off'
    action:
    - service: remote.send_command
      entity_id: remote.HARMONY_REMOTE_NAME
      data:
        device: "52670895"
        command: "PowerToggle"

First I want to tell you THANK YOU! I really do appreciate you taking your time to help me!

Ok I do have a question when you say remote name, is that the name of my hub? If so my Hubs name is Harmony.

so I pasted the code into Config.yaml folder and changed the name of the remote to Harmony but im getting a error with the config after restarting.

heres the yaml.

input_boolean:
fireplace:
name: ‘Fireplace’
icon: mdi:fire

automation:

  • id: fireplace_on
    alias: Turn on Fireplace
    initial_state: ‘on’
    trigger:

    • platform: state
      entity_id: input_boolean.fireplace
      to: ‘on’
      action:
    • service: remote.send_command
      entity_id: remote.Harmony
      data:
      device: “52670895”
      command: “PowerToggle”
    • service: remote.send_command
      entity_id: remote.Harmony
      data:
      device: “52670895”
      command: “Backlight”
    • service: remote.send_command
      entity_id: remote.Harmony
      data:
      device: “52670895”
      command: “Flame Color”
      num_repeats: 2
    • service: remote.send_command
      entity_id: remote.Harmony
      data:
      device: “52670895”
      command: “Heat”
  • id: fireplace_off
    alias: Turn off Fireplace
    initial_state: ‘on’
    trigger:

    • platform: state
      entity_id: input_boolean.fireplace
      to: ‘off’
      action:
    • service: remote.send_command
      entity_id: remote.Harmony
      data:
      device: “52670895”
      command: “PowerToggle”

Here’s the log.
2018-03-23 00:22:41 WARNING (SyncWorker_9) [netdisco.ssdp] Found malformed XML at http://192.168.86.110:40001: status=ok
2018-03-23 00:22:50 WARNING (SyncWorker_8) [homeassistant.components.hue] Connected to Hue at 192.168.86.53 but not registered.
2018-03-23 00:22:57 ERROR (SyncWorker_16) [pywemo.ssdp] Found malformed XML at http://192.168.86.110:40001: status=ok
2018-03-23 08:31:09 WARNING (MainThread) [homeassistant.components.switch.wemo] Lost connection to Bed Light
2018-03-23 08:34:05 WARNING (MainThread) [homeassistant.components.switch.wemo] Lost connection to Courtney Box Fan
2018-03-23 08:34:10 WARNING (SyncWorker_10) [pywemo.ouimeaux_device.api.service] Error communicating with Courtney Box Fan , retry 0
2018-03-23 08:38:59 WARNING (MainThread) [homeassistant.components.switch.wemo] Lost connection to Bed Light
2018-03-23 08:41:09 WARNING (MainThread) [homeassistant.components.switch.wemo] Lost connection to Bed Light
2018-03-23 08:41:14 WARNING (SyncWorker_1) [pywemo.ouimeaux_device.api.service] Error communicating with Bed Light, retry 0
2018-03-23 08:42:36 WARNING (MainThread) [homeassistant.components.switch.wemo] Lost connection to Bed Light
2018-03-23 08:51:14 WARNING (MainThread) [homeassistant.components.switch.wemo] Lost connection to Bed Light
2018-03-23 11:10:29 ERROR (SyncWorker_3) [homeassistant.components.remote.harmony] No activity specified with turn_on service
2018-03-23 11:10:42 ERROR (SyncWorker_8) [homeassistant.components.remote.harmony] No activity specified with turn_on service
2018-03-23 11:10:53 ERROR (SyncWorker_19) [homeassistant.components.remote.harmony] No activity specified with turn_on service
2018-03-23 16:37:47 ERROR (MainThread) [homeassistant.components.hassio] starting version 3.2.4
Testing configuration at /config
ERROR:homeassistant.util.yaml:YAML file /config/configuration.yaml contains duplicate key “automation”. Check lines 70 and 78.

2018-03-23 16:40:48 ERROR (MainThread) [homeassistant.components.hassio] starting version 3.2.4
Testing configuration at /config
ERROR:homeassistant.util.yaml:YAML file /config/configuration.yaml contains duplicate key “automation”. Check lines 73 and 119.

2018-03-23 16:42:51 ERROR (MainThread) [homeassistant.components.hassio] starting version 3.2.4
Testing configuration at /config
ERROR:homeassistant.util.yaml:YAML file /config/configuration.yaml contains duplicate key “automation”. Check lines 72 and 117.

2018-03-23 16:44:30 ERROR (MainThread) [homeassistant.components.hassio] starting version 3.2.4
Testing configuration at /config
ERROR:homeassistant.util.yaml:YAML file /config/configuration.yaml contains duplicate key “automation”. Check lines 73 and 119.

2018-03-23 16:46:15 ERROR (MainThread) [homeassistant.components.hassio] starting version 3.2.4
Testing configuration at /config
ERROR:homeassistant.util.yaml:YAML file /config/configuration.yaml contains duplicate key “automation”. Check lines 72 and 118.

2018-03-23 16:48:51 ERROR (MainThread) [homeassistant.components.hassio] starting version 3.2.4
Testing configuration at /config
ERROR:homeassistant.util.yaml:YAML file /config/configuration.yaml contains duplicate key “automation”. Check lines 72 and 118.

@Corey_Maxim

So if you already have an automation heading, just paste the automation part under it minus “automation” because it’s creating a duplicate key. See lines 72 and 117 in your yaml. It’s showing you have it twice.

Next, if you can use the </> in the formatting menu it’s easier to troubleshoot because YAML definitely is picky and spacing is crucial.

Also, you can look up your harmony remote under the <> in developer tools. Filter by remote or scroll down and look for that entity_id. That’s what you’ll need.

input_boolean:
  fireplace:
    name: 'Fireplace'
    icon: mdi:fire
    
  - id: fireplace_on
    alias: Turn on Fireplace
    initial_state: 'on'
    trigger:
    - platform: state 
      entity_id: input_boolean.fireplace
      to: 'on'
    action:
    - service: remote.send_command
      entity_id: remote.harmony
      data:
        device: "52670895"
        command: "PowerToggle"
    - service: remote.send_command
      entity_id: remote.harmony
      data:
        device: "52670895"
        command: "Backlight"
    - service: remote.send_command
      entity_id: remote.harmony
      data:
        device: "52670895"
        command: "Flame Color"
        num_repeats: 2
    - service: remote.send_command
      entity_id: remote.harmony
      data:
        device: "52670895"
        command: "Heat"

  - id: fireplace_off
    alias: Turn off Fireplace
    initial_state: 'on'
    trigger:
    - platform: state 
      entity_id: input_boolean.fireplace
      to: 'off'
    action:
    - service: remote.send_command
      entity_id: remote.harmony
      data:
        device: "52670895"
        command: "PowerToggle"

2018-03-23 17:12:08 WARNING (SyncWorker_14) [homeassistant.components.hue] Connected to Hue at 192.168.86.53 but not registered.
2018-03-23 17:12:22 WARNING (MainThread) [homeassistant.setup] Setup of wemo is taking over 10 seconds.
2018-03-23 17:17:04 ERROR (MainThread) [homeassistant.components.hassio] starting version 3.2.4
Testing configuration at /config
ERROR:homeassistant.util.yaml:while parsing a block mapping
in “/config/configuration.yaml”, line 68, column 3
expected , but found ‘-’
in “/config/configuration.yaml”, line 73, column 3
Failed config
General Errors:
- while parsing a block mapping
in “/config/configuration.yaml”, line 68, column 3
expected , but found ‘-’
in “/config/configuration.yaml”, line 73, column 3
Successful config (partial)

2018-03-23 17:19:14 ERROR (MainThread) [homeassistant.components.hassio] starting version 3.2.4
Testing configuration at /config
Failed config
General Errors:
- Component not found: Automation
Successful config (partial)

2018-03-23 17:20:49 ERROR (MainThread) [homeassistant.components.hassio] starting version 3.2.4
Testing configuration at /config
ERROR:homeassistant.util.yaml:YAML file /config/configuration.yaml contains duplicate key “automation”. Check lines 71 and 118.

2018-03-23 17:21:42 ERROR (SyncWorker_7) [homeassistant.util.yaml] while parsing a block mapping
in “/config/configuration.yaml”, line 68, column 3
expected , but found ‘-’
in “/config/configuration.yaml”, line 73, column 3
2018-03-23 17:21:42 ERROR (MainThread) [homeassistant.components] while parsing a block mapping
in “/config/configuration.yaml”, line 68, column 3
expected , but found ‘-’
in “/config/configuration.yaml”, line 73, column 3
2018-03-23 17:21:46 ERROR (SyncWorker_19) [homeassistant.util.yaml] while parsing a block mapping
in “/config/configuration.yaml”, line 68, column 3
expected , but found ‘-’
in “/config/configuration.yaml”, line 73, column 3
2018-03-23 17:21:46 ERROR (MainThread) [homeassistant.components.automation] while parsing a block mapping
in “/config/configuration.yaml”, line 68, column 3
expected , but found ‘-’
in “/config/configuration.yaml”, line 73, column 3
2018-03-23 17:23:29 ERROR (SyncWorker_2) [homeassistant.util.yaml] while parsing a block mapping
in “/config/configuration.yaml”, line 68, column 3
expected , but found ‘’
in “/config/configuration.yaml”, line 76, column 5
2018-03-23 17:23:29 ERROR (MainThread) [homeassistant.components] while parsing a block mapping
in “/config/configuration.yaml”, line 68, column 3
expected , but found ‘’
in “/config/configuration.yaml”, line 76, column 5
2018-03-23 17:23:31 ERROR (SyncWorker_11) [homeassistant.util.yaml] while parsing a block mapping
in “/config/configuration.yaml”, line 68, column 3
expected , but found ‘’
in “/config/configuration.yaml”, line 76, column 5
2018-03-23 17:23:31 ERROR (MainThread) [homeassistant.components.automation] while parsing a block mapping
in “/config/configuration.yaml”, line 68, column 3
expected , but found ‘’
in “/config/configuration.yaml”, line 76, column 5
2018-03-23 17:30:07 ERROR (MainThread) [homeassistant.components.hassio] starting version 3.2.4
Testing configuration at /config
ERROR:homeassistant.util.yaml:while parsing a block mapping
in “/config/configuration.yaml”, line 69, column 3
expected , but found ‘-’
in “/config/configuration.yaml”, line 72, column 3
Failed config
General Errors:
- while parsing a block mapping
in “/config/configuration.yaml”, line 69, column 3
expected , but found ‘-’
in “/config/configuration.yaml”, line 72, column 3
Successful config (partial)

2018-03-23 17:38:11 ERROR (MainThread) [homeassistant.components.hassio] starting version 3.2.4
Testing configuration at /config
ERROR:homeassistant.util.yaml:while parsing a block mapping
in “/config/configuration.yaml”, line 69, column 3
expected , but found ‘-’
in “/config/configuration.yaml”, line 72, column 3
Failed config
General Errors:
- while parsing a block mapping
in “/config/configuration.yaml”, line 69, column 3
expected , but found ‘-’
in “/config/configuration.yaml”, line 72, column 3
Successful config (partial)

The two automations have to go under the automation heading. You should have one already. That was causing the error before

I know im a pain, im sorry.

so if two have to go under the automation heading I believe you mean

group: !include groups.yaml

script: !include scripts.yaml

automation: !include automations.yaml
  - id: fireplace_on
    alias: Turn on Fireplace
    initial_state: 'on'

is this not correct?

it says mapping values are not allowed here. Line 78, column 7

Yes, that is incorrect. You are basically saying all of your automations are in a file called automations.yaml so they should all belong in the file.

So you have 2 options.

  1. create a file called automations.yaml (or use the existing one if you already have one created) and put the automation config there.
  2. delete the !include automations.yaml and just leave it as automation: and paste the automations underneath

ok, I don’t have any errors but when I tap the switch, nothing happens. Do I need tp place the Boolean in the automations.yaml too instead of in the config yaml?

Input_boolean is on it’s own and should not be in the automations.yaml. If it’s not executing, maybe you have the wrong harmony device number? Make sure you are using the number for the fireplace under the devices and not the activity.

ok, I doubled checked the device number that is correct. I placed the Boolean back into the configuration.yaml

Im not sure what I did but now im getting a error:

Fatal error while loading config: ‘packages’
Failed config
General Errors:
- ‘packages’

Its still not working, ill have to take a break for a few so the wife doesn’t kill me, ill play around with it and come back a bit later.

Seriously Jer78 you are awesome! I understand more now then I ever did. I really appreciate your help so far.

I hope one day to repay you!

Anytime. Feel free to send me a PM with your whole configuration.yaml (redact any passwords) and I’ll help get it working for you. It takes a bit of time but you’ll get the hang of it in time.

1 Like

I am trying to add dyson fan to my logitech harmony hub.
As you have stated above, it turns on perfectly fine using IR but i cant shut it off using
the app. No matter what. Its first generation dyson AM07. no wifi in fan.
I saw your code, not sure where to add it. In harmony app somewhere?
please help me.

Thanks in advance
Ahmar

[email protected]