I am having a bizarre issue where the location.mode is not evaluating to the current mode, more specifically - it is evaluating to the previous mode. I originally thought it was something to do with my program, then that it was something to do with a different smartapp. I ended up unistalling the other smartapps and copied the “keep me cozy” example (but deleted most of the code so the only remaining is checking the state and printing it to the log. Problem still exists.
Here is the sequence I see:
Start app (mode is home), smartapp shows location.mode=home
change mode to away, smartapp shows location.mode=home
change mode to home, smartapp shows location.mode=away
change mode to night, smartapp shows location.mode=home
change mode to home, smartapp shows location.mode=night
Thanks for the comments - I am still learning, and literally just copied that section from the example.
I changed the code for the subscribes. It still acts the same way. I noticed that if I manually trigger through the “trigger now” button, that it updates correctly. Changing the mode immediately breaks the smartapp again…as it states states the previous change once again (the state that was shown with the manual trigger).
I was having intermittent issues with the previous fix. I just made the change you suggested and it appears to work. I will run it a few days to confirm it is solid.
Sorry to resurrect a ridiculously old thread, but how would I go about adding a “current location mode” tile to a DTH. I’m thinking a value tile, simply reads the current hub location mode.
I couldn’t find anything more relevant.
I’m trying to add the tile to a virtual minimote DTH with its button push/held 1-4 assigned to toggle the hub mode manually. I just want to have it within the same DTH so I don’t have to switch from the (virtual) device DH to the “more” tab to see.
I can copy the code here if necessary, but I just want to add this single “display” tile to the DH