Newbie here using Hassio

#1

I am trying to get some directions or guidance on how to setup some automations in Node Red that will work in Hassio. I have been stumbling through yaml and made a couple of automations that worked and now are no longer working. i was hoping to test in Node Red but little "Green" to say the least. I have (4) device_trackers that I track their location and complete automation when they arrive home. Any suggestions would be great. I have attached code in yaml.

- id: '1536977150329'
  alias: Open Garage Door
  trigger:
  - platform: state
    entity_id:
      - device_tracker.xxxx
      - device_tracker.xxxx
      - device_tracker.xxxx
  condition:
  - condition: state
    entity_id: cover.my_house
    state: closed
  action:
  - entity_id: cover.my_house
    service: cover.open_cover
    
    
- id: '1536977383518'
  alias: Close Garage Door
  trigger:
  - entity_id: device_tracker.xxxx
    platform: state
    to: home
    for:
      minutes: 5
  - entity_id: device_tracker.xxxx
    platform: state
    to: home
    for:
      minutes: 5
  - entity_id: device_tracker.xxxx
    to: home
    for:
      minutes: 5
  condition:
  - condition: template
    value_template: '{{(as_timestamp(now()) - as_timestamp(states.device_tracker.xxxx.last_changed | default(0)) | int > 300 ) and (as_timestamp(now()) - as_timestamp(states.device_tracker.xxxx.last_changed | default(0)) | int > 300 ) and (as_timestamp(now()) - as_timestamp(states.device_tracker.xxxx.last_changed | default(0)) | int > 300 )}}'
  - condition: state
    entity_id: cover.my_house
    state: open
  action:
  - entity_id: cover.my_house
    service: cover.close_cover
0 Likes

#2

Hi @Derekwit, I can't help with the specifics of your question, but I recommend you read this post about sharing code on the forum: How to share code or flow json. You may have noticed your YAML has been treated as markdown and completely reformatted by the forum.

2 Likes