diff --git a/config/lovelace/home_dashboard/main_dashboard.yaml b/config/lovelace/home_dashboard/main_dashboard.yaml index 45b947d..bdbf491 100644 --- a/config/lovelace/home_dashboard/main_dashboard.yaml +++ b/config/lovelace/home_dashboard/main_dashboard.yaml @@ -164,7 +164,10 @@ state_indicator_off_size: 0px state_indicator_on_color: var(--color-red) state_on_indicator_on_color: var(--color-red) - + - type: custom:button-card + template: default + entity: vacuum.vacuum + name: Vacuum - type: custom:decluttering-card template: brita_water_card diff --git a/config/lovelace/home_dashboard/vacuum_dashboard.yaml b/config/lovelace/home_dashboard/vacuum_dashboard.yaml new file mode 100644 index 0000000..60511d8 --- /dev/null +++ b/config/lovelace/home_dashboard/vacuum_dashboard.yaml @@ -0,0 +1,43 @@ +- type: custom:mod-card + style: + layout-card: + $: + .: | + #columns { + padding: 0 10px; + } + #columns .column { + padding: 0 10px; + } + card: + type: custom:layout-card + layout: horizontal + max_columns: 2 + cards: + - type: custom:vacuum-card + entity: vacuum.vacuum + stats: + default: + - attribute: filter_left + unit: hours + subtitle: Filter + - attribute: side_brush_left + unit: hours + subtitle: Side brush + - attribute: main_brush_left + unit: hours + subtitle: Main brush + - attribute: sensor_dirty_left + unit: hours + subtitle: Sensors + cleaning: + - attribute: cleaned_area + unit: m2 + subtitle: Cleaning area + - attribute: cleaning_time + unit: minutes + subtitle: Cleaning time + - type: custom:xiaomi-vacuum-map-card + entity: vacuum.vacuum + camera_calibration: true + map_camera: camera.xiaomi_cloud_map_extractor diff --git a/config/lovelace/resources.yaml b/config/lovelace/resources.yaml index 7b4bdf5..f801116 100644 --- a/config/lovelace/resources.yaml +++ b/config/lovelace/resources.yaml @@ -44,15 +44,18 @@ url: /hacsfiles/kb-better-graph-colors/kb-better-graph-colors.js - type: module url: /hacsfiles/travel-time-card/travel-time-card.js +- type: module + url: /hacsfiles/vacuum-card/vacuum-card.js - type: module url: /hacsfiles/vertical-stack-in-card/vertical-stack-in-card.js - type: module url: /hacsfiles/weather-card/weather-card.js +- type: module + url: /hacsfiles/lovelace-xiaomi-vacuum-map-card/xiaomi-vacuum-map-card.js - type: module url: /hacsfiles/zigbee2mqtt-networkmap/zigbee2mqtt-networkmap.js - - type: module url: /hacsfiles/lovelace-folder-card/folder-card.js - type: module diff --git a/config/packages/devices/vacuum.yaml b/config/packages/devices/vacuum.yaml new file mode 100644 index 0000000..6ffba62 --- /dev/null +++ b/config/packages/devices/vacuum.yaml @@ -0,0 +1,43 @@ +vacuum: + - platform: xiaomi_miio + host: !secret vacuum_host + token: !secret vacuum_token + name: vacuum + +camera: + - platform: xiaomi_cloud_map_extractor + host: !secret vacuum_host + token: !secret vacuum_token + username: !secret vacuum_username + password: !secret vacuum_password + draw: ['all'] + attributes: + - calibration_points + - charger + - goto + - goto_path + - goto_predicted_path + - image + - is_empty + - map_name + - no_go_areas + - no_mopping_areas + - obstacles + - path + - room_numbers + - rooms + - vacuum_position + - vacuum_room + - walls + - zones + colors: + color_map_outside: [35, 35, 35] + color_map_wall: [255, 255, 255] + color_map_inside: [10, 10, 10] + room_colors: + 1: [240, 178, 122] + 2: [133, 193, 233] + 3: [217, 136, 128] + 4: [52, 152, 219] + 5: [205, 97, 85] + 6: [243, 156, 18] diff --git a/config/secrets.example.yaml b/config/secrets.example.yaml index 0354580..d7d9afc 100644 --- a/config/secrets.example.yaml +++ b/config/secrets.example.yaml @@ -73,6 +73,11 @@ tautulli_url: url portainer_url: url tasmo_admin_url: url +vacuum_host: 127.0.0.1 +vacuum_token: token +vacuum_username: email +vacuum_password: password + # # ─── CLOUD AUTHENTICATION ─────────────────────────────────────────────────────── # diff --git a/config/templates/partials/tasks.yaml b/config/templates/partials/tasks.yaml index 8a410a0..13b06eb 100644 --- a/config/templates/partials/tasks.yaml +++ b/config/templates/partials/tasks.yaml @@ -1,9 +1,19 @@ >- {% set brita_filter = is_state('binary_sensor.brita_should_change_filter', 'on') %} + {% set purifier_filter = is_state('binary_sensor.purifier_filter_needs_change', 'on') %} {% set purifier_water = is_state('binary_sensor.purifier_out_of_water', 'on') %} - {% set has_tasks = brita_filter or purifier_filter or purifier_water %} + {% set has_purifier_tasks = purifier_filter or purifier_water %} + + {% set vacuum_entity = 'vacuum.vacuum' %} + {% set vacuum_main_brush = state_attr(vacuum_entity, 'main_brush_left') | int == 0 %} + {% set vacuum_side_brush = state_attr(vacuum_entity, 'side_brush_left') | int == 0 %} + {% set vacuum_filter = state_attr(vacuum_entity, 'filter_left') | int == 0 %} + {% set vacuum_sensor = state_attr(vacuum_entity, 'sensor_dirty_left') | int == 0 %} + {% set has_vacuum_tasks = vacuum_main_brush or vacuum_side_brush or vacuum_filter or vacuum_sensor %} + + {% set has_tasks = brita_filter or has_purifier_tasks or has_vacuum_tasks %} {%- if has_tasks -%} {{ [ @@ -13,6 +23,10 @@ ] | random }} {% endif %} - {%- if brita_filter -%} Brita needs filter change. {% endif %} - {%- if purifier_filter -%} Purifier needs filter change. {% endif %} - {%- if purifier_water -%} Purifier needs water. {%- endif -%} + {%- if brita_filter -%} Brita needs filter change. {% endif %} + {%- if purifier_filter -%} Purifier needs filter change. {% endif %} + {%- if purifier_water -%} Purifier needs water. {%- endif -%} + {%- if vacuum_main_brush -%} Vacuum main brush needs changing. {%- endif -%} + {%- if vacuum_side_brush -%} Vacuum side brush needs changing. {%- endif -%} + {%- if vacuum_filter -%} Vacuum filter needs changing. {%- endif -%} + {%- if vacuum_sensor -%} Vacuum sensor needs cleaning. {%- endif -%} diff --git a/config/ui-lovelace.yaml b/config/ui-lovelace.yaml index 89687ff..e22d6c8 100644 --- a/config/ui-lovelace.yaml +++ b/config/ui-lovelace.yaml @@ -34,3 +34,8 @@ views: icon: "mdi:door-closed" panel: true cards: !include lovelace/home_dashboard/hallway_dashboard.yaml + - title: Vacuum + path: vacuum + icon: "mdi:robot-vacuum" + panel: true + cards: !include lovelace/home_dashboard/vacuum_dashboard.yaml