So, what’s the point of the input_boolean? It seems like you are just turning that on and off for the second automation to fire. But to me, it seems like this can be simplified into a single automation. Is there a reason for having 2 automations?
This is what a single automation would look like:
- id: lenge_nok_borte
alias: Lenge nok borte PIR gang
trigger:
- platform: state
entity_id: group.tracker_group_borge
to: not_home
for:
minutes: 5
condition:
- condition: state
entity_id: binary_sensor.neo_coolcam_battery_powered_pir_sensor_sensor_2
state: 'on'
action:
- service: scene.turn_on
entity_id: scene.stuekjokkengang_medium
I’m not following you. I don’t see how home and not_home have anything to do with the input boolean. All the boolean was doing in your automation is turning on then turning off.
I am sure you are right. My point is that with your code I will not be able to trigger the PIR, since when I am back at my home again my gps status will say “home” - and therefor it will not turn on the lights.
I was just thinking I could use a input boolean to make something tell the system that I have been away and was not returning - so now it should activate the light when I trigger the PIR.
you should change the trigger in the second automation.
This should be the PIR, not the status.
As you said, the scene should be triggered when the PIR get motion, under the condition, you are away for > 5 minutes:
alias: Lenge nok borte PIR gang
initial_state: true
trigger:
- platform: state
entity_id: group.tracker_group_borge
to: not_home
for: 00:05
action:
- service: input_boolean.turn_on
entity_id: input_boolean.borte_lenge_nok
- id: sla_paa_lys_pir_gang
alias: Lys Gang på via PIR
initial_state: true
trigger:
platform: state
entity_id: binary_sensor.neo_coolcam_battery_powered_pir_sensor_sensor_2
to: 'on'
condition:
- condition: state
entity_id: input_boolean.borte_lenge_nok
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.borte_lenge_nok
- service: scene.turn_on
entity_id: scene.stuekjokkengang_medium
I tried your code, in the second automation I get a validation error. Could not figure out what was wrong.
Here is the error log:
Invalid config for [automation]: [state] is an invalid option for [automation]. Check: automation->trigger->0->state. (See /config/configuration.yaml, line 118). Please check the docs at https://home-assistant.io/components/automation/