yes, im trying to understand thatâŚ
still, what could override the exception user_agent as in my exampleâŚthey are set for the same condition and exception, only written differently?
Fair point, could you just try a simple config something like:
custom_header:
test_template: '{{ userAgent }}'
exceptions:
- conditions:
template: '{{ "Chrome" in userAgent }}'
config:
background: green
This works for me without issue. Header background is green when in Chrome, default color otherwise. As well as printing the user agent in dev tools. If you donât see the userAgent string in dev tools, my money is on a cache issue.
Again, your config is quite large and almost entirely templates that are tied to entities, browsers, and other things that I cannot replicate. This means I donât know where to start to troubleshoot your issues as I donât know what your config is set to.
I understand⌠but most basically it is about 2 templates related to showing tabs.
one is in the base config, set on the state of an input_boolean.developer_mode:
show_tabs: >-
{% if is_state('input_select.mode','Developer') %}0 to 29{% else %}0 to 3,5 to 22,27,29{% endif %}
added to that, I have an exception based in the phrase âChromeâ being in the user_agent:
exceptions:
- conditions:
user_agent: Chrome
# template: "{{'Chrome' in userAgent}}"
# template: "{{'Chrome' not in userAgent}}"
config:
# hide_tabs: 30
show_tabs: >-
{% if is_state('input_select.mode','Developer') %}0 to 30{% else %}0 to 3,5 to 22,27,29,30{% endif %}
this is what I use now, and it works.
I would have hoped to be able to set the developer mode to include tab 30, and to take that out based on the condition being met in the exception.
that case, it wouldnât need to override, but simply take out 1 tab (or not)
even without that, and trying to use the exact same (working) show_tabs with the template in the form commented out above, it doesnât work.
Maybe you can test that in your setup?
Made a fresh HA install, created 31 tabs ( 0 - 30 ) and added an input select named âmodeâ with 2 options:
input_select:
mode:
initial: Developer
options:
- Developer
- Not Developer
Using this config:
custom_header:
show_tabs: >-
{% if is_state('input_select.mode','Developer') %}0 to 29{% else %}0 to 3,5 to 22,27,29{% endif %}
exceptions:
- conditions:
user_agent: Chrome
config:
show_tabs: >-
{% if is_state('input_select.mode','Developer') %}0 to 30{% else %}0 to 3,5 to 22,27,29,30{% endif %}
Results:
- In Chrome and âDeveloperâ selected: All tabs are shown
- In Chrome and âNot Developerâ selected: tabs 4, 23, 24, 25, 26, and 28 are hidden.
- In Safari and âDeveloperâ selected: tab 30 is hidden.
- In Safari and âNot Developerâ selected: tabs 4, 23, 24, 25, 26, 28, and 30 are hidden.
Using Templates:
Keeping everything else exactly the same, but only changing the condition from user_agent: Chrome
to template: "{{'Chrome' in userAgent}}"
produces exactly the same results. While using template: "{{'Chrome' not in userAgent}}"
produces the opposite results as expected.
This all seems to be behaving as it should. Is there anything Iâm missing? Anything else youâd like me to test while I have it set up?
Gif from results of template: "{{'Chrome' in userAgent}}"
in Chrome:
wow thanks Ryan, impressive user support!
what would be great if you could test additionally:
conditions:
template: "{{'Chrome' not in userAgent}}"
config:
hide_tabs: 30
and have the show_tabs template like:
{% if is_state('input_select.mode','Developer') %}0 to 30{% else %}0 to 3,5 to 22,27,29,30{% endif %}
or, maybe even more powerful:
show_tabs: >-
{% if is_state('input_select.mode','Developer') %}0 to 30{% else %}0 to 3,5 to 22,27,29,30{% endif %}
hide_tabs: >-
{% if 'Chrome' not in userAgent %}30{%endif%}
in the main config.
just so you know this is not all just for the sake of it: tab 30 houses the Cast setup, so is only to be shown on a Chrome browser. ( I know i can hide the cast entity when not available, but that would still show the card (albeit empty) on a non chrome browser)
if that keeps failing, maybe I should combine it to 1 template, which I can confirm to work alright:
{% 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 -%}
btw, after refreshing Lovelace (three dots) I often see this in Safari inspector:
and after which the header simply shows as if CH isnât loaded at all (none of the settings in the CH config apply)
seems refresh doesnât work anymore on Safari browser⌠tested both ways: in Safari directly, but also in Chrome as master controller for the Safari browser to check what happens. Disabling CH in Chrome via the input_boolean, changes layout accordingly in Chrome, but kicks in the error in Safari. Even a reload page (not refresh Lovelace) doesnât see the change, the error persists.
I have a simple landing page with images that I use for navigation to send me to the cards I want. I have those cards hidden from the top nav and it has worked for so long I dont even know how long Iâve been using it (a year or so)
cards:
- cards:
- entity: group.livingroom
image: /local/custom_lovelace/images/living_room.jpg
name: Living Room
show_state: false
tap_action:
action: navigate
navigation_path: /lovelace/livingroom/
type: picture-entity
- entity: group.kitchen_office
image: /local/custom_lovelace/images/kitchen.jpg
name: Kitchen and Office
show_state: false
tap_action:
action: navigate
navigation_path: /lovelace/kitchen/
type: picture-entity
type: horizontal-stack
- cards:
- entity: group.master_bedroom
image: /local/custom_lovelace/images/master_bedroom.jpg
name: Master Bedroom
show_state: false
tap_action:
action: navigate
navigation_path: /lovelace/master/
type: picture-entity
- entity: group.theater_room
image: /local/custom_lovelace/images/frog.jpg
name: Theater Room
show_state: false
tap_action:
action: navigate
navigation_path: /lovelace/frog/
type: picture-entity
type: horizontal-stack
- cards:
- entity: group.guest_rooms
image: /local/custom_lovelace/images/guestroom.jpg
name: Guest Rooms
show_state: false
tap_action:
action: navigate
navigation_path: /lovelace/guestrooms/
type: picture-entity
- entity: group.outdoor
image: /local/custom_lovelace/images/outdoor.jpg
name: Outdoor Lights
show_state: false
tap_action:
action: navigate
navigation_path: /lovelace/outdoor/
type: picture-entity
type: horizontal-stack
- cards:
- entity: binary_sensor.doors_unlocked
image: /local/custom_lovelace/images/outdoor_doors.jpg
name: Doors and Locks
show_state: false
tap_action:
action: navigate
navigation_path: /lovelace/locks_doors
type: picture-entity
- entity: group.thermostats
image: /local/custom_lovelace/images/ecobee.png
name: Thermostats
show_state: false
tap_action:
action: navigate
navigation_path: /lovelace/thermostats/
type: picture-entity
type: horizontal-stack
- cards:
- entity: group.thermostats
image: /local/custom_lovelace/images/frontdoor.jpg
name: Security Cameras
show_info: true
show_state: false
tap_action:
action: navigate
navigation_path: /lovelace/cctv/
type: picture-entity
- entity: group.thermostats
image: /local/custom_lovelace/images/routines.png
name: Scenes and Routines
show_info: true
show_name: false
show_state: false
tap_action:
action: navigate
navigation_path: /lovelace/scenes/
type: picture-entity
type: horizontal-stack
type: vertical-stack
I recently removed the last lines of the old CCH from my lovelace using HACS, and now clicking on any navigation link that is hidden but custom header, results in an error, the tab pops up for a mili second, and then back to the home page. The error is pretty generic. Iâm sure its somethnig that was removed from CCH that maybe needed to be there, but Iâm not sure where>
https://myURLhere/lovelace/home:0:0 Uncaught
Any advice on where to start.
Also this only happens on my browser (chrome), but works fine on my iphone app
Nevermind, I found it. Not sure if it was new or not, but hidden tab redirect was enabled. Turned it off and all is well
Same problem here. Thanks for the solution.
In my config hidden_tab_redirect was commented. I think its default has changed from false to true.
Explicitly writing hidden_tab_redirect: false and everything is good
not possible to create an issue out if this, please let me ask here, what this might be:
or even bigger:
Wouldnât know where to start here. please me tag both @thomasloven and Ryan. Both errors, which appear in a ridiculous amount within a few blinks of an eye,
and are accompanied by disconnects apperntly start with card-mod and endup at custom headerâŚ
This was actually a fixed bug, you shouldnât have been able to navigate to a hidden tab with hidden_tab_redirect on (which is the default). There were a few ways around it, including using navigation links in other cards (as youâve found out), but now the redirect works as intended.
@Mariusthvdb For your hide/show tabs template questions:
Now I understand what youâre attempting, sorry I didnât understand earlier. hide_tabs and show_tabs are not meant to be used at the same time. They are alternatives to each other. If they both appear in the same config then show_tabs will override hide_tabs. If one is used in an exception and the opposite one is in the default config, the exception will override the default config. This is by design. Try latest release for the typeError fix.
As for the crazy amount of failed calls appearing in your log, youâre going to need to try and narrow that one down yourself, unfortunately. I know thatâs not something that anyone wants to hear, but itâs possible that none of the custom elements in those errors are responsible. One thing to check might be any devices that may need refreshed that havenât been in a while.
Thought of another helpful setting for your situation if youâre not using it yet. Click the user icon on the tablet in the sidebar (very bottom) and turn on âAlways hide the sidebarâ. That would at least add the extra step of them having to hit the menu button in time in order to even see the sidebar.
I apologize for the amount of recent releases. Keep catching bugs that Iâd like to squash right after release. Hoping to improve performance, kill a few pesky bugs, etc.
Just got the latest⌠but again HACS pulls the old version. After a restart, a reinstall pulls the new one but you have to clear cache as well⌠odd
Iâm not sure whatâs going on with that. I havenât had that issue, but many others have. Is there an issue posted on the HACS GitHub? If not, you should get one up there.
Ok thanks! I kept trying but had to conclude it didnât work good to know that by design . The combined template I posted does work alright, so Im not stuck!
Most of the time this happens when changing tabs. At that same time, I see the lost connection box slide in the window, and thousands of errors are shown in the blink of an eyeâŚ
have a new issue/question: when on a tab (my developer tab) that is normally hidden, and displayed when in the developer mode (you now know of the input_boolean), I stay on that tab, even when switching off developer mode. The view should then be hidden again, and the tab icon in fact isnât visible in the tab menu, but the browser window remains unchanged. Is this a bug, of should I have a setting preventing this?
btw I am already using 1.3.0 so it happens in the latest release also.
Hm yeah, I have a lot of issues too since 1.2.2
-
it loses connection very very often when switching between tabs (it shows a the yellow cog in the app and then reconnects). Not a major deal, but when reconnected often no button works anymore.
-
since last nights updates: if I go to a tab that is hidden (yes redirect_hidden_tabs are set to false) it starts to go full out crazy on me and flip the views back and forth, and back and forth. Like a disco machine. Makes the ui-completly unusable. Refreshing helps but not really (this is already an issue on github https://github.com/maykar/custom-header/issues/119) but instead of him saying sometimes, for me it does it constantly.
-
CH has become extremely slow in switching tabs post 1.2.2 I often have to press twice on a tab. And sometimes it would just do nothing and then suddenly after 5/7 seconds it would navigate.
I did found however that all of this is happening when using show or hide tabs. It only does this when navigating to a hidden tab!
yes! sorry to say, but glad you see the same ⌠finally to know one is not aloneâŚ
just had this discussion on đš Browser_mod - turn your browser into a controllable device, and a media_player because of the fact my browser id gets reset on these frontend refreshes⌠do you also get the errors in inspector I posted here ?
disabling CH makes the interface fly again, and as far as I can see now, stops the errors all together, feeding the suspicion at least the CH and card-mod error in my posts is relevant. Never know which causes which of courseâŚ
Even the constant refocussing the the top of the page is gone when CH is disabled.
I will check it when I have a pc available.