I have smart socket on this socket is connected electric extension cord. On this cord are connected following devices: TV, Nvidia Shield, Denon Receiver, Speakers …
These devices in standby mode takes 40Wats of energy (together), because I want save the energy, in automation, I am turning off the smart socket in night and when I am at work.
Problem:
When devices are turned off, HA wants connect to devices and it generates many errors and warnings in log file.
Expected:
Is it possible create automation, where I set: IF smart socket is turned off, do not contact following devices ?
Is HA generating errors because you have automation that is trying to read the devices but because the socket is off it cannot? If that’s the case then you just need to add a condition to your automation to only run if that socket is on. Or a condition in a script. Or a condition in a pyscript. Whatever it is that you added that is trying to reach devices on a powered down switch.
If the problem is because you are using, say, a Denon Receiver integration and that is polling the device and generates an error because the switch is off, I don’t see what you can do about that unless you contact the author of the integration or dive into the code yourself to prevent it from polling.
If the worst part of this is the error messages, and it’s not really causing a problem in HA, perhaps you could just turn off errors for that integration via the configuration.yaml file:
logger:
default: info
logs:
custom_components.denon_receiver_extension: fatal
homeassistant.components.yamaha: critical
This workaround will not help me - turn off logs for integrations. I want see problems in integrations log files but not if they are cut off from electricity. Also logs are only consequence of repetive try to connect HA to devices.
I was just offering that as a work-around until HA could incorporate such a feature (probably long wait) or the integration developer changed their code (who knows).
In the end, though, what you really need is a toggle to turn the integration on and off because when you think about it, the integration is doing precisely what it should: giving you an error that it could not reach the device.
Hello @perseus177 , I’m actually facing exactly the same challenge.
I have a camera plugged on a connected electric switch and I would like to deactivate the integration/device when the power is off.
Right now I’m having logs error because the device fetch is failing. As suggested by @CO_4X4 I’m not logging this error now, so the log is clean, but I’m still bothered by the fact that the integration is still trying to fetch the offline device.
Any finding on this situation on your side? Any solutions found ?
Since version 2021.3.0 you can manually enable/disable an integration via the UI.
Ideally, you could disable/enable the integration with a service call (disable when camera is turned off, enable when camera is turned on). However, currently, this service call doesn’t exist.
Thank you for the reply.
Indeed manually I can, my struggle is to find a way to do it automatically, through a script or an automation. So when I put the device offline, I can also deactivate the integration so it will stop fetching the device.
I’ve got the same problem, which for now, I’m going to work around by disabling logging warnings for the affected integrations. However, this isn’t ideal for two reasons:
I have some devices that use the same integration, but aren’t powered off, and I don’t want to kill them (or their logs) too.
I still want to see other warnings from the devices when they are powered on, so I don’t want to disable their logs permanently.
I don’t see an easy workaround for the first problem, unless there is some way of configuring logs on a per-device basis rather than per-integration.
Is there any way of dynamically changing the logging configuration, so I can block warnings just when some of my devices have been switched off?
I’ve created a feature request for a service to enable and disable devices, or any other convenient way of solving the problem. If anyone else has this issue, please add your vote!
As mentioned, manually re-enabling a disabled entity is broken and has been broken for over a year and no one is interested in fixing it. A service to do the same thing will encounter the bug.
The best scenario is that whoever implements the service also investigates and corrects the underlying problem. However, given how long this bug has existed, that seems like wishful thinking.