Hello, I am very new to this Home Assistant, and I am learning little by little, and I would like to know if it is viable to know through a sensor, I understand the number of lights and devices that are currently on at a specific time, for example to petition…
Yes it’s possible. There are a couple of ways of doing this. The easiest is a entity filter card. This is not a sensor this will just generate a list of entities in a card in home assistant:
Check the examples a t the bottom of the page.
Or you can query a group of entities with a template to list which are on:
Ok, but my intention is to ask Google assistant what is the status of the system and answer me right now there are X lights on and X devices connected, that’s why I said about the sensor.
The entity filter theme is already operational on my main screen and it works! But for the voice response ?? Thank you!
Yes I understand that it would be the option, count the entities that are in the card that I already have! Would it be possible? As I am a novice and I cannot find a way to do it.
You could perhaps try using input_number? You’d have to set up automations/scripts to increment the counter every time a light was switched on, but Alexa certainly will read off the current value on command (don’t know about Google). Values saved this way also survive a reboot, which can be an advantage.
For other devices that don’t have a specific domain like lights do, e.g. windows, doors and gates, are all binary sensors, you would have to create a group and count the devices in the group. That template is in one of the links I posted above.
IT WORKS PERFECT!!! Thank you very much, now only one more thing is possible a binary sensor that is recognized as a device, I have adapted your template to the switches and there are some things that I have by PING sensor (binary)
I have several devices of YOURS that adapting the template have been recognized, but I want to add some device that I have configured as a binary sensor, type connected by PING
They can be added, it is a bit what you have explained above but I cannot get the template to recognize the group
to be honest I tried that yesterday
In the developers tool if I test the template it is working
but it gives the below result
value_template: >
4
where I think it should give ‘4’ only (not value_template: >)
if I make a sensor it isn’t working at all
the result is 0
and in logs says
Log Details (WARNING)
Logger: homeassistant.components.template
Source: components/template/__init__.py:52
Integration: template (documentation, issues)
First occurred: 9:37:57 AM (1 occurrences)
Last logged: 9:37:57 AM
Template sensor 'number_of_lights_on' has no entity ids configured to track nor were we able to extract the entities to track from the value template(s). This entity will only be able to be updated manually.