Hi Team.
Hoping someone can help.
I have three Sensor Groups.
- All Batteries
- Downstairs Batteries
- Upstairs Batteries
The group options of All Batteries has the up and downstairs batteries as members and i have the type set to minimum.
Now when i look at all three they are reporting the minimum vales correctly.
I then have this button card on my dashboard. Now if all batteries were 100% it should be green , then less than 80% colour should be orange and less than 30% turn the colour red.
The issue is , if i reboot HA then the button colour is white. If i remove up or downstairs from the All Batteries group and add them back in again then it displays the correct colour.
Any suggestions
type: custom:button-card
entity: sensor.group_batteries_all
unit_of_measurement: '%'
device_class: battery
show_name: false
theme: synthwave
show_state: false
tap_action:
action: navigate
navigation_path: /dashboard/allbatteries
state:
- value: 'off'
icon: mdi:battery
color: green
- value: 'on'
icon: mdi:battery-10
color: red
styles:
card:
- width: 50px
- height: 50px
- border-color: |
[[[
if (entity.state < 30) return 'red'
if ((entity.state >= 30) && (entity.state < 80)) return 'orange'
else if (entity.state > 80) return 'lime'
]]]
- box-shadow: |
[[[
if (entity.state < 30) return '0px 0px 10px 1px red '
if ((entity.state >= 30) && (entity.state < 80)) return '0px 0px 10px 1px orange '
else if (entity.state > 80) return '0px 0px 10px 1px lime '
]]]
icon: null
- color: |
[[[
if (entity.state < 30) return 'red';
if ((entity.state >= 30) && (entity.state < 80)) return 'orange'
if (entity.state >= 80) ret