Use Home Assistant to Help Plan Your Wardrobe

Cyan Automation
3 min readAug 22, 2020
Photo by Craig Whitehead on Unsplash

When I think about the future, it always features a Smart Home AI Personality telling me it’s too hot to wear jeans aside — saving me from melting in the midst of the summer heat. This project today will get us someway there — firstly by interrogating the outside temperature, and then returning some predefined clothing suggestions — which allows for a really great dynamic sensor.

Getting Started

You very likely already have a Weather integration set up, so we’re going to use that to read off the outside temperature. I’m using Dark Sky, but feel free to substitute. Before you start coding, think about the temperature ranges local to you — and what types of clothing you wear for each. Just remember that with too few options, the sensor won’t be useful.

Note that since being bought out by Apple, Dark Sky is longer providing (new) API keys. There are many integrations out there, just as good as Dark Sky, and good enough for this project.

Making It Work

The key here is creating a Template sensor with layers/tiers for different temperature ranges, first define the Template sensor and provide meaningful names. Then as part of the value_template use multiple if statements to divide up the temperature range and clothing options. Don’t forget that the last line (being endif) can either be the outlier option, or warmest/hottest suggestion. If done correctly, you should end up with a sensor that looks like this:

To further improve this, let’s use the icon_template to change the icon based on the general weather outside. There’s limited mdi weather icons, so I’ve gone for fewer tiers/layers here. It’s just a case of re-applying what we did with the value_template, but instead returning an mdi icon. Here is what this looks like in YAML:

--

--

Cyan Automation

Marc’s tips on building your Smart Home with Home Assistant, Shelly and ESPHome.