Hi @LE0N ,
could you (or anybody else) share your code for the template sensor for the television card with me, to display the correct source from the media_player source list? Thanks a lot.
Hi @LE0N ,
could you (or anybody else) share your code for the template sensor for the television card with me, to display the correct source from the media_player source list? Thanks a lot.
Try this - I donāt have a suitable bin calendar to test but the rest should work.
type: custom:button-card
template: title_card
entity: sensor.greeting_time
show_icon: false
show_label: true
name: >
[[[
const emojis = ["!", ".", ". š", "! š", ". š¤©"];
const randomEmoji = emojis[Math.floor(Math.random() * emojis.length)];
return (entity.state) + ', ' + hass.user.name + randomEmoji
]]]
label: >
[[[
const weather = states['weather.buienrader'].state;
const outdoorTemperature = states['sensor.outdoor_temperature'].state;
const evBatteryLevel = states['sensor.ev6_ev_battery_level'].state;
const evRange = states['sensor.ev6_ev_range'].state;
const binsMessage = states['calendar.bins'].attributes.message;
const binsStartTime = states['calendar.bins'].attributes.start_time;
const weatherString = `āš” The weather is ${weather} and it's ${outdoorTemperature}Ā°C outside.`;
let evStatusString = `<br> š`;
if (evBatteryLevel === 'unavailable') {
`<br> š`
} else if (parseFloat(evBatteryLevel) > 50) {
evStatusString += ` EV6 battery is almost empty, battery level is ${evBatteryLevel}% (${evRange} KM range)`;
} else {
`<br> š`;
}
const binsDateString = `<br>ā»ļø ${binsMessage} on ${new
Date(binsStartTime).toLocaleDateString('en-US', {
day: 'numeric',
month: 'short'
})}`;
return weatherString + evStatusString + binsDateString
]]]
Heya,
This is a really simple change. Under the state section and style, just add ābackgroundā and then the colour you want. So for example;
- value: home
styles:
card:
- background: '#CEF595'
entity_picture:
- border: 2px solid var(--severity-5)
Hope this helps
Very much! Thanks a lot
Focused to much on the ābackground_colorā
Hello,
I like very much this theme . Iāll try to implement it
Thank you very much! This has definitely helped me with my ā2 card layoutā. This will help me a lot with the dashboard in the mobile version.
In the meantime I have also realized that it is easier for me to work with rectangular button-cards only. For one thing, it looks better and more uniform, and for another, it makes the layout easier for me.
Unfortunately, I still canāt manage to write the layout in such a way that the height adapts to the tabletā¦ But since I donāt want to annoy you with my constant questions, Iāve created a thread here in the hope that the community will know what to do. If you still donāt mind, I would of course, as always, be very happy about your help =)
Hey @jeells102, could you please share your code from one of your plug cards? Iād really appreciate it!
Hey!
Yeah youāve got it!
type: custom:button-card
entity: switch.media_centre
name: Media Centre
show_icon: false
styles:
card:
- border-radius: 25px
- border-style: none
- box-shadow: 0px 0px 10px -9px black
- background-color: |
[[[
return states['switch.media_centre'].state === 'on' ? '#CEF595' : '';
]]]
grid:
- grid-template-areas: '"icon_cells" "n" "button"'
- grid-template-columns: 1fr
- grid-template-rows: 1fr min-content min-content
custom_fields:
icon_cells:
- justify-self: start
- margin-top: 12px
- margin-left: 15px
name:
- font-size: 90%
- font-weight: bold
- justify-self: start
- margin-top: 6px
- margin-left: 15px
- color: |
[[[
return states['switch.media_centre'].state === 'on' ? 'black' : 'grey';
]]]
custom_fields:
icon_cells: |
[[[
var state = states['switch.media_centre'].state;
if(state == "on")
return `<ha-icon
icon="mdi:television-classic"
style="width: 25px; height: 25px; color: black;">
</ha-icon>
`;
else
return `<ha-icon
icon="mdi:television-classic-off"
style="width: 25px; height: 25px; color: grey;">
</ha-icon>
`;
]]]
button:
card:
type: custom:button-card
entity: switch.media_centre
show_icon: false
show_name: false
styles:
card:
- border-style: none
- margin-top: '-4%'
- margin-bottom: '-5%'
- background-color: transparent
grid:
- grid-template-areas: '"state icon_cells"'
- grid-template-columns: min-content 1fr
- grid-template-rows: min-content
custom_fields:
state:
- justify-self: start
- align-self: middle
- font-size: 12px
- filter: opacity(50%)
- margin-left: 15px
- margin-top: 1.6px
icon_cells:
- justify-self: end
- align-self: start
- margin-right: 15px
- width: 45px
custom_fields:
icon_cells: |
[[[
var state = states['switch.media_centre'].state;
if(state == "on")
return `<ha-icon
icon="mdi:toggle-switch"
style="color: #000000;">
</ha-icon>
`;
else
return `<ha-icon
icon="mdi:toggle-switch-off"
style="color: grey;">
</ha-icon>
`;
]]]
state: |
[[[
var state = states['switch.media_centre'].state
var power = states['sensor.media_centre_power'].state
if(state == "on")
return `<span style="color: black;">${power}W</span>
`;
else
return `<span style="color: grey;">Off</span>
`;
]]]
the plugs cards look great. Can you maybe share the code? that would be really nice
Hey,
I posted my plug card in this post - š£ Rounded - Dashboard guide - #382 by jeells102
Take a look there
Unbelievable, Iāve probably gone through this whole thread 5 times and must have missed it. It was so close that I almost hit my head on it thank you very much
Awesome theme and instructions. Love this material design. Combined with bubble card, this is incredible. Created a custom HVAC Button-Card for my Aquara E1 as well.
How does it look like?
Hello guys, I just started with the cool theme today and Iām thrilled.
But I have a small problem that I canāt get any further at the moment.
I can no longer click the edit button because it disappears under the ābottom barā.
And is it possible to use Bubble Card without this offset to the right (I hope you can see it in this bright picture). Itās no longer in the middle.
Thanks for your help
How do I have to adapt the code so that I have the edit button higher up?
I dont know how to fix that:
I think iāve tried everything in this thread to minimize the margin between cards but i canāt seem to fix it.Whats the easiest way of setting the top and bottom margin for all cards?
In the generated html i see this for example:
<hui-horizontal-stack-card style="margin-bottom: 40px;margin-top: 5px;">
Iāve done nothing fancy. Just copied the examples from Leonā¦
Ok, found it: masonry-view-card-margin: 10px 20px
Iāll show you another dashboard that I created by collecting ideas from the community and revisiting them a bit, thanks to all the people who shared their creations!
Hi @Arroma. That looks great! Simple but professional
Is there any way you could share the code for your dashboard/theme with us. GitHub or something similar?
It would be great to be able to try that out for myself
Proud to see that you are interested!
I added the link to github
Thanks you so much
I will definitely take a look at it and try it out