Hello everyone. I am doing an automation so that when the printer changes color it sends me a message. When I run the automation the message arrives but it seems to ignore the status that goes from true to false. Does anyone see any errors? What I am doing is asking that they all go from true to false or that when one of the four sensors changes state, does it send the message? Thank you so much
alias: Cambio filamento AMS
description: ""
trigger:
- platform: state
entity_id:
- sensor.ams_1_tray_1
attribute: active
from: "true"
to: "false"
- platform: state
entity_id:
- sensor.ams_1_tray_2
attribute: active
from: "true"
to: "false"
- platform: state
entity_id:
- sensor.ams_1_tray_3
attribute: active
from: "true"
to: "false"
- platform: state
entity_id:
- sensor.ams_1_tray_4
attribute: active
from: "true"
to: "false"
condition: []
action:
- action: notify.mobile_app_pixel_7
metadata: {}
data:
title: AtenciĂłn
message: Cambio de color AMS
- action: notify.alexa_media_echo_dot
metadata: {}
data:
message: Cambio de color AMS
title: Atencion
mode: single
Paste the automation trace here and the values from the attributes from the developer tools. We can not tell what the device does by just looking at the automation.
You are saying the state goes from true to false, but you are checking for attribute active, not the state. If the state is a binary sensor, on or off would be what is expected. Also you are testing the attribute for a string “true” or “false”. It depends what the type of the attribute you are testing for actually is, but these strings also seem unlikely.
If it is the attribute you should be looking at then I believe you can remove to and from on all of the triggers.
You essentially trigger on all state changes anyways.
It shouldn’t matter, but I wonder what happens if you remove the quotes from true and false. You could also try if removing the from works, there might be a short moment in between that the value is something else. If it works, the trace would tell you what it was.
It works without the quotes. If so, there may be a home assistant error. I did not write the automation but rather it was created from the visual environment
The automation editor assumes strings, so it adds the quotes. That is true for states, but not always for attributes, because those can have other types. What I do not understand is that if the attribute were a Boolean, the values would be True or False, not true and false. But anyway, maybe something strange happened where the quotes were considered part of the string, or something else. I’m just glad it worked.