Using variables for dynamic device notifications?

I have the following piston, that’s attached:

Right now, if a garage is left open, I get a generic message. What I’m attempting to accomplish is for the message to be dynamic and tell me via the push notification, WHICH garage door was left open. I know there are $device, $currentDevice but I’m not sure which, if any, are dynamic that will list the name of the sensor which is causing the piston to be true.

Any guidance is appreciated!

Put devices into one statement and choose any of the devices.
When you are in the window to select the devices go into settings and click on save matching devices to a variable.
You can then specify the variable in your push notification.
Do you need an example or do you want to try yourself.
Posted one anyway. :smile:

@bobbles, thanks for that! That helps! Just curious, from your code, what does the ‘Set piston state…’ line do?

When you look at the dashboard you can see all your pistons listed.
You will see that they are either true or false.
That line changes it to display what you want.
At the top of the piston you will see Disable Automatic Piston State.
This has to be done for it to work.

@bobbles Thanks for that explanation. Am I to assume you are using this because you’ve had issues with the automatic state working?

Also, I adjusted the piston. Is this more-or-less what it should look like?

What would happen if both doors are left open, for example?

If both doors are open then both get written into the variable.
What I would do is change the piston from an IF to a WHILE. Then delete the last task.
That way while the piston is true it will just keep cycling round.
Just a bit cleaner in my opinion.
Shouldn’t matter though.
EDIT : This is what I was talking about for automatic piston state.

So you would do a…

any garage open
wait 5 minutes
send message

That would be my preference.
It just seems cleaner to me.

@bobbles, makes perfect sense. Didn’t realize we had the option to do that. I had advanced features off (the default). Here’s the new version:

[EDIT] I just removed the 10 second wait…no need to have it any more.

1 Like