Add Active Scene to the Title of component
andrei-micu-ro opened this issue · 1 comments
Hi,
I love your card, it brings colors to dull and monochromatic dashboard where I only have sliders.
I'm mainly using it as a "category header" to separate light sliders throughout the house (imagine all lights in the house in a vertical list and this component is mainly separating the sliders by room - where I'm grouping all the lights in each room and also adding the Scene selection to rooms)
The only limitation I see is that I would love to have the Selected Scene shown in the Title.
As such:
To do this I made a hack in the code.
Initially it was like this (hue-like-light-card.js:336 - prettyPrinted):
render(){
const t=this._config.getTitle(this._ctrl),e=()=>{this.requestUpdate(),this.updateStyles()
};
I made it like this:
render(){
const title=this._config.getTitle(this._ctrl);
const t=title.substr(0,title.indexOf('{')>0 ? title.indexOf('{')-3 : title.length);
const t_scene=(title.indexOf('{')>0) ? " - " + this._hass.states[title.substr(title.indexOf('{')+2, title.indexOf('}')-title.indexOf('{')-2)].state:""
,e=()=>{this.requestUpdate(),this.updateStyles()
};
And added the t_scene below (line 346):
${t}**_${t_scene}_**
In the configuration I appended this "parameter" to the "title": "- {{sensor.living_room_active_scene}}" (this is a template sensor I have in HA to show the current Scene
Just to make it configurable (and have it display without the scene where needed).
Now, ideally I would add a new parameter with the scene sensor to make the code nicer - If I'll do it I'll submit a PR directly
So, I think this is a good addition and maybe you want to squeeze it in the next version :)
Hi,
thank you for your feature proposal.
I will look for some way to use templating for title (and for description, that I'm also planning to add).