i have a mind problem with persitance. I persist an enery counter on every update. now i like to calculate the energy consumption over the day by adding to a base counter all the small deltas over the day.
My idea was: Get the current value when item is updated and then use the previousState() function to get the value before the last update and the caclulate the delta. Straight forwad as i think. BUT previousSate() give me alway the same value than the current stae. I checked that with some variables in my rules. if the current value i N how do i get from the persitence N-1 value.