Hey guys!
I have load cells under my bed to detect if someone is laying in the bed or not. Since it’s a big bed with two mattresses, there are two sensor entities, one for each side.
I noticed a problem with using absolute values in comparison:
if bedsensor left changes to lower than 20 kg, enable the light
If my wife lays more on my side than on hers, the sensor triggers. Additionally the sensor value changes over time, it’s not zero anymore when no one is in the bed, it’s about 5 kg now.
Therefore I thought of using relative values.
My problem is how to get a specified older value (like two seconds before), because the sensor might not change its state abruptly but „stepwise“ - so a comparison with from_state.state
is not a reliable solution.
Is there a way to retrieve previous values of a sensor?