The codes in the URL have been replaced with xxxx but they were/are identical for each url. I am totally confused why one url works fine while the other does not
Yes!!! The above example is a stripped down version of the actual app. The function resetAtomic() show is identical to the actual code. Removing the line atomicState.previousEnergy=0 will eliminate the error suggesting a problem with assigning atomic state values this way. However…
The “complete” function logData() does exactly the same further down in the code.
.
This atomic assignment does not raise the same error Makes no sense to me
RBoy
(www.rboyapps.com - Making SmartThings Easy!)
4
does it work with state instead of atomicState?
EDIT: Also if I remember correctly setting
atomicState.previousEnergy=0
Will do nothing, previousEnergy will not be stored (it’s got to be a non 0, non null, non empty value for it to save the value to atomicState), unless the behavior has changed in the past few months.
Wondering if previousEnergy is a protect name. Ran into that yesterday trying to set a variable to “switch”. (stab in the dark)
Whats the full error in live logging?
Maybe atomicState.previousEnergy can’t take a number/double. Try sending a string. Maybe it was initialized as a string before. log.debug out its value, same with cumilativeCurrent.
Now that is very possible. I gave up looking for the reason as I found an alternate way of doing this. The only reason for the atomicState.previousEnergy=0 statement is to clear (reset) the old value after the device (and its values such as cumulativeEnergy) itself is “reset” within the Device Handler. I found that this statement was unnecessary and handled it differently.
Thanks everyone for your suggestions and getting me thinking