Search
Generic filters
Exact matches only
Filter by Custom Post Type
Velg en side

Using frontend on Hass.io

In the previous post I’ve covered the setup of the Hass.io system. Out of the box the panel is no eye candy I would way. But there’s hope my friend, and i will tell you a thing or two to get it on its feet. We are now going trough how to set up themes and layouts. 

p

Note

Notice that Theme and Layout is two different things in this article.
But i’m covering both subjects, lucky you!

Theme

If you are like me and have some vampire blood in your veins, then you probably want to stick to a dark theme I guess. by all means, you can also go total white, I wouldn’t mind, just dont show it to me, unless you have made magic 🙂

Setting up required files

First thing we can start with is to edit our configuration.yaml file and add a new file to our system. In this file, scroll until you find «frontend» then add this:

We are now including the file themes.yaml instead of pasting in our theme in configuration.yaml since its big enough as it is. Just to make things more clean and easier to get more overview of our installation.

So next step is then to create themes.yaml in config directory.
As the screenshots above in using dark and orange as a default theme now (kind of liked this one)
And this is the code i used in themes.yaml:

But nothing has happend yet because we haven’t set the new theme for our profile.
To do this we need to go to our profile page (the icon in the sidebar on top right) and select under Themes, then you will find «darkorange» or whatever you called it.

p

Note

You can also have multiple themes in this file, just make sure indentation is properly. And you can also change the hex code in top of the file to change colors to what you prefer.  Also, When applying a theme, this will only affect the current user that your logged in with.
If you have multiple user, you need to change for every user.

Everything is dark and orange now,
but still looks like crap?

Okay now were bringing up the big guns i guess, the layout part. First thing we can do is to check if lovelace is set to yaml mode. Go to the configuration file again (configuration.yaml) and look after # Lovelace Then add this if not allredy in place.
(Not sure if its there by default, but nice to doublecheck i guess).

Layout

Ok so now we can start creating our new frontend layout as how we want it. In my setup I have created multiple tabs for different rooms in my little castle and one main tab that I’m using for locking up at night mostly.

We need to create a new file called ui-lovelace.yaml and save this under config  directory.  We can start slowly by adding this to the file.

p

Note

In ui-lovelace.yaml we can add all our tabs in this file, but as mentioned before, I like to seperate every tab into different files to get a better overview.

And if you only gonna use one frontend page, then just include the one file and the tabs on top will dissapear.

So lets say you stick to page1.yaml and page2.yaml, then we need to create theese files aswell. Those files are we adding under /config/lovelace

so      /config/lovelace/page1.yaml
and   /config/lovelace/page2.yaml

Yes the files are now added but nothing shows? Thats right, we haven’t added any content to those files yet to define name or icon to the tabs so thats why they are not showing.

To do that we need to add this as a minimum requirement to make the tabs show: 

In short,
title is the name of the page were creating.
icon is the icon thats appearing in the tab.
You can find all available icons here
panel is the sidebar, if you want to hide it on certain pages.
(havent seen any reason for it yet since its not opened by default)
path is the url for the tab.

The base structure is now set, what now?

Now we can start implementing Lovelace cards, Everything from lightbulb switches, weathercast and so on. A good practice is to think on how you layout is gonna be before your implementing your layout  (just like tatoos kindof  I guess..) because this is NOT drag and drop solution where you can play along and expect it to look perfect on first shot.

p

Note

In this article I just cover on how the default lovelace cards are working. There will be another one for custom cards. This is just to get an understanding on how it works.

We can start by taking page1.yaml now and assuming that you have atleast two light bulbs to create two picture cards in a horizontal view and add lights to each cards like this:

To create this we need to setup page1.yaml like this:

p

Note

Note that the image is written as /local/your-image.png
This images shall be placed under config/www/your-image.png which is kindof confusing, but thats how it is.

You probably noticed that its cards inside cards, this is what I was referring to earlier that you may need to think twice before implementing because you can for example have one horizontal-stack and inside this your’e having 2 vertical stack with cards again. whatever suits your needs.

The default lovelace horizontal and vertical cards also have some limitations, and are not optimized for mobile what so ever. But this is absolutely a facelift from the out of the box default panel.

To get an optimized view for desktop, tablet and mobile we need to use a custom layout card, and that i will cover some other time.

Done reading?

Check one of the post beneath for more reading

Handlekurv
0