I do have to mqtt sensors, both with an value like:
'D65304CF9DAE' 'D2B96D03C3BF' 'CC1CCCC2852C' 'F89D695A8C1A' 'F7E75ADFB80E' 'D993112EC433' 'CE12909D670B' 'E7F78A95C7CC' 'C1D18C1AD34E
these are mac adresses of beacons of whish I want to know if they are available.
when I make an automation with the next condition:
- condition: or
conditions:
- condition: template
value_template: >-
value_template: "{{ 'C1D18C1AD34E' in
states('sensor.mqtt_garage_totaal') }}"
- condition: template
value_template: >-
value_template: "{{ 'C1D18C1AD34E' in
states('sensor.mqtt_meterkast_totaal') }}"
- condition: state
entity_id: sensor.mqtt_garage_totaal
attribute: CE12909D670B
state: ""
I can set in ‘actions’ a switch to ‘on’. Works fine also.
in another automation I find out the beacon is in none of the both strings with the condition::
- condition: and
conditions:
- condition: template
value_template: >-
value_template: "{{ 'C1D18C1AD34E'' not in
states('sensor.mqtt_garage_totaal') }}"
- condition: template
value_template: >-
value_template: "{{ 'C1D18C1AD34E'' not in
states('sensor.mqtt_meterkast_totaal') }}"
That also works fine
But I want to make 1 automation from it, so I made via the editor an action with ‘choose’ and copied de conditions in there, skipped the conditions part.
That looks like:
- choose:
- conditions:
- condition: or
conditions:
- condition: template
value_template: >-
value_template: "{{ 'CE12909D670B' in
states('sensor.mqtt_garage_totaal') }}"
- condition: template
value_template: >-
value_template: "{{ 'CE12909D670B' in
states('sensor.mqtt_meterkast_totaal') }}"
sequence:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.fiets_garmt_aanwezig
- conditions:
- condition: and
conditions:
- condition: template
value_template: >-
value_template: "{{ 'CE12909D670B' not in
states('sensor.mqtt_garage_totaal') }}"
- condition: template
value_template: >-
value_template: "{{ 'CE12909D670B' not in
states('sensor.mqtt_meterkast_totaal') }}"
sequence:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.fiets_garmt_aanwezig
And now it does not work anymore. The log tells:
result: false
entities:
- sensor.mqtt_garage_totaal
(that is one of the two sensors I wanty to check out)
Thanks for helping!