I like the idea, and it would help me in some scenes that I can’t do without creating MQTT topics to temporarily store values…
I’m just thinking that calculating a difference is a useful but specific case. One might want to calculate the average too, for example…
To make the feature more flexible, we could perhaps enrich the action ‹ retrieve last state ›: it would become ‹ retrieve the state of a device › with the current parameter to choose the device and a new parameter to choose the time: ‹ last state ›, or ‹ state x seconds/minutes/hours ago ›, or ‹ state at a specific time: hh:mm ›.
This would allow, for example, retrieving the state 1 hour ago and the state 2 hours ago, and using the difference between the two values in one of the actions that already includes calculations.
And it would also allow computing averages… or comparing the current state with the state at a reference time,…
I like the idea you’re proposing and indeed what I suggest is a specific case that can be improved by retrieving value states at a given instant t, but I don’t know if for @pierre-gilles it falls under the same use case
I think you’re right, @pierre-gilles: let’s keep that request focused on the specific need for the difference between two dates. And I’ll move my suggestion to the other thread…