mayker
(maykar (pronounced "maker" with a southern accent))
125
Happy Holidays Update:
Now with per device views!
You can now choose to hide/show lovelace tabs per device! Perfect for creating specific lovelace configs for tablets, phones, and more. See github for usage. Big thanks to @pjv for the original idea.
The card now has features to help with configuration, see below:
Card:
The card will automatically display when “configuring ui” in lovelace and has a few features to help with config.
thanks @mayker, this card is getting better and better.
the only thing i wish at this point is that there was a way to make it some kind of meta-entity that you didn’t have to put into a view like a normal card so the lovelace config could be more DRY.
1 Like
mayker
(maykar (pronounced "maker" with a southern accent))
127
@pjv I’d prefer that as well, but this is mostly a hack and my options are pretty limited. Any option that isn’t a “card” wouldn’t be easily configurable by the user and having it as a card solves a good bit of issues that would exist otherwise.
So this update has now killed the tab I had the card added to. (and it’s not working on other tabs)
Console shows this error:
compact-custom-header.js?v=0.2.1:36 Uncaught TypeError: Cannot read property '0' of undefined
at HTMLElement.set hass [as hass] (compact-custom-header.js?v=0.2.1:36)
at HTMLElement.set hass [as hass] (2af5b1c2d5fbf8c18791.chunk.js:3467)
at config.cards.forEach (2af5b1c2d5fbf8c18791.chunk.js:5616)
at Array.forEach (<anonymous>)
at HTMLElement._createCards (2af5b1c2d5fbf8c18791.chunk.js:5616)
at Object.runMethodEffect [as fn] (app-6a2aa396.js:248)
at runEffectsForProperty (app-6a2aa396.js:248)
at runEffects (app-6a2aa396.js:248)
at HTMLElement._propertiesChanged (app-6a2aa396.js:248)
at HTMLElement._flushProperties (app-6a2aa396.js:895)
I don’t have any options set at all - just loading the card
Im trying this out for the first time and i get the same error i my console.
compact-custom-header.js?v=0.2.1:36 Uncaught TypeError: Cannot read property '0' of undefined
at HTMLElement.set hass [as hass] (compact-custom-header.js?v=0.2.1:36)
at config.cards.forEach (2af5b1c2d5fbf8c18791.chunk.js:5616)
at Array.forEach (<anonymous>)
at HTMLElement._createCards (2af5b1c2d5fbf8c18791.chunk.js:5616)
at Object.runMethodEffect [as fn] (app-6a2aa396.js:248)
at runEffectsForProperty (app-6a2aa396.js:248)
at runEffects (app-6a2aa396.js:248)
at HTMLElement._propertiesChanged (app-6a2aa396.js:248)
at HTMLElement._flushProperties (app-6a2aa396.js:895)
at HTMLElement._flushProperties (app-6a2aa396.js:248)
1 Like
mayker
(maykar (pronounced "maker" with a southern accent))
131
I was thinking that i would have the header when on any non Android device
And no header when on Android.
But im getting:
On non android = No header, but tabs
On Android = No header and no tabs
Is that a bug, or how do i keep the header visible when on non Android devices
1 Like
mayker
(maykar (pronounced "maker" with a southern accent))
136
It was a case sensitivity issue and has been fixed in the latest version. Thanks for finding it!
mayker
(maykar (pronounced "maker" with a southern accent))
140
That’s dope. Learn something new every day, thanks! Will add that to the readme at some point.
mayker
(maykar (pronounced "maker" with a southern accent))
141
Unfortunately, it doesn’t play nice using edit in “configure ui”. After editing they just go back to full code instead of just variables. Still great option for yaml mode and as a space saver otherwise.
i think your browser is caching the js and it won’t be there in a reliable way if you happen to do a hard refresh on a tab / view that doesn’t include the card.
2 Likes
mayker
(maykar (pronounced "maker" with a southern accent))
145
What he said. If your config doesn’t run into issues with only having it included once, awesome. There are some situations where it would be problematic, though.