Item changed / How much did it change?

Hey guys,
I am wondering if anyone has done anything with being able to determine how much a value has changed?

For instance. I have an item that is currently watching the value of a house. I have a rule that notifies me when that value changes. But I would like to know as well how much it changed from the last value.

Any thoughts?

If you use persistence you should be able to get the previous value and do whatever you need to do to work out how much it has changed by.

I have mysql persistence setup. Do you have an example of how I get that previous value?

I have a rule that sets the away temperature when it detects I’m no longer home and a rule that sets it back to the previous value when I return. Here’s a snippet:

var varPreviousState = bedroom_temp_target.previousState(true)
logInfo("presence ON", "previous state: " + varPreviousState.state.toString)

Got it! I now have an item and a rule the monitors the value of my house and tells me when the value changes and how much it changed. All using the zillow api.

Now I get notices of when to be sad about how upside down I am on my house. :laughing: