YAML and Jinja Templating Course Episode 6: Counting your lights

preview_player
Показать описание
Here's episode six of this YAML and Jinja programming course! In this episode of our Jinja and YAML course, we'll cover how you can filter data in Home Assistant and count the lights that are on in your house. Learn how Jinja works and how to use it in Home Assistant with this tutorial!

Links referred to in this video:

⭐⭐⭐
⭐⭐⭐

00:00:00 Introduction
00:01:28 Counting all the lights in your house
00:05:03 How many lights are on in the house?
00:06:27 Bloopers

#homeassistant #jinja #yaml #templates #templating #programming #filterdata #countlights #tutorial
Рекомендации по теме
Комментарии
Автор

Let me know how many lights you have in your house!

SmartHomeJunkie
Автор

So it turns out I have 210 light entities 😂. Rather than reject those that I didn't want, I created a Label 'Light Group', assigned that to all the lights I wanted to count and selected those that are on. This gives me 27 total lights. Some of those are light fittings with multiple luminaires, but I don't want to count all the individual luminaires. Another really good walk through thanks. Labels are proving to be really useful.

daveforrester
Автор

Another awesome video in the series. These videos have been really help full to me. Keep up the good work. I have 47 lights in my setup

emms-place
Автор

That's a very useful video, I really like the approach of using labels.

Could you give any examples of using 'browser mod' to click on a dashboard icon that shows your 'Lights On' count that then brings up a sub-view listing the light names?

jfs
Автор

Another educational video. However, there is so much more to tell about Jinja. Please continue this series.

edwaaij
Автор

Another great video!

Thanks again, it really does open up endless possibilities.

One thing I've recently been doing is wrapping this up in a script and passing the label as a variable, so I can ask the same question but for various devices (again all mainly learned from your videos)!

I really think you've found your niche in these videos, nothing really out there that helps explain the art of the possible in a simple way! Thanks so much

robertdon-duncan
Автор

as always brilliant ❤
I advise everyone to go immediately to ko-fi👌

sevagjb
Автор

Fantastic tutorial. I changed my kludgy method of counting numbers of doors and windows opened and closed in my security system into two elegant code lines! Thank you!

My device battery monitor sensor is now 6 lines of code instead of 64
My leak sensor code is 4 lines I stead of 32

desertaip
Автор

I definitely appreciate these territorials and look forward to more, thanks.

But, the example case seem very silly. If I'm leaving the house and wanted to know if any lights were on, I would rather see where/what light not just a number of lights that are on anywhere in my house... Then have to go find where/what light/s are on because it only tells me "x6 lights are on in the house somewhere".
Seems way more logical to have all lights grouped by rooms they are in then check and report what group is still on when leaving.
eg, lounge group on means that a light/s is on in the lounge then, hit the 'turn off lounge lights button' - knowing how many lights are on is pointless.

That being said, you can set up automation to check when house goes to unoccupied state and turn off lights automatically, making it a truly smart home.
If there are specific lights you like to stay on when away, then create a boolean input 'away lights stay on' and configure the automation to turn off all lights except these specific lights if 'away lights stay on' is on.

birddroppings
Автор

Perfect timing - I was looking how to show how many lights are on within a dashboard. Is it possible to show the names of which ones have the state = ON in a dashboard?

wwolfram
Автор

I have about 24 lights a mix of smart bulbs & Smart switches. According to Mushroom overview 12 are on.

grahamshaw
Автор

64 is a boat load of smart lights! We have only have 34, with maybe 10 more that could be made smart.

major_west
Автор

please add this episode to your jinjia2 playlist, which seems to have only till 5th episode

squalazzo
Автор

Great video as usual! Thanks for all the work you do!
My lights in the house are a mix of light and switches domains. The use of labels is genius and was able to label all entities that are actually lights (either bulbs, switches (L/R), led strips).
But i cant figure out how to add the switch domain list with the light domain list before i start filtering for labels and then state.... can you show us how to?

danielshiloah
Автор

Great video, Thanks!
I've some relays in my home wich are not indicated with "light." but with "switch." is it possible to add those?

Niels-ez
Автор

How do I take this one step further and count only the lights on in a specific area?

adamfritzsche
Автор

Hi there, Nothing to do with this, but was looking for a way to bui build / store a LIST of items (like the last 5 phone numbers + timestamp) - using an helper ?? Then HOW to display that list on a dashboard ? This would be for a project to display missed calls on my dashboard ... many thanks !

cedricdelecole
Автор

I got stuck trying to count the lights on for a selected room - what to you select there?

bennopuetz