本帖最后由 relliky 于 2023-1-8 18:38 编辑
哈哈,这个就是首页了,再上就没有了。我只是把它变成subview可以多在最上面显示home这几个字。
按钮原文件在这里
https://github.com/relliky/Tais_ ... rall_dashboard.yaml
写好一个以后我用python写模板生成每个房间的。
一个按钮的写法在这里
type: custom:stack-in-card
mode: vertical
cards:
- type: custom:mushroom-template-card
icon: mdi:silverware-clean
icon_color: blue
layout: horizontal
entity: input_boolean.placeholder
fill_container: true
primary: Kitchen
secondary: "{% set temperature_sensor = 'sensor.kitchen_temperature_sensor' %}\n{% set motion_postfix = 'kitchen_motion' %}\n{{ states(temperature_sensor) }}\xB0C | {{\n (as_timestamp(now()) -\n as_timestamp(states.group[motion_postfix].last_changed)) |\n timestamp_custom("%H:%M", false) }} | {{states('vacuum.x1')}}"
tap_action:
action: navigate
navigation_path: /lovelace-kitchen/kitchen
- type: custom:stack-in-card
mode: horizontal
cards:
- type: custom:mushroom-template-card
icon: "{% set occupancy = 'input_select.kitchen_occupancy' %} {% if is_state(occupancy, 'Outside') %}\n mdi:door-closed\n{% elif is_state(occupancy, 'Just Entered') %}\n mdi:arrow-right-circle\n{% elif is_state(occupancy, 'In Sleep') %}\n mdi:sleep\n{% else %}\n mdi:account-multiple\n{% endif %}"
icon_color: "{% set occupancy = 'input_select.kitchen_occupancy' %} {% if is_state(occupancy, 'Outside') %} {% elif is_state(occupancy, 'Just Entered')%}\n green\n{% elif is_state(occupancy, 'In Sleep') %}\n blue \n{% else %}\n purple\n{% endif %}"
layout: horizontal
entity: input_boolean.placeholder
fill_container: true
primary: null
secondary: null
tap_action:
action: navigate
navigation_path: /lovelace-kitchen/kitchen
- type: custom:mushroom-template-card
icon: "{% set motion = 'group.kitchen_motion' %} \n{% if is_state(motion, 'on') %}\n mdi:run-fast\n{% else %}\n mdi:shoe-print\n{% endif %}"
icon_color: "{% set motion = 'group.kitchen_motion' %} \n{% if is_state(motion, 'on') %}\n pink\n{% endif %}"
layout: horizontal
entity: input_boolean.placeholder
fill_container: true
primary: null
secondary: null
tap_action:
action: navigate
navigation_path: /lovelace-kitchen/kitchen
- type: custom:mushroom-template-card
icon: "{% set thermostat = 'climate.kitchen' %} \n{% if is_state(thermostat, 'heat') %}\n mdi:heating-coil\n{% else %}\n mdi:snowflake\n{% endif %}"
icon_color: "{% set thermostat = 'climate.kitchen' %} \n{% if is_state(thermostat, 'heat') %}\n red\n{% endif %}"
layout: horizontal
entity: input_boolean.placeholder
fill_container: true
primary: null
secondary: null
tap_action:
action: navigate
navigation_path: /lovelace-kitchen/kitchen
- type: custom:mushroom-template-card
icon: "{% set light = 'group.kitchen_lights_and_tvs' %} \n{% if is_state(light, 'on') %}\n mdi:floor-lamp\n{% else %}\n mdi:floor-lamp-outline\n{% endif %}"
icon_color: "{% set light = 'group.kitchen_lights_and_tvs' %} \n{% if is_state(light, 'on') %}\n yellow\n{% endif %}"
layout: horizontal
entity: input_boolean.placeholder
fill_container: true
primary: null
secondary: null
tap_action:
action: navigate
navigation_path: /lovelace-kitchen/kitchen
主要用custom:stack-in-card在卡片里面塞卡片。然后用了5个template卡片,1个放上面,4个放下面组成。
|