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

Using trigger.idx to index a list

$
0
0

I’ve got the following automation that works well enough:

# Security - Motion
# if motion is sensed
# when no one is home or we're in bed
- alias: motion?
  trigger:
    platform: state
    entity_id:
      - binary_sensor.living_room_motion_motion
      - binary_sensor.dining_room_motion_motion
      - binary_sensor.upstairs_motion_sensor_motion
    from: 'off'
    to: 'on'
  condition:
    condition: or
    conditions:
      - condition: template
        value_template: "{{ states('group.family') != 'home' }}"
      - condition: state
        entity_id: input_boolean.in_bed
        state: 'on'
  action:
    - service: notify.mobile_app_russ_phone
      data:
        message: '{{ trigger.to_state.name }} motion'

It gives a much-more-verbose-than-I’d-like message like “binarary_sensor.living_room_motion_motion motion”.
What I’d like to do is use trigger.idx to index into a less verbose list of device names, but I’m not quite sure how to set up the list so that less_verbose_list[trigger.idx] would return something like “living room”.
Any suggestions?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 106864

Trending Articles



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