I’m using Lewis’s (Everything Smart Home) template to count the number of lights that are turned on in HA. It seems to be counting a non-existent light in my bathroom! To try and whittle the problem down I’ve removed all areas with lights except the bathroom from the template. Now, with the actual bathroom light turned off the template returns a count of one. If I physically turn the light on the count increases to two. I’ve gone through all the devices in my system to see if there is one that is assigned to the bathroom and is set to appear as a light but I can’t find one. I’ve also set an automation to turn off all lights in HA but the template still returns one showing to be lit. I’ve also tried adding all the other areas with lights to the template and removing the bathroom area from it; turning all the lights off returns a value of zero, which is correct. Please, can anyone offer any guidance on locating the rogue bathroom ‘light’ as I seem to have hit a brick wall with this one?
Many thanks for looking
Over the years there have been a number of integrations that create light entities for things you might not think of as “lights” such as screens or indicators. Another possible source for an issue like this could be light groups or Template lights.
If you post the template, we can tell you how to modify it to give the entity or device name and how to modify it to reject that entity.
Hi, thanks for your reply. I’m not familiar with templates and I struggle to understand the language and syntax so help is appreciated. The template is shown below:
{% set AREAS = [‘Bathroom’,‘Landing’,‘Sitting room’,‘Dining room’,‘Hall’,‘Kitchen’,‘Living room’,‘Workshop’,‘Downstairs toilet’] %}
{% set DOMAIN = ‘light’ %}
{% set ns = namespace(ids=) %}
{% for a in AREAS %}
{% set ns.ids = ns.ids + area_entities(a) %}
{% endfor %}
{{ expand(ns.ids|unique)
| selectattr(‘domain’,‘equalto’, DOMAIN)
| selectattr(‘state’,‘equalto’,‘on’)
| list | count }}
As I mentioned, Bathroom is the only area returning an ‘extra’ light.
Thanks.
You could copy the template to the template section of the developer tools:
From there, removing the last | count part of the template should show you the entity it’s still counting.
Thank you! That was very helpful. It turned out to be the backlight for the underfloor heating switch! Once again, thanks for the assistance!
Just to update: I resolved the issue by moving the heating switch into a new room I called ‘Control room’ and which isn’t included in the template.