OH 3 - .previousState(true).state

I’m wondering what I’m doing wrong here, it’s erroring out.

error:

persistence.HistoricItem.getState() on null

persistence:
everychange

item (not tied to a channel):
String		ClothesWasher_Proxy						"Clothes Washer is [MAP(clotheswasher_proxy.map):%s]"			(WeMo)

rule:
ClothesWasher_Proxy.previousState(true).state == 'Running'

Any guidance would be appreciated.

Best, Jay

You’ve allowed the previousState() method to use your default persistence service, as specified in system settings. Which one is that?
If you don’t know, it is probably rrd4j.
rrd4j does not persist Strings.

Sorry, forgot that piece of info.

It’s → rrd4j

Best, Jay

rrd4j cannot store strings. You will never get a previousState from rrd4j that == 'Running. You need some other persistence service for that. And MapDB won’t work because it only saves the most recent state.

1 Like