主页第一行用 Mushroom 的 chips 实现:
第一个 chip 类型为天气 Weather,选择天气实体。
第二个 chip 类型为模板 Template,数据来自 lights_on 这个自定义模板传感器,图标颜色根据亮着的灯的数量变化,点击动作为导航到 lights 这个视图
第三个 chip 类型也是模板,显示室内温度传感器的最低值和最高值
第四个 chip 类型还是模板,根据门磁的状态显示
YAML 代码如下
cards:
- type: custom:mushroom-chips-card
chips:
- type: weather
entity: weather.tian_qi
show_conditions: true
show_temperature: true
- type: template
content: '{{ states(''sensor.lights_on'') }}'
icon: mdi:lightbulb-group
icon_color: |-
{% if ((states('sensor.lights_on') | int) > 0) %}
amber
{% else %}
gray
{% endif %}
tap_action:
action: navigate
navigation_path: lights
- type: template
tap_action:
action: navigate
navigation_path: indoor
content: >-
{{ label_entities('Sensor:IndoorTemperature') | expand |
map(attribute='state') | min | round(1) }}°C - {{
label_entities('Sensor:IndoorTemperature') | expand |
map(attribute='state') | max | round(1) }}°C
icon: mdi:thermometer
icon_color: light-green
- type: template
icon: >-
{% if
is_state('binary_sensor.door_window_sensor_158d00015ae934',
'off') %}mdi:door-closed{% else %}mdi:door-open{% endif %}
icon_color: >-
{% if
is_state('binary_sensor.door_window_sensor_158d00015ae934',
'off') %}blue{% else %}red{% endif %}
content: >-
门{% if
is_state('binary_sensor.door_window_sensor_158d00015ae934',
'off') %}关{% else %}开{% endif %}着
tap_action:
action: navigate
navigation_path: security
alignment: center
|