Breaking down the Flag Sensor in Home Assistant

Blog_Post_Breaking Down the Flag Sensor

With all the holidays passing us, I’ve noticed the nice colors on my house using the DIY LED lightstrips.  With Halloween, Christmas, Valentine and now President’s day, the Smart Home has been lit up beautifully and automagically.  This is in large part thanks to Home Assistant and my color scene scripts.  I’ve never really taken the time to break these scripts down so that’s what I am going to try to do here now.  Of course, you can get all of the latest scripts for this project and more on my GitHub repo.  So be sure to head there and drop a star on the repository so you can stay up to date on any changes.

For President’s day specifically, there is a FLAG SENSOR.  This flag sensor is responsible for checking the internet via a rest API to see if the current day is a flag day and if it is, Home Assistant can then light the house appropriately.  Red White and Blue.  As discussed and detailed in other videos, my house has about 8 objects that can be individually addressed.


These consist of light strips over some window and garages in addition to Hue lights placed outdoors in 3 sconces and in the overhead fixture above the main door.  Using all of these elements, you can get some pretty cool effects on the house for all of the holidays.  Since all of the effort is scripted, it’s always a nice surprise when you come home and the house is lit a different way for one of the minor holidays. (StarWars day anyone?) 

The parts for the front lighting include:

1 x LED RGB Wifi Controller –
1 x LED Light Strip Kit –
1 x Power Supply –
1 x Outdoor Housing –
2 x Aluminum LED Diffuser housing –
3 x Hue colored lights –
3 x E27 to E12 socket adapter –

For real-time holiday status, I use the website  We pull data from this site 4 times a day to always have the most current information.   There are a lot of different countries and calendars available on the site, so be sure to explore it and find the one that best suits your home.

Once we determine if it’s a flag day, the monthly scene script is then called and we paint the house Red, White and Blue.  For 2019, there will be 20 flag days that the house will reflect in it’s front lighting.

In the video, I mention Phil and Rohan’s excellent HA Podcast.  Be sure to subscribe if you haven’t yet.

Happy Automating!