Piston to set variables on Location Mode change stopped functioning

variables
locationmode

#1

1) Give a description of the problem
I have a piston that updates 2 global variables when the Location Mode changes, but it is not updating the variables

2) What is the expected behavior?
I expect ‘@lastMode’ to be updated with the previous mode, and ‘@newMode’ to be updated with the new mode change.

3) What is happening/not happening?
One or both of the variables do not appear to be updating.

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)


#2

Try changing the global variable types to string.


#3

Run the piston again, maybe @newMode was not set and that was inherited into @lastMode? You need at least two runs for @lastMode to have valid data.


#4

The problem had been that @lastMode never appeared to update, like Good Morning routine would run, which should result in @lastMode = Night, @newMode = Home, but @lastMode would still be Away from arriving home at some point.

I’ve changed the variable types to string, and will see if that helps once we get a mode change at home.

Current state is:
@lastMode = (not set)
@newMode = Away


#5

I let it run a few more times, and currently, after we returned from being away, the variable states are:

@lastMode = Away
@newMode = Night

the state should be:

@lastMode = Away
@newMode = Home

I also bumped up logging to Full, and here’s what it’s showing now:

image


#6

I was going to try re-setting this up today, and noticed something… I’m setting @newMode to the variable $locationMode, not the state of the virtual device Location Mode.

Here’s a screenshot of the two setups next to each other:

image

I’m going to try making this change (to the 2nd way), and see if it helps resolve the issue.


#7

Looks like it’s still not updating correctly after my last change:

image


image