The following code, shows a BubbleCard with Entity name (Kettle) and then state being ON below, to the right it either shows current consumption for example 3,320.3 w or if its below 2 watts it just shows the daily consumption being ex. 1.2354 kWh, how do I get this value to show just 1.24 kWh instead?
type: custom:bubble-card
card_type: button
use_accent_color: true
show_state: true
show_last_changed: false
show_attribute: false
card_layout: normal
button_type: switch
slider_live_update: true
hold_action:
action: toggle
double_tap_action:
action: none
scrolling_effect: false
show_icon: true
icon: mdi:power
tap_action:
action: none
grid_options:
columns: 6
rows: 1
button_action:
tap_action:
action: none
double_tap_action:
action: none
hold_action:
action: none
name: Kettle
show_name: true
styles: |-
.bubble-button-background {
background-color: ${state === 'on' ? '#282828' : "#ff0000"} !important;
}
.bubble-icon { color: ${state === 'on' ? '#FFFFFF' : '#4C4C4C'} !important;
}
entity: switch.sm06_kettle_7556
sub_button:
- entity: sensor.sm06_kettle_7556_today_s_consumption
state_background: false
show_background: false
show_name: false
show_icon: false
show_last_changed: false
show_state: true
visibility:
- condition: and
conditions:
- condition: numeric_state
entity: sensor.sm06_kettle_7556_current_consumption
below: 2
- condition: state
entity: switch.sm06_kettle_7556
state: "on"
card_mod:
style: |
ha-card {
background-color: {% if states(config.sub_button[0].entity) | float > 5 %} #EE2722 {% else %} #282828 {% endif %} !important;
}