You cannot mix JavaScript with Jinja, if you use JavaScript declarations in a partial (like const), that partial could be used in a JavaScript template but not in a Jinja one.
No, it is not possible, that is the error.
Try to see if this returns the units:
info: |
[[[ @partial data
const units = state_attr(boiler, 'unit_of_measurement');
return 'Zonneboiler: ' + Math.round(boil_temp) + units; ]]]
Ok after days of stuffing around with it, especially when I donât know what I am doing.
Installed never before used browser etc. Testing etc
Asking Chat gpt and doing everything asked
Suspecting one of the themes uninstalling them
Suspecting one of the hacs installs and uninstalling each one ------
to finally find the issue is GitHub - KoljaWindeler/ytube_music_player: YouTube music player for homeassistant
Only thing is I redownloaded it and it still only works without it(uninstalled it).
Are you able to shed some light on why? I want to use both if possible.
The check that you need to do is with the Network tab to see which resource is loaded by your system. Do you mean that if you install that custom add-on your system starts to load the old version of custom-sidebar and if you uninstall it it loads the new one correctly?
No, it is not possible because templates are processed in an async way, it doesnât work in a way that a template is processed and its result can be used in the next template on your code (there is no order and each template is processed on its own peace).
That is what partials are intended for, if you need to reuse a variable in multiple places, the place to put it is in a partial.
That is hard to achieve, because it would be hard to know which template should be rendered first because its result is used in another template. But even if it is achieved, the result would be delayed templates, because there should be a logic that extracts all the templates first and then in a smart way it should determine which ones should be rendered first and which ones should wait for the result of the previous.
The old one wasnât working at all and as far as I know and I had removed it. I meant when I redownloaded youtube music player it still would not work thinking there might have been an installation issue.
If youtube music player is installed home assistant shows default menu
Uninstalling it loads your custom-sidebar but I didnt test a lot.
while youtube music player is installed I can see custom-sidebar loads and then drops out. Only reason I know this is I kept hitting refresh in the browser when I invoke a restart and I see custom-sidebar menu changes etc working and then goes back to home assistant default menu order. Hope I made sense.
After stuffing around I have restored my backup yesterday and youtube music player is still installed. I was hoping I dont have to uninstall it. If you need me to do tests I can. thanks
Remember that you need to forget about custom-sidebar entirely and test with your Network tab. The same exercise that you did before and in which you saw the resource of the old custom-sidebar being loaded even if you uninstalled it you need to repeat it until you see the new resource being loaded and the old one disappear. So my recommendation was to forget about any custom-sidebar debugging, just test with the Network tab. Until you donât see the new resource being loaded, forget about custom-sidebar configuration, custom-sidebar debugging, items in the sidebar or anything else. Try to make your system not loading the old resource.
Your system is loading it (taking into account your screenshots).
Forget about what custom-sidebar should do, do not debug custom-sidebar, debug your Network tab, you should not enter to debug custom-sidebar until (these are your screenshots):
You donât see custom-sidebar-v2-fixed.js and you start to see custom-sidebar-yaml.js in your network tab.
Do not look at your sidebar or the behaviour of your sidebar, until you see that in your Network tab the new resource is loaded and the old one not. When that occurs you will see the console.info of custom-sidebar. After that, and only after that, you can start debugging custom-sidebar.
Ok looks like I was wrong about whats interfering.
I have restored my backup as I mentioned so I removed youtube music player but this time it still did not work.
I made a mistake I think it was Browser mod. I removed Browser Mod and restarted and it worked. So restored my backup again and this time I only disabled the Browser Mod integration and restarted and it works. So not sure whats the issue with Browser Mod.
EDIT: @elchininet can confirm, as Browser Mod just stores Sidebar information that Home Assistant reads, even if you do set any Sidebar settings in Browser Mod, custom-sidebar will take precedence. Browser Mod would not interfere with custom-sidebar in this regard.
Just following up here. Root issue was an incorrect URL for Dashboard resource for card-mod.js having a quote (") at the end. This was being copied through by Browser Mod to frontend resource url, then casing all frontend resource load to fail. I have created a Browser Mod issue to fix, though user can fix URL and issue goes away.