Can you disable a sensor?

Ah. Is there no way to automate getting the token? Then you could use the scan_interval: setting for a sensor.

Another option might be to have an automation that turns this automation off if it’s been active for 24 hours?

Automating the token is no problem, point is I don’t want an active session 24/7. The use case is a wifi thermometer I use for grilling (longer sessions) which I’m obviously not doing super often.

So my ideal situation would be to flip on an input_boolean “I’m grilling!”. This would trigger the authentication, start my 24hr token window, and also start the rest sensors to start polling (getting probe temperatures). Then when I’m done I could turn off the input_boolean and the sensors would stop hitting the api. Then my session token would naturally expire.

I could probably do this a super manual way with more commands and custom fake entities with manual value updates etc. but it would be nice to use the components…

If their is no current way of doing this I might look into implementing a turn_off/turn_on with initial_state similar to automation if there is interest. I feel like it makes sense for api calls as some have limits or have particular use cases where the info is not needed on regular intervals.

Here’s some extra context:


I’m in a similar situation with the UK Transport sensor. It polls the API all day, with a max of 1000 requests per day, so once every 87 seconds. I am only interested in two “windows” where my train to and from work runs, so wanted to disable the sensor over night and during the day outside of those two windows to stop spamming the API server for no reason.

Also, due to the limit, the polling takes longer the more trains you add, so by limiting it to just two shorter windows, you’d be able to keep the poll rate higher for longer.

Would also love this capability. I only need the sensor when my device is turned on.
My logs just fill with errors when it’s off

1 Like

@azeroth12 - I hope you don’t mind but I’ve moved this to the Feature Requests section.

I found this thread searching for the same thing. My use case is thus:

I have just set up a minecraft server on my device for the kids, but I don’t want the server running 24/7. I have a sensor that monitors the server that I want to be active when the server is up, but disabled when it is not.

Ideally I would like a couple of buttons on the interface that I can use to activate the server and enable the sensor, then deactivate the server and disable the sensor when no longer required.

I have the same feature request but for another use case, that must be pretty common.

I don’t want the camera to be visible/display in home-assistant front-end when someone is at home.

Couldn’t you do that with Group Visibility?

I could totally do it with group visibility, I’ll just wrap my camera in a group.

Thanks for the reminder, haven’t though about it :smiley:

Any luck finding a solution? Will try group visibility tonight, but I would think the sensor would continue to poll the API in the background whether you see it on your dashboard or not.

Here is one more scenario where this feature can be tremendously helpful…
I use snmp to get info about my network printer… it overloads Pi cpu with about 15%… the toner and other consumables won’t run out over night, so I would like to poll info one or twice per day …
as well as few other scanners that are cpu demanding … that I’d like to control the same way

shouldn’t be that hard to implement a native enabled / disabled flag into each ha sensor! i agree this should be added…

As of 0.81 there’s now a homeassistant.update_entity service. You can set a really long scan interval for your entity, and then use an automation to update it.


“How long” is the question I cannot find the answer to. What is the maximum scan_interval?

1 Like

The answer would be in the source. Following that to the Python docs says that the limit is probably 999999999 days.


When you said a “really long” interval, you weren’t exaggerating! Thanks for figuring that out!

Had the same problem with arlo cameras… have 80 signal strength an battery sensors but the cameras are PoE connected :wink: so I’ve 160 useless sensors. (but 6 with battery) …

So, any way to disable these 160 or enable these 6?

THX a lot,

Same problem here. I have a multimedia server and glaces sensors to monitor it. I would like to disable glances sensors when the remote system is off. Otherwise my log every 3 minutes spit out this:

2019-01-02 09:10:43 ERROR (MainThread) [glances_api] Can not load data from Glances API
2019-01-02 09:10:43 ERROR (MainThread) [homeassistant.components.sensor.glances] Unable to fetch data from Glances
2019-01-02 09:10:43 WARNING (MainThread) [homeassistant.components.sensor] Platform glances not ready yet. Retrying in 180 seconds.

In alternative, is it possible to do the trick with automations? How?

Thank you!

I have a similar use-case to this. I only get 20 API calls per day on SolCast solar estimates, so would like to limit the sensor to polling only during daylight hours kor less in reality) . Even with 1 hour intervals, I obviously run our each day, the the midnight restart is actually mid-morning.

I’m not sure if this will fit your case but I do this:

it would be good to be able to disable a sensor, or have one not try to update if something is offline. In my case, I’d like to have transmission and sabnzbd not poll if my media pc is offline.