Ability to start and stop a sensor

As the subject says, I would like the ability to start and stop a sensor?
I’m thinking especially of those that use an api key with a limited number of requests per day.

I’d think better of enabling/disabling a sensor/switch/lamp, etc.

This would avoid cluttering your HA log with errors you know are already there because the device is physically disconnected.

1 Like

I would instead set the scan_interval to a longer period.

I would fix the error (restore the device) or remove the sensor. What real life example are you thinking of?

Not all devices/platforms use scan_interval, so this is not a universal solution.

Imagine that you have a smart plug which you use only to control a heater which is obviously not there during spring+summertime. Or a smart lamp which is turned off in the physical switch inadvertently.

I know I can simply remove them from config, but this is something that I think it might be useful in some cases.

Hi,

I also look for such a possibility to turn on/off the scanning of a sensor via automations. My real life example is my wifi LED controller. I control the power for the LEDs and the controller via a 433MHz power switch (I don’t want the LED power supply being plugged in when I am not home). When I turn the power off, the wifi LED controller is not available in Homeassistant and the corresponding component throws timeout warnings. Increasing the scan_interval is also not convenient, because then the current state of the LED controller is not updated reliably when I use it.

Therefore, I’d vote for this change. I also found very similar feature requests inside the forum when searching for a workaround.

I literally just thought about this same feature this morning. Scan interval doesn’t always fit the use case. Especially when you only need the sensor to work at a very specific time or length of time.

I have thought this for a long time but what prompted me to raise this feature request was the UK Transport sensor. The api allows 1000 calls a day so the sensor automatically adjusts the time between calls depending on how many instances of the sensor you have.


I would actually go further with this feature request to the effect that in order to become an ‘official’ component all sensors should (must?) have all of:

  1. a user configurable scan interval
  2. at least one user configurable ‘on’ period
  3. the ability to be turned on or off from within HA
    and ideally,
  4. have the ability to dynamically set 1 and 2 from within HA

HA is really largely the sum of it’s sensors so it surprises me that the framework for creating them is not better featured by default. Unless of course it is and it is just that some sensors don’t implement all the features available.

Point 2&4 is implicitly given when point 3 is possible via a service and you use automations. So in my opinion, the request reduces to a service that enables/disables sensors (or sensor updates) or even better general components.

Yep. Fair point.
And to make it worse (from my point of view) point 4 virtually says as much.

I won’t edit my post to cover my stupidity. :sunglasses:

There is FFmpeg Motion Binary Sensor (https://www.home-assistant.io/components/binary_sensor.ffmpeg_motion/). It is obvious that you don’t need motion detection running 24/7. You use it, when you are not expecting any motion. When you know, there will be motion in the scene, you switch it off. Is there currently a way to switch it off?