From 7d66e613c891b4b282a42d3f5f35aee03acd94bb Mon Sep 17 00:00:00 2001 From: Christopher Viel Date: Wed, 21 Aug 2024 21:31:54 -0400 Subject: [PATCH] Replace custom view-layout with new badges --- dashboards/badges.yaml | 46 ++++++++++++++++++ dashboards/overview-details.yaml | 28 ++++------- dashboards/overview.yaml | 35 ++++---------- dashboards/view-layout.yaml.j2 | 80 -------------------------------- 4 files changed, 64 insertions(+), 125 deletions(-) create mode 100644 dashboards/badges.yaml delete mode 100644 dashboards/view-layout.yaml.j2 diff --git a/dashboards/badges.yaml b/dashboards/badges.yaml new file mode 100644 index 00000000..1b08f363 --- /dev/null +++ b/dashboards/badges.yaml @@ -0,0 +1,46 @@ +- type: entity + entity: binary_sensor.intrusion_activity + visibility: + - condition: state + entity: binary_sensor.intrusion_activity + state: "on" + +- type: entity + entity: binary_sensor.smoke_detected + visibility: + - condition: state + entity: binary_sensor.smoke_detected + state: "on" + +- type: entity + entity: binary_sensor.carbon_monoxide_detected + visibility: + - condition: state + entity: binary_sensor.carbon_monoxide_detected + state: "on" + +- type: entity + entity: binary_sensor.kitchen_door_lock_jammed + visibility: + - condition: state + entity: binary_sensor.kitchen_door_lock_jammed + state: "on" + +- type: entity + entity: binary_sensor.all_leaks + visibility: + - condition: state + entity: binary_sensor.all_leaks + state: "on" + +- type: entity + entity: valve.main_water_shut_off + visibility: + - condition: or + conditions: + - condition: state + entity: binary_sensor.all_leaks + state: "on" + - condition: state + entity: valve.main_water_shut_off + state: "closed" diff --git a/dashboards/overview-details.yaml b/dashboards/overview-details.yaml index 60a03cf8..baa4dbe4 100644 --- a/dashboards/overview-details.yaml +++ b/dashboards/overview-details.yaml @@ -4,35 +4,23 @@ views: - title: Sensors path: sensors icon: mdi:eye - type: panel - cards: !template - file: view-layout.yaml.j2 - variables: - cards: !include views/sensor-details.yaml + badges: !include badges.yaml + cards: !include views/sensor-details.yaml - title: Media path: media icon: mdi:play-pause - type: panel - cards: !template - file: view-layout.yaml.j2 - variables: - cards: !include views/media-details.yaml + badges: !include badges.yaml + cards: !include views/media-details.yaml - title: Z-Wave path: zwave icon: mdi:z-wave - type: panel - cards: !template - file: view-layout.yaml.j2 - variables: - cards: !include views/zwave-details.yaml + badges: !include badges.yaml + cards: !include views/zwave-details.yaml - title: Settings path: settings icon: mdi:cog - type: panel - cards: !template - file: view-layout.yaml.j2 - variables: - cards: !include views/general-settings.yaml + badges: !include badges.yaml + cards: !include views/general-settings.yaml diff --git a/dashboards/overview.yaml b/dashboards/overview.yaml index 0e9f4d30..597ce86a 100644 --- a/dashboards/overview.yaml +++ b/dashboards/overview.yaml @@ -4,47 +4,32 @@ views: - title: Home path: home icon: mdi:home - type: panel - cards: !template - file: view-layout.yaml.j2 - variables: - cards: !include views/home.yaml + badges: !include badges.yaml + cards: !include views/home.yaml - title: Home Security path: security icon: mdi:shield-home - type: panel - cards: !template - file: view-layout.yaml.j2 - variables: - cards: !include views/security.yaml + badges: !include badges.yaml + cards: !include views/security.yaml - title: Climate path: climate icon: mdi:home-thermometer - type: panel - cards: !template - file: view-layout.yaml.j2 - variables: - cards: !include views/climate.yaml + badges: !include badges.yaml + cards: !include views/climate.yaml - title: Ground Floor path: ground icon: mdi:home-floor-g - type: panel - cards: !template - file: view-layout.yaml.j2 - variables: - cards: !include views/ground-floor.yaml + badges: !include badges.yaml + cards: !include views/ground-floor.yaml - title: Basement path: basement icon: mdi:home-floor-b - type: panel - cards: !template - file: view-layout.yaml.j2 - variables: - cards: !include views/basement.yaml + badges: !include badges.yaml + cards: !include views/basement.yaml - title: Bolt EV path: boltev diff --git a/dashboards/view-layout.yaml.j2 b/dashboards/view-layout.yaml.j2 deleted file mode 100644 index f65f8ce7..00000000 --- a/dashboards/view-layout.yaml.j2 +++ /dev/null @@ -1,80 +0,0 @@ -- type: vertical-stack - cards: - - type: custom:layout-card - layout_type: custom:horizontal-layout - layout: - max_cols: 6 - width: 150 - cards: - - type: conditional - conditions: - - condition: state - entity: binary_sensor.intrusion_activity - state: "on" - card: - type: tile - entity: binary_sensor.intrusion_activity - name: Intrusion - vertical: true - - type: conditional - conditions: - - condition: state - entity: binary_sensor.smoke_detected - state: "on" - card: - type: tile - entity: binary_sensor.smoke_detected - name: Smoke - vertical: true - - type: conditional - conditions: - - condition: state - entity: binary_sensor.carbon_monoxide_detected - state: "on" - card: - type: tile - entity: binary_sensor.carbon_monoxide_detected - name: Carbon monoxide - vertical: true - - type: conditional - conditions: - - condition: state - entity: binary_sensor.kitchen_door_lock_jammed - state: "on" - card: - type: tile - entity: binary_sensor.kitchen_door_lock_jammed - name: Lock jammed - vertical: true - - type: conditional - conditions: - - condition: state - entity: binary_sensor.all_leaks - state: "on" - card: - type: tile - entity: binary_sensor.all_leaks - name: Water leak - vertical: true - - type: conditional - conditions: - - condition: or - conditions: - - condition: state - entity: binary_sensor.all_leaks - state: "on" - - condition: state - entity: valve.main_water_shut_off - state: "off" - card: - type: tile - entity: valve.main_water_shut_off - name: Main water valve - vertical: true - - - type: custom:layout-card - layout_type: custom:masonry-layout - cards: -{% filter indent(width = 8) %} -{{ cards | tojson }} -{% endfilter %}