Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95925

How to use multiple from states (OR) in automation trigger

$
0
0

@mirekmal wrote:

I have somehow specific problem to be solved related to automation of my blinds on harmony activity state change. Basically when I switch off any activity I use harmony remote state change to: PowerOff to trigger opening the blinds. The problem is that when hassio is restarted harmony integration is also changing state from Unknown to PowerOff triggering unwanted opening of the blinds. I tried to filter out this situation by using not state_is Unknown in condition, but it does not work - seems condition is checked after the trigger, so state is already PowerOff and it is not preventing automation to run. So seems solution it to use conditional from in trigger… but I have no clue how to make it, if possible at all. Here is my current code ( not working properly, as described above):

- alias: "Open blinds on turn off"
  initial_state: true
  trigger:
    platform: state
    entity_id: sensor.tv_room_harmony_activity
    to: 'PowerOff'
  condition:
    condition: template
    value_template: >
      {{ not is_state('sensor.tv_room_harmony_activity', 'Unknown') }}
  action:
    - service: shell_command.blinds_up

What I need is something like (do not even know what notation would look like):

- alias: "Open blinds on turn off"
  initial_state: true
  trigger:
    platform: state
    entity_id: sensor.tv_room_harmony_activity
    from: OR
      "Apple TV"
      "Smart TV"
      "Games"
      "Cable TV"
    to: 'PowerOff'
  action:
    - service: shell_command.blinds_up

Is it possible? Could templates be used here somehow? Otherwise the solution would be to have 4 different automations for each scenario…

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 95925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>