first I tried single mode on automation 2, but got error: Stopped because only a single execution is allowed
so i tried parallel mode.
Now I get the error: <unknown entity> einschalten
Does it matter that in the 1st automation you are testing sensor.pixel_6_pro_battery_level as a string and the 2nd automation you are testing sensor.pixel_6_pro_battery_level as a number ?
Trace would be helpful.
In your first automation you are using the
is_home condition in the second automation you are using home. This doesn’t look right to me.
What are you trying to do exactly with this automation?
I dropped using two automations for turning something on or off because I find it unreliable. I use single automation with choose actions and helpers as needed to restart some counters.
when the battery level changes. Your tiggers will only fire when your battery level is equal to 100 or when it crosses the threshold from above 90 to below 90. It will not trigger if your already below 90 and it moves further below 90.
Try this version and let me know if it fulfills your requirements. The trigger continuously monitors the states of all three entities (sensor, switch, and device_tracker). In other words, not at a fixed polling rate of every 5 minutes like in your version, but at the very instant when any of the three entities changes value.
alias: Pixel 6 Pro
description: ""
trigger:
- platform: template
value_template: >
{% set bl = states('sensor.pixel_6_pro_battery_level') | int(0) %}
{% set sw = states('switch.ladegerat') %}
{{ (bl == 100 and sw == 'on') or (bl <= 90 and sw == 'off')
and is_state('device_tracker.pixel_6_pro_mob', 'home') }}
condition: []
action:
- service: "switch.turn_{{ 'on' if states('sensor.pixel_6_pro_battery_level') | int(0) < 90 else 'off' }}"
target:
entity_id: switch.ladegerat
mode: single
max_exceeded: silent