How to perform multiple actions

I’m sure this is something incredibly simple but i can’t see what i’m looking for anywhere. I have HASS talking to my Logitech Harmony Elite, which in turn is talking to some cheap LED Strip Light which i have learnt all of the commands from.

What i would like to do is turn on the lights “PowerToggle” and then issue a second command “White” to change the colour to white.

automation:

  • alias: “Kodi Media Player Paused”
    trigger:
    • platform: state
      entity_id: media_player.kodi
      #media_content_type: VIDEO
      from: ‘playing’
      #condition:
      #- condition: state
      #entity_id: sun.sun
      #state: ‘below_horizon’
      action:
      service: remote.send_command
      entity_id: remote.Harmony_Hub
      data:
      device: “44749259”
      command: “PowerToggle”

whenever i try to add a second command i get errors like “duplicate service”

1 Like

Add dashes “-” to each service and indent them accordingly. So it would look something like this:

action:
  - service: remote.send_command
    entity_id: remote.Harmony_Hub
    data:
      device: "44749259"
      command: "PowerToggle"
  - service: notify.notify
    data:
      message: "Power Toggle"

See here for other examples:

1 Like

thank you, working perfectly

I’m still having problems with this, just testing the commands in a script for now, and the second command never seems to work.

#LED Lighting
script:
  lighting:
    sequence:
      - service: remote.send_command
        entity_id: remote.Harmony_Hub
        data:
          device: "44749259"
          command: "PowerToggle"
      - delay: 00:00:02
      - service: remote.send_command
        entity_id: remote.Harmony_Hub
        data:
          device: "44749259"
          command: "Blue"

The other issue i’m getting in my automation is an error

2017-07-18 05:52:26 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: required key not provided @ data[‘trigger’][1][‘platform’]. Got None. (See /home/homeassistant/.homeassistant/configuration.yaml, line 144). Please check the docs at https://home-assistant.io/components/automation/

automation:
  - alias: "Kodi Media Player Paused"
    trigger:
      - platform: state
        entity_id: media_player.kodi
        #media_content_type: VIDEO
        from: 'playing'
    #condition:
      - condition: state
        entity_id: sun.sun
        state: 'below_horizon'
    action:
      - service: remote.send_command
        entity_id: remote.Harmony_Hub
        data:
          device: "44749259"
          command: "PowerToggle"
      - delay: 00:00:00:50
      - service: remote.send_command
        entity_id: remote.Harmony_Hub
        data:
          device: "44749259"
          command: "Blue"

If you send the “blue” with the device already on, does it work? Be sure you’ve got the correct command - you can look at your harmony_xxx.conf for commands available to each device.

With that second issue - you’re not commenting out the whole block. I wonder if that’s causing a parse error. Use # to comment out the whole condition.

The Blue command definitely fires on it’s on. just doens’t seem to like follow the powertoggle command. Changing the delay out to 5seconds had no impact either

Are you seeing any homeassistant.log errors? That delay format seems off. I think it only does hours:minutes:seconds – not milliseconds.

Thanks again for the assistant. I think it was a combination of the delay format being wrong and the partially commented automation task below.