core: Reolink integration: IR lights-at-night setting using wrong domain?

The problem

The setting for turning on IR lights at night (either “Automatic” or “Stay off” in the case of my cameras) has an entity that’s in the light domain (for example, light.achtertuin_infra_red_lights_in_night_mode).

I feel that this is incorrect because this setting doesn’t switch the IR lights itself, just the configuration option. It makes more sense to me that the switch domain is used.

Background: last night I noticed all the IR lights of my cameras hadn’t turned on, and found that they were suddenly configured to “stay off”, even though I normally have them configured as “automatic”. It took some time to realise that my automation to turn off all the lights in the house when we go to sleep had also turned off this setting.

What version of Home Assistant Core has the issue?

core-2023.4.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Reolink

Link to integration documentation on our website

https://www.home-assistant.io/integrations/reolink/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 2
  • Comments: 25 (8 by maintainers)

Commits related to this issue

Most upvoted comments

I actually spoke to frenck today and I will be changing the IR light domain from light to switch. I will make the PR in the coming days. Do note that since this is a backward incompatible change, it will not be part of a patch release but will be in a major release. So HA 2024.1.0 would be the earliest.

hello, i have figured out my problem when i found this post…my ir light for my 7 camera turn off every night…i have a automation to turn “all” the light off if i am not home lol…so the ir lights go off and i record black screen for 8 hours…every night, because i put my phone in plane mode for sleeping time…

So i totally agree and think the ir light should be a switch like before, and not member of light domain

for now desactivated this nice automation with “all” attribute…

@robertklep if you can convince the core-homeassistant team I should change it to a switch or select entity, I am more than happy to make the PR to change it (not much effort). But do note that it will be a breaking change.

If we don’t get approval from core-team first, the PR will most likley be rejected anyway.

The PR to change the IR entity from the light to the switch domain is here: https://github.com/home-assistant/core/pull/105916. You can check the progress in the PR.

i had the same “issue” as other in this post, i have several cameras (EZVIZ, DAUHA) and they expose the IR SWITCH as a… switch!!! and because i have an automation that turns ALL light off if nobody is at home, this generates some issue… there is some “workaraound” but it would be more conveninet if this entity will be on the right domain: SWITCH !!! maybe it is time to “review” that decision by the core-team?

image This image is from a Dauha integration. It shows the Infrared as a switch. There is no sensor showing if the light is currently on, only a switch.

Just spoken to Frenck and there is a case for both worlds.

In my opinion this would be the best solution for both worlds:

  • Add a light sensor for the ir light so you can see which state the ir light is (if possible)
  • Change the current ir light control to a switch to control the ir light to be turned off/on during dark hours.

This could indeed tough some people, but in HA there can be breaking changes.

If no changes are made, this case can be closed I think to stop the discussion. No hard feelings 😉

Regards Erik

Hi @starkillerOG, is there any progress / do you have any updates about this issue?

The entity ‘Infra red lights in night mode’ is in my opinion a switch as it’s telling if something needs to happen or not at a certain time of the day.

This was debated with the core-team during writing of the code and the conclusion was that since it is a light, it schould be in the light domain.

I guess I don’t agree with @frenck here: it’s not a light, it’s a setting. I can’t turn on the IR lights with this entity, I can only configure if they should turn on automatically. Sounds like either a switch or a select.

Turning off all light entities is a triky automation, also consider the floodlight of the camera wich certainly does need to be a light entity since it directly controls the light turn on/off. I don’t think you want to be controlling the floodlight with the turn off all lights automation right?

Fair point.

But the floodlight entity actually switches the floodlight, not the setting if the floodlight should be turned on automatically (which to me is similar to the IR lights setting), for which a separate select entity is used.

See the discussion here: https://github.com/home-assistant/core/pull/87943#discussion_r1103877670 This was debated with the core-team during writing of the code and the conclusion was that since it is a light, it schould be in the light domain. In essence it does not matter, because it is just a switch. Nothing really changes. switch.turn_on simply becomes light.turn_on etc.

Turning off all light entities is a triky automation, also consider the floodlight of the camera wich certainly does need to be a light entity since it directly controls the light turn on/off. I don’t think you want to be controlling the floodlight with the turn off all lights automation right?