If then else, variables, and subroutines
When a routine is triggered (e.g. motion detected) i would like to be able to run one of multiple possible routines (sub routines) depending on variable i could set in others.
For example i run a routine when i go to bed that turns off my lights and plays soft music for an hour. I would like to be able to also set the variable $inbed = true and then in my motion detected routine have if $inbed then table light on else all lights on and then my wake up/alarm routine can set $in_bed = false as well as turning on my lights and playing an alarm sound.
Stephen Thomas Hooper commented
This would be useful for lighting control based on ambient settings.
Eg. Walk into the bathroom and occupied flag is set, then turn on the light IF ambient level is low.
Also run the extraction fan for longer if occupied for longer than X seconds.
Yes this 👍
Imagine the routines you could write if you could get Alexa to take a response, stick it in a variable and allow you to apply your own logic on it and feed it back in to the routine.