Recently updated to the newest version of CH and am experiencing a problem I had not seen before. I have CH disabled for my user (Samuel) so that I can still access the side panel. The config is shown below. CH seems disabled as I can see all the Tabs, but when I try and select a tab that is not 0,1,2 I am thrown back to tab 0. Any thoughts? In the past the disabled_mode allowed me to select any of the other tabs.
mayker
(maykar (pronounced "maker" with a southern accent))
457
Yeah, redirects shouldn’t be active in disabled mode, will get that fixed. For now you could just add hidden_tab_redirect: false to Samuel’s config as a work around.
Hi all. My first post, but have read 1000+ to learn…
I try to make the simplest thing to work, hide tabs for all users, but not the HA owner.
I start with idea from post #72, and use Build-in variable isOwner in my Raw config editor:
custom_header:
show_tabs: >
{% if {{ isOwner }} %}0 to 21, 26 to 28
{% else %} 1 to 28
{% endif %}
Saves wo error, but when i enter Raw config editor again, it has changed to this:
custom_header: null
show_tabs: |
{% if {{ isOwner }} %}0 to 21, 26 to 28 {% else %} 1 to 28 {% endif %}
This works well, but for all users:
custom_header:
hide_tabs: 1 to 9
mayker
(maykar (pronounced "maker" with a southern accent))
459
Indentation is very important. In your first example you are indenting with one space instead of two and you have indented custom-header: with one space as well, I believe this is why the editor is changing it to what you see there.
That example should look more like this (using >- will strip the code of new line characters):
custom_header:
show_tabs: >-
{% if isOwner %}0 to 21, 26 to 28
{% else %}1 to 28
{% endif %}
This would also work:
custom_header:
show_tabs: '{% if isOwner %}0 to 21, 26 to 28{% else %}1 to 28{% endif %}'
The raw config editor might change it, but if your formatting is correct to begin with then it won’t be a problem.
Edit: Also when using the variables inside of another bracket statement, don’t use brackets:
Like this:
show_tabs: '{% if isOwner %}0 to 21, 26 to 28{% else %}1 to 28{% endif %}'
Not like this:
show_tabs: '{% if {{ isOwner }} %}0 to 21, 26 to 28{% else %}1 to 28{% endif %}'
since you offer us the built-in vars, my desire to use these outside of CH has grown in each development cycle I take in my dev page…
Would it somehow be possible to use these vars outside CH? I’d love a card with the system vars
{{ user }}{{ userID }}{{ isAdmin }}{{ isOwner }}{{ deviceID }}{{ viewTitle }}{{ viewPath }}{{ viewIndex }}
{{ url }}{{ userAgent }}…
Using this cool marquee for now, but obviously some of these vars would be of more value when used outside of the owners mobile device Custom Header (though cool it is ! )
Yes that is pretty cool and as there is no point in re-inventing the wheel out of sheer laziness do you have a convenient list of all the input_boolean you have created to turn on and off all the features of CH?
I think it is time I tarted mine up. There is so much it can do now and I’m barely scratching the surface.
mayker
(maykar (pronounced "maker" with a southern accent))
464
Custom header uses theme vars in this order: If background is set in CH’s config it is used first, then CH’s own theme var --ch-background, then header background theme var --app-header-background-color, and finally primary color theme var --primary-color if nothing else is set.
So, if it’s not behaving as expected make sure that you’re not using another one of these options that is overriding the expected color.
Unfortunately, no. The Jinja variable scope is limited to the template it is used in (CH’s templates act as one large template). Also, I’m saving the results of Javascript into those variables so there is no way to replicate those in Jinja, as far as I know.
couldn’t we use the variables globally using maybe browser-mod, or the new q-card? Or some Lovelace_gen variables. Just wildly stating a few cards that developed into newer versions using powerful (global) possibilities.
haha, no worries, just didn’t want to spam this thread with the full config again…
ons significant change I made in the templates, other than the above mentioned marquee, is this:
show_tabs: >-
{% if is_state('input_select.mode','Developer') %}
{%- if 'Chrome' in userAgent -%}0 to 30
{%- else -%}0 to 29
{%- endif -%}
{%- else -%}0 to 3,5 to 22,27,29
{%- endif -%}
using the useragent variable
1 Like
mayker
(maykar (pronounced "maker" with a southern accent))
470
You would need to convince each of those card makers to implement something similar. Even if I were to expose the variables for use in other projects you’d still need to convince them to implement it into their code.
The file that handles the template variables can be found here and changes with almost every release.
I’ve encountered on odd issue with Custom Header when using browser_mod.
I have an exception which enables kiosk mode when the word embed is in the query string. This works fine when I navigate normally to a page with that in the url (e.g. /lovelace/home?embed) and kiosk mode is enabled as expected but, when I use the browser_mod.navigate service to make the browser navigate to that same url, kiosk mode is not enabled.
The URL appears to be correct in the address bar, with the query string, but Custom Header appears to be ignoring it.
Hello @mayker
Great job with this component. I’ve got a question regarding the width of the tabs. I’ve never used Compact Custom Header component. I installed Custom Header today and it makes my tabs shorter as in maykars’ case.
I love the ability to make the header transparent. That’s what I use it for, but I don’t like the fact that the tabs visibility is lower than without CH. I really need as much space as possible. I’d even like the default HA layout to be a bit wider.
I can disable shevrons and this adds indeed some space, but actually chevrons are sometimes handy.
Is this a bug that the space is shrunk or is intended? Can this be changed somehow?
Thank you!
mayker
(maykar (pronounced "maker" with a southern accent))
473
@Steven_Rollason You found a bug! Should be fixed in the next release.
@grzeg8102 The space on the sides is added for another feature of CH. When you scroll down the page the buttons slide down so that you always have access to them as the header collapses. This has been mentioned quite a bit, so I should probably start thinking of a new mode that doesn’t collapse the header and expands the width of the tabs to the full width of the header.