Untitled
unknown
plain_text
a year ago
5.2 kB
18
Indexable
- type: custom:button-card
entity: sensor.fire_tablet_battery
icon: |
[[[
if (entity.state < 6)
{
if (states['binary_sensor.fire_tablet_plugged_in'].state == 'off')
{
return 'mdi:battery-alert-variant-outline';
}
else
{
return 'mdi:battery-charging-outline';
}
}
else if (entity.state < 10)
{
if (states['binary_sensor.fire_tablet_plugged_in'].state == 'off')
{
return 'mdi:battery-outline';
}
else
{
return 'mdi:battery-charging-outline';
}
}
else if (entity.state < 15)
{
if (states['binary_sensor.fire_tablet_plugged_in'].state == 'off')
{
return 'mdi:battery-10';
}
else
{
return 'mdi:battery-charging-10';
}
}
else if (entity.state < 25)
{
if (states['binary_sensor.fire_tablet_plugged_in'].state == 'off')
{
return 'mdi:battery-20';
}
else
{
return 'mdi:battery-charging-20';
}
}
else if (entity.state < 35)
{
if (states['binary_sensor.fire_tablet_plugged_in'].state == 'off')
{
return 'mdi:battery-30';
}
else
{
return 'mdi:battery-charging-30';
}
}
else if (entity.state < 45)
{
if (states['binary_sensor.fire_tablet_plugged_in'].state == 'off')
{
return 'mdi:battery-40';
}
else
{
return 'mdi:battery-charging-40';
}
}
else if (entity.state < 55)
{
if (states['binary_sensor.fire_tablet_plugged_in'].state == 'off')
{
return 'mdi:battery-50';
}
else
{
return 'mdi:battery-charging-50';
}
}
else if (entity.state < 65)
{
if (states['binary_sensor.fire_tablet_plugged_in'].state == 'off')
{
return 'mdi:battery-60';
}
else
{
return 'mdi:battery-charging-60';
}
}
else if (entity.state < 75)
{
if (states['binary_sensor.fire_tablet_plugged_in'].state == 'off')
{
return 'mdi:battery-70';
}
else
{
return 'mdi:battery-charging-70';
}
}
else if (entity.state < 85)
{
if (states['binary_sensor.fire_tablet_plugged_in'].state == 'off')
{
return 'mdi:battery-80';
}
else
{
return 'mdi:battery-charging-80';
}
}
else if (entity.state < 95)
{
if (states['binary_sensor.fire_tablet_plugged_in'].state == 'off')
{
return 'mdi:battery-90';
}
else
{
return 'mdi:battery-charging-90';
}
}
else
{
if (states['binary_sensor.fire_tablet_plugged_in'].state == 'off')
{
return 'mdi:battery';
}
else
{
return 'mdi:battery-charging';
}
}
]]]
show_name: false
show_state: true
styles:
icon:
- margin-top: '-10px'
- height: 40px
- width: 40px
- color: |
[[[
if (entity.state < 30)
{
return 'rgb(244, 67, 54)';
}
else if (entity.state < 70)
{
return 'rgb(255, 152, 0)';
}
else
{
return 'rgb(76, 175, 80)';
}
]]]
state:
- margin-top: '-25px'
- font-size: 14px
- font-weight: bold
card:
- width: 50px
- height: 80px
card_mod:
style: |
ha-card {
border: none !important;
background: none
}Editor is loading...
Leave a Comment