So I have a large number of zones that I have set up for my job and I want to track when I stop at the locations so that later I can generate a report for mileage. I don’t have to keep track of the actual miles between locations, I just need to create a spreadsheet telling where I went from and where I went to. For this I have an automation that I am setting up for when I enter and leave the different zones. I have input_boolean helpers set up for each zone that I want to trigger on when I enter the zone an off when I leave the zone. This will allow me if needed to easily track how long I was at each location. This is the yaml for the automation that I have configured. The problem is that it is not triggereing the helpers on and off that I have set up.
Any help is appreciated.
- id: '1723628315460'
alias: trigger on zone enter/leave
trigger:
# Entering zones
- platform: zone
entity_id: person.dan_bemowski
zone: zone.bannach
event: enter
- platform: zone
entity_id: person.dan_bemowski
zone: zone.ben_franklin
event: enter
- platform: zone
entity_id: person.dan_bemowski
zone: zone.bliss
event: enter
- platform: zone
entity_id: person.dan_bemowski
zone: zone.ips_warehouse
event: enter
- platform: zone
entity_id: person.dan_bemowski
zone: zone.jefferson
event: enter
- platform: zone
entity_id: person.dan_bemowski
zone: zone.kennedy
event: enter
- platform: zone
entity_id: person.dan_bemowski
zone: zone.madison
event: enter
- platform: zone
entity_id: person.dan_bemowski
zone: zone.mcdill
event: enter
- platform: zone
entity_id: person.dan_bemowski
zone: zone.mckinley
event: enter
- platform: zone
entity_id: person.dan_bemowski
zone: zone.pj_jacobs
event: enter
- platform: zone
entity_id: person.dan_bemowski
zone: zone.plover_whiting
event: enter
- platform: zone
entity_id: person.dan_bemowski
zone: zone.roosevelt
event: enter
- platform: zone
entity_id: person.dan_bemowski
zone: zone.spash
event: enter
- platform: zone
entity_id: person.dan_bemowski
zone: zone.support_services
event: enter
- platform: zone
entity_id: person.dan_bemowski
zone: zone.transportation
event: enter
- platform: zone
entity_id: person.dan_bemowski
zone: zone.washington
event: enter
- platform: zone
entity_id: person.dan_bemowski
zone: zone.pods
event: enter
# Leaving zones
- platform: zone
entity_id: person.dan_bemowski
zone: zone.bannach
event: leave
- platform: zone
entity_id: person.dan_bemowski
zone: zone.ben_franklin
event: leave
- platform: zone
entity_id: person.dan_bemowski
zone: zone.bliss
event: leave
- platform: zone
entity_id: person.dan_bemowski
zone: zone.ips_warehouse
event: leave
- platform: zone
entity_id: person.dan_bemowski
zone: zone.jefferson
event: leave
- platform: zone
entity_id: person.dan_bemowski
zone: zone.kennedy
event: leave
- platform: zone
entity_id: person.dan_bemowski
zone: zone.madison
event: leave
- platform: zone
entity_id: person.dan_bemowski
zone: zone.mcdill
event: leave
- platform: zone
entity_id: person.dan_bemowski
zone: zone.mckinley
event: leave
- platform: zone
entity_id: person.dan_bemowski
zone: zone.pj_jacobs
event: leave
- platform: zone
entity_id: person.dan_bemowski
zone: zone.plover_whiting
event: leave
- platform: zone
entity_id: person.dan_bemowski
zone: zone.roosevelt
event: leave
- platform: zone
entity_id: person.dan_bemowski
zone: zone.spash
event: leave
- platform: zone
entity_id: person.dan_bemowski
zone: zone.support_services
event: leave
- platform: zone
entity_id: person.dan_bemowski
zone: zone.transportation
event: leave
- platform: zone
entity_id: person.dan_bemowski
zone: zone.washington
event: leave
- platform: zone
entity_id: person.dan_bemowski
zone: zone.pods
event: leave
action:
- variables:
event: "{{ 'left' if trigger.event == 'leave' else 'arrived at' }}"
person: "{{ trigger.to_state.attributes.friendly_name }}"
zone: "{{ trigger.zone.attributes.friendly_name }}"
helper: "'input_boolean.me_at_' + {{ trigger.zone.attributes.friendly_name | lower | replace(' ','_') }}"
action_type: "{{ 'off' if trigger.event == 'leave' else 'on' }}"
- service: input_boolean.turn_{{ action_type }}
entity_id: {{ helper }}
- service: notify.mobile_app_sm_f936u1
data:
message: >
{{ person + ' ' + event + ' ' + zone + ' ' + helper + ' ' + action_type }}
mode: single