diff --git a/lovelace/functions/car.yaml b/lovelace/functions/car.yaml new file mode 100644 index 0000000..474f4ed --- /dev/null +++ b/lovelace/functions/car.yaml @@ -0,0 +1,38 @@ +# lovelace_gen +type: picture-elements +entity: sensor.{{car}}_bt +image: /local/images/{{car}}_clr.jpg +elements: + - type: image + image: /local/images/{{car}}_clr.jpg + entity: sensor.{{car}}_bt + tap_action: + action: call-service + service: homeassistant.toggle + service_data: + entity_id: switch.varme_{{car}} + style: + left: 50% + top: 50% + width: 100% + height: 100% + - type: state-icon + entity: switch.varme_{{car}} + style: + bottom: 0 + left: 0 + transform: translate(0,0) + background: rgba(0,0,0,0.5) + width: 100px + icon: mdi:fan + tap_action: + action: toggle + - type: state-label + entity: sensor.varme_{{car}}_power + graph: line + style: + bottom: 0 + left: 30px + transform: translate(0,0) + --primary-text-color: white + color: white diff --git a/lovelace/functions/popup.yaml b/lovelace/functions/popup.yaml new file mode 100644 index 0000000..233857c --- /dev/null +++ b/lovelace/functions/popup.yaml @@ -0,0 +1,10 @@ +# lovelace_gen +action: call-service +service: browser_mod.command +service_data: + command: popup + deviceID: + - this + title: {{ title }} + card: !include {{ card }} + large: {{ large | default("false") }} diff --git a/lovelace/functions/presence.yaml b/lovelace/functions/presence.yaml new file mode 100644 index 0000000..751dcf3 --- /dev/null +++ b/lovelace/functions/presence.yaml @@ -0,0 +1,40 @@ +# lovelace_gen +type: picture-entity +entity: device_tracker.{{person}}_presence +image: /local/images/{{person}}_bw.png +show_name: false +show_state: false +state_image: + "home": /local/images/{{person}}_clr.png + "just_arrived": /local/images/{{person}}_clr.png +tap_action: + action: call-service + service: browser_mod.command + service_data: + command: popup + deviceID: [this] + title: {{ person|capitalize }} + large: true + card: + type: vertical-stack + cards: + - type: entities + entities: &entities + {% if person == "thomas" %} + - device_tracker.thomas_iphone_beta + - device_tracker.thomas_iphone_2 + - sensor.thomas_iphone_bt + - sensor.thomas_iphone_bt2 + {% elif person == "anneli" %} + - device_tracker.anneli_lovn + - device_tracker.anneli_loven + - sensor.anneli_iphone_bt + - sensor.anneli_iphone_bt2 + - sensor.anneli_klocka_bt + - sensor.anneli_klocka_bt2 + {% endif %} + - type: history-graph + entities: + - device_tracker.{{person}}_presence + - type: history-graph + entities: *entities diff --git a/lovelace/popups/doors.yaml b/lovelace/popups/doors.yaml new file mode 100644 index 0000000..bbf1e46 --- /dev/null +++ b/lovelace/popups/doors.yaml @@ -0,0 +1,10 @@ +type: vertical-stack +cards: +- type: entities + entities: &door_entities + - binary_sensor.hall_ytterdorr + - binary_sensor.tvattstuga_ytterdorr + - binary_sensor.vardagsrum_ytterdorr + - binary_sensor.sovrum_ytterdorr +- type: history-graph + entities: *door_entities diff --git a/lovelace/vacuum_card.yaml b/lovelace/popups/vacuum.yaml similarity index 100% rename from lovelace/vacuum_card.yaml rename to lovelace/popups/vacuum.yaml diff --git a/lovelace/views/dashboard_view.yaml b/lovelace/views/dashboard_view.yaml index d65e481..143fca5 100644 --- a/lovelace/views/dashboard_view.yaml +++ b/lovelace/views/dashboard_view.yaml @@ -10,21 +10,15 @@ cards: rtl: true cards: - type: custom:layout-card - column_width: 150 - max_width: 200 + column_width: 200 + max_width: 300 cards: - - type: entity-button - entity: switch.varme_jst - name: JST - icon: mdi:fan - tap_action: - action: toggle - - type: entity-button - entity: switch.varme_mhr - name: MHR - icon: mdi:fan - tap_action: - action: toggle + - !include + - /config/lovelace/functions/car.yaml + - car: peugeot + - !include + - /config/lovelace/functions/car.yaml + - car: golf - break - type: custom:layout-card column_width: 350 @@ -53,22 +47,12 @@ cards: - break - type: horizontal-stack cards: - - type: picture-entity - entity: device_tracker.thomas_presence - image: /local/images/thomas_bw.jpg - show_name: false - show_state: false - state_image: - "home": /local/images/thomas_clr.jpg - "just_arrived": /local/images/thomas_clr.jpg - - type: picture-entity - entity: device_tracker.anneli_presence - image: /local/images/anneli_bw.png - show_name: false - show_state: false - state_image: - "home": /local/images/anneli_clr.png - "just_arrived": /local/images/anneli_clr.png + - !include + - /config/lovelace/functions/presence.yaml + - person: thomas + - !include + - /config/lovelace/functions/presence.yaml + - person: anneli - type: horizontal-stack cards: - type: entity-button @@ -87,8 +71,16 @@ cards: - type: entity-button entity: vacuum.xiaomi_vacuum_cleaner name: Dammsugare + tap_action: !include + - /config/lovelace/functions/popup.yaml + - title: Dammsugare + card: /config/lovelace/popups/vacuum.yaml - type: entity-button entity: binary_sensor.sopor - type: entity-button entity: binary_sensor.door_open name: Öppen dörr + tap_action: !include + - /config/lovelace/functions/popup.yaml + - title: Öppna dörrar + card: /config/lovelace/popups/doors.yaml