Understood. I initially asked here because I thought I would be dealing with a jinja template to determine which theme was currently being used. But the solution you gave me is much easier! Thanks again!
I have some statues and entities that I want to keep track of in multiple views and I have not found any good solution to this problem. Regular cards takes up to much space and feels bulky in general and I want the solution to work on both mobile and bigger screens.
I managed to do this with split view, footer and the template for the header:
Does any one know if I can get the icons to act like they where a part of a Lovelace instead of just “stupid” CSS/Template? I am currently using a hack with browser-mod but that isn’t really a good long term solution.
mayker
(maykar (pronounced "maker" with a southern accent))
66
Depends on what exactly you want those icons to do. If you just want to change icon/color based on state, that’s totally doable in a template. If you want it to be an actual entity button, trigger entity changes on click, or something similar then I would keep doing what you’re doing. That’s not something I’ll be adding to Custom Header.
If the former is what you are looking for than you can do something like this:
Header will show a green icon of a house when input_boolean.test is on, otherwise it will be a red icon of a bell.
If this is already what you’re doing, then sorry for telling you something you already know, but you did not show what you have tried or explained what you’re doing with browser-mod.
mayker
(maykar (pronounced "maker" with a southern accent))
67
And just to fit your situation more, here’s an example to support multiple icons (again, sorry if I’m telling you something you have already figured out):
Thanks, yeah have most of that figured out but you did it a lot better than I did. Didn’t know that the worked this way. The code will suddenly be a lot cleaner!
I am trying to accomplish the button part without the amount of “hacks” I am doing but that looks to be out of reach as of now, as I suspected.
mayker
(maykar (pronounced "maker" with a southern accent))
72
@kr_noob Continuing conversation from your comment here, this is the thread for such things.
If you can do it with a jinja template then you can add it to Custom Header, I am no Jinja expert and I just don’t have the time to write Jinja for anyone that requests it. This is why I often mention that this feature (complex html, css, and other fancy templates) is unsupported and isn’t really a feature at all. It’s more of a side effect of how things are rendered in CH.
All that being said, you would need to parse the JSON from the sensor you are using and the template section of the developer tools in HA is a great place to start. It even has an example of JSON parsing in the default template it shows. I can give you a bit of a head start, but making this work in the template that you are using would be up to you.
Go to developer tools >> templates and paste in the following example to see how to pull just the titles from the JSON in your feedparser sensor.
This will show the first 3 titles pulled from the sensor:
This works perfectly - I was able to put this into the header and flip the headlines vertically.
I had seen the JSON example (I know zilch about JSON) but overlooked it bc I thought the example was all about assigning variable vice extracting - but I see what you’re talking about. Thanks again!
Hi everyone. I am completely noob on this so my appologies if my question is stupid.
I have the following code in the raw editor. However it only display the time in compact mode.
What I should do in order to have the rest info in the header?
mayker
(maykar (pronounced "maker" with a southern accent))
75
Header text is removed in compact mode, it’s what makes it compact. You might want to try split mode. You can also flip split mode by setting footer mode to true.
Works amazing. So pumped as this delivers everything I need. One question though - using sensor data in the header / footer causes the marquee to restart every time the data updates, so it rarely makes it all the way through given that I have motion sensors and temp data from several rooms here. Any way to disable updating until it’s all the way through all the frames?
mayker
(maykar (pronounced "maker" with a southern accent))
80
The brackets aren’t nessisary for static text as it’s just rendering as HTML.
No. CH needs to update on any change to templates.
mayker
(maykar (pronounced "maker" with a southern accent))
81
You could get creative by making a time/date sensor and then a template sensor that will only update its value based on that sensor. So, for example, the template sensor’s value_template would be the state of the sensor you’re interested in and the entity would be sensor.date.
This would make it so that the sensor would only update once a day. You would then make an automation that used the homeassistant.update_entity service to update the template sensor with whatever interval you’d like.
Haven’t tried any of this myself, but it should do what you want.