Hello,
I’m trying to setup an AND condition based on variables values without success so far.
- id: d1b2862b-fbfe-408c-ad59-3a5d7c528ecd!
alias: Store DZ light slider value
variables:
indexes:
388: input_number.idx388
377: input_number.idx377
387: input_number.idx387
44: input_number.idx44
389: input_number.idx389
256: input_number.idx256
entity: '{{ indexes.get(trigger.topic.split(''/'') | last | int(0), ''unknown'')
}}'
trigger:
platform: mqtt
topic: domoticz/out/#
condition: '{{ trigger.payload_json.nvalue !=0 }}'
action:
service: input_number.set_value
target:
entity_id: '{{ entity }}'
data:
value: '{{ trigger.payload_json.svalue1 }}'
The above code works but I need to add a second condition.
I tried many flavors like:
condition: '{{ trigger.payload_json.nvalue !=0 }} and {{ entity != "unknown" }}'
or
condition: and
conditions:
- condition: '{{ trigger.payload_json.nvalue !=0 }}'
- condition: '{{ entity != "unknown" }}'
What is the proper way of doing it?
Thank you