Hello Everyone,
I’m trying to turn on my printer if there is a printjob in queue, but i need to check two things.
If the state of the value of the sensor that triggered the automation is not null and is not unknown
Currently i have this :
alias: 'Imprimante : Allumer si impression en attente'
description: ''
trigger:
- platform: state
entity_id:
- sensor.pc1_printjob
from: '*'
to: '*'
- platform: state
entity_id:
- sensor.pc2_printjob
from: '*'
to: '*'
- platform: state
entity_id:
- sensor.pc3_printjob
from: '*'
to: '*'
- platform: state
entity_id:
- sensor.pc4_printjob
from: '*'
to: '*'
action:
- if:
- condition: and
conditions:
- condition: template
value_template: '{% if(states('sensor.{{ "trigger.entity_id" }}')) %}{%if (states('sensor.{{ "trigger.entity_id" }}')!='unknown') %}True{% else %}False{% endif %}{% else %}False{% endif %}'
then:
- type: turn_on
device_id: xxxx
entity_id: switch.imprimante
domain: switch
mode: single
Can somebody help me?
Thank you.