I have installed a mmwave sensor near my desk (above my head) to see if I am behind my computer or not. The sensor does a crappy job in telling me “Away” or “Home” though. But when I taker a look at the distance sensor, I can clearly see a lot of fluctuation going on when I’m present.
So I would like to have a binary sensor that can tell me if another entity is fluctuation or not. When it’s stable, it should be false, when it’s changing values, it should be true.
When asking these sorts of questions it helps if you tell us the sensor entity id. Also showing the distance scale on your graph would have helped too. You will have to adjust the sensor entity id, distance and delay time in this to make it work:
Hi Tom, thank you very much for your answer. I think your solution will have a state TRUE when the sensor is above a specific value. That was not quite what I meant.
As you can see in the graph, the flatline is at a different value every time, so I cannot really estimate above what value the sensor should be.
So I was thinking, the only thing I need to know if is the sensor is changing. If it doesn’t change, I have the flat line, and there is nothing detected anymore.
I would think there is a function for this, but while googling I got inspired in another way. An automation can be created on the sensor with only “for”, which will then run when the sensor change change for 5 minutes for example. This could set a helper value. Then another automation could set the helper value once the sensor moves again.
Though, I am not sure if this will use a lot of resources. Maybe I can do something clever with last_update times as well, but I’m not sure if the template sensor is updated realtime then, or only when it’s being looked at.