Good morning routine failed again

Normally, events will only arrive to CoRE if stateChanged is true. There is no initial global variables - those are user variables you define yourself. There is a list of system variables, find it in any piston, under Local Variables - or in the dashboard. In order to do what you want, a THEN IF piston is probably best, where the main IF triggers the action, whereas the secondary IF builds the message and performs the actions - enable expert mode and use when true/when false actions to add text to the message and do actions as you go along.

IF
   Mode changes
THEN IF
   Door is locked
      > when true, using location, set doorMessage = 'door was already locked'
      > when false, using door, lock, set doorMessage = 'locking the door now'
   AND
   Light is on
      > when true, using light, turn off, set lightMessage = 'turning off the light'
      > when false, using location, set lightMessage = 'light was already off'
   etc...
   AND
   Time is any time of the day <<< DUMMY condition to allow for the final message assembly and delivery
      Using location...
         > Set message = doorMessage + lightMessage + ...
         > Send notification '{message}'

Enable expert mode to get the when true/false.

1 Like

@ady624, I think expert mode is exactly what I’m looking for. To clarify, doorMessage and lightMessage, in this case, are variables that I will then call at the end of the piston to give me one cohesive message?

[EDIT] Looks like you just added that in the code! I am so pumped right now. Thank you so much! Finally, this may add stability to what I’m using. You’re awesome man, thanks so much!

Correct. You can also concatenate them in the notification itself:

Send notification 'Routine ran, {lightMessage}, {doorMessage}, blah blah'

I can’t say you are alone here, my routines have been hit or miss for two months now…

2 Likes

Great advice on this. I am now using CoRE to perform all the actions on Routine execution.

Thanks,

1 Like

Feel free to post your postings for others to see, especially the ones with the messages. I’d like to see how you made it work… And I’ll put it on the wiki.

Am I correct in saying the strategy here is to configure a piston for each routine.

If Routine X is executed
Do 1,2,3,…

So the issue isn’t Routines being fired by event or time, it’s the actions the routine takes, is that what we are saying?

1 Like

Correct.

I have a slight variation. I have a routine trigger piston that watches all the routines and calls a specific piston when a specific routine is executed. However you build it, the results are the same.

You take all responsibility away from SmartThing’s Routines because they are an abject failure and ST hasn’t demonstrated meaningful effort to fix them.

How and where in CoRe do I set this up?

It’s in any action. You probably need Expert Mode enabled to get the Begin IF block, Begin Else block, and End IF block