I have the following code in An action but I can’t figure out what is wrong, I can’t get the damn automation to return the correct info, it always return the first message Moteur bloque
Any one can point me to my probably stupid mistake ?
even if I have a return value “Moteur bloque”, the trace say “This step was not executed and so no further trace information is available.”
I know the value returned from trigger.event.data.event_label is “Keypad unlock operation” as i saved the info in a helper to make sure I have something returned from the automation
Like armedad showed you are just stating a string in the first if statement.
So the line if "{{ trigger.event.data.event_label == Lock state: Lock jammed }}" will just read as: if "text" and with no compare it will result in True and this show the first message
You rock… Thank you SOO much, I am just starting learning YAML code and I am an old guy… sometimes it takes a lot of practice and repeat to get something in this head.
As I mentionned to armedad, I am new to all this YAML, i come from Homeseer so a lot of difference.
Would you mind pointing me as to how to work with arrays in YAML if you have some time ? I like to learn and try putting good pratctices right at beginning
no worries, we’re all just learning. there’s always someone more knowledgeable. i sometimes hesitate about answering here because my answers are rarely “the best”
but dujith is right that an array would be better. play around a lot with developer-tools->template it’s a god send for learning.
Ok I think I still need help, I can’t get the action being executed, I tried the following in developper tool and it retruns the correct string: “barree manuellement”
if i try the exact same block of code in an automation where i try to set value to results of the array and look at the traces, the action never get executed:
(i replaced the device_id per xxxx for security)
My final goal being trigger.event.data.event_label replaces the hard coded entry text “keypad lock operation” that I tried for testing purposes as I can’t find how to construct the request would it be: