Automation to disable/enable entity?

Is there a way to make an automation to disable an entity? for example when I turn of the light to disable the yeelight lamp?

2 Likes

Saw you didnā€™t get any responses. Iā€™ve come here to find out the same thing.

My use case is that I have a bunch of outdoor switches that I use during the holidays. I donā€™t want them to show up in my UI anywhere when itā€™s NOT the holidays. So, Iā€™d like to be able to disable them with an input_boolean and re-enable them when it is the holidays.

From what Iā€™ve found, you can only enable/disable via the UI. You can probably write a script to do it by editing the entity database, but probably not for the feint of heart.

1 Like

Iā€™ve got same problem. As a workaround to put my TV in sleep mode I have to disable the polling of the API for at lease 2 minutes, I can accomplish this by disable the (2) entities the integration provide, but unfortunately I can do this only on the GUI and not with a ā€œserviceā€.

There is no way to do this

Good idea though. It would be pretty handy to have a service to disable/enable an entity. Both for this use case as well as being able to write a quick script to disable or enable entities in bulk (a very frustrating task today).

Can you add this as a feature request?

I agree, it would be nice to have this.

The only caveats I see are that the entity_id wonā€™t be in the states machine when itā€™s disabled, so this might be something thatā€™s easier said than done. I could see this making it limited to things that are in the registry with a unique_id.

Iā€™d also like a service to disable entities. My reason is the new Inovelli Blue Zigbee switch creates over 100 entities for each switch (using Zigbee2Mqtt). Iā€™d like to disable most of those.

Could this be done using the REST API or similar? Could this be done using a custom integration that exposes a single service?

This would be great. I have my air conditioners connected to HA via MEL Cloud. In winter I disconnect the breakers of the AC, so my HA log is showing continuously errors coming from MEL CLoud integration as it cannot connect with the machine.
In addition, the climate entity does not refresh, so the the temperature is locked at the last temperature registered in September, so when I ask Alexa, the mean temperature that it gives me is not the real temperature.
I would like an automation so when I activate ā€œwinter modeā€ (a switch), HA disables MEL Cloud integration.

1+ on this feature request. Hereā€™s my use case:

My child has 2 gps trackers attached to her ā€˜personā€™, a phone tracker, and an Apple Watch tracker. When she goes to school, she wears her watch, but leaves the phone at home. While sheā€™s at school, her person geolocation alternates between school and home. I want to make an automation that will use the Apple Watch tracker to trigger disabling the phone tracker when she enters the school zone. Then an automation to enable the phone tracker when she leaves school.

Just build a template sensor that uses the gps attributes based on those conditions. Then attach that to her person.

Thanks petro. Iā€™ve been meaning to learn templating, but just havenā€™t gotten there yet. Is this something I need to do via yaml, or can I do it via the UI with a helper?

I have the exact same use case for those inovelli blues.

I went ahead and created a HACS integration that provides general service for updating entity configs at GitHub - amosyuen/ha-registry: Adds services for home assistant registry operations.

I also created a script that uses it to configure my inovelli blues. Home Assistant Configure Inovelli Blue Script Ā· GitHub

1 Like

I believe this is now possible using Frenkā€™s Spook HACS custom component

2 Likes