Thx for your answer.
I think that’s not the issue because it’s working with the style i wrote it and if i use your code or the GUI,
on save the yaml get’s changed to the style from OP:
Every single state change will have a new_state. It’s part of the definition of the object, so is defined will not work. checking for is not none should do the trick.
I dont know any other solution to trigger an all “smoke” device_class devices.
That’s an solution i have here from the forum.
If i add any device which has the wanted device class, it’s automatically included in the automation.
Sure that would work, but when i’ll add an device (ex.: replace smoke sensor → remove old, add new) and forgot to add them in the group, in the WORST case there could be an undetected fire.
Will my current trigger affect performance?
May @petro can bring light into it
When I add new sensors to my system I generally make sure they work.
In this case, I assume you have a button to test the smoke detector, which then fires an event/changes a state or something.
First I would make sure the state/event works, but I would also want to make sure the automations function.
I personally would not see this as an issue. Since I would check before I installed the device in it’s final position.
Is all your automations created this way?
EDIT:
Just to give some context, I listened to state_changed events for 10 seconds in a home where nothing really is used at the moment.
No doors opening or closing, no media players running, no intentional zigbee traffic.
Remember… 10 seconds.