以曲線為主(有帶與不帶)
YAML
帶曲線
type: vertical-stack
cards:
- type: custom:mushroom-template-card
primary: >-
目前電量: {{ states(‘sensor.ups_battery_level’) | float | round(0) }}%
secondary: >-
{% if is_state(‘binary_sensor.ups_battery_state’, ‘on’) %}
:white_check_mark: 外部供電中 (電壓: {{ states(‘sensor.ups_bus_voltage’) }}V)
{% else %}
:warning: 電池供電中 (電流: {{ states(‘sensor.ups_current’) }}mA)
{% endif %}
icon: >-
{% if is_state(‘binary_sensor.ups_battery_state’, ‘on’) %}
mdi:power-plug
{% else %}
mdi:battery-alert
{% endif %}
icon_color: >-
{% if is_state(‘binary_sensor.ups_battery_state’, ‘on’) %}
blue
{% else %}
orange
{% endif %}
fill_container: true
multiline_secondary: true
tap_action:
action: more-info
entity: sensor.ups_battery_level - type: custom:mini-graph-card
entities:- entity: sensor.ups_battery_level
name: 電量歷史
line_color: ‘#4caf50’
line_width: 4
font_size: 75
hours_to_show: 24
points_per_hour: 4
show:
name: false
icon: false
state: false
fill: fade
extrema: true
# 讓圖表緊貼上方卡片,節省 7 吋螢幕空間
card_mod:
style: |
ha-card {
margin-top: -10px;
}
- entity: sensor.ups_battery_level
不帶曲線
type: custom:mushroom-template-card
primary: >-
目前電量: {{ states('sensor.ups_battery_level') | float | round(0) }}%
secondary: >-
{% if is_state('binary_sensor.ups_battery_state', 'on') %}
:white_check_mark: 外部供電中 (電壓: {{ states('sensor.ups_bus_voltage') }}V)
{% else %}
:warning: 電池供電中 (電流: {{ states('sensor.ups_current') }}mA)
{% endif %}
icon: >-
{% if is_state('binary_sensor.ups_battery_state', 'on') %}
mdi:power-plug
{% else %}
mdi:battery-alert
{% endif %}
icon_color: >-
{% if is_state('binary_sensor.ups_battery_state', 'on') %}
blue
{% else %}
orange
{% endif %}
fill_container: true
multiline_secondary: true
tap_action:
action: more-info
entity: sensor.ups_battery_level