Soooo, maybe this will work as well?
...
{%- set ns.COMMAND = (ns.COMMAND)[:-1] -%}
{{ ns.COMMAND | from_json }}
Soooo, maybe this will work as well?
...
{%- set ns.COMMAND = (ns.COMMAND)[:-1] -%}
{{ ns.COMMAND | from_json }}
Made this, gonna test it after completion of the started cleaning:
params: >-
{% set ns = namespace(COMMAND = "") -%}
{%- set ROOM_FLAGS = expand('group.vacuum_clean_rooms') -%}
{%- for flag in ROOM_FLAGS -%}
{%- if flag.entity_id | regex_match("input_boolean.vacuum_clean_room_", ignorecase=False) and
is_state(flag.entity_id,'on') -%}
{%- set ROOM = flag.entity_id.split("vacuum_clean_room_")[1] -%}
{%- set ROOM_NUMBER = states('input_number.vacuum_clean_room_number_' + ROOM)|int -%}
{%- set CLEAN_COUNT = states('input_number.vacuum_clean_room_count_' + ROOM)|int -%}
{%- set ROOM_NUMBER_STRING = (ROOM_NUMBER|string +"|int" + ",") * CLEAN_COUNT -%}
{%- set ns.COMMAND = ns.COMMAND + ROOM_NUMBER_STRING -%}
{%- endif -%}
{%- endfor -%}
{%- set ns.COMMAND = (ns.COMMAND)[:-1] -%}
[{{ ns.COMMAND }}]
Actually, I have never used from_json
things, need some time for testing…
Update:
Because of unknown reasons the script above did not work - same error as before…
So I went back to the previous version with this expression:
[{{ ns.COMMAND }}]
and without this expression:
+"|int"
Code:
vacuum_clean_rooms:
alias: 'vacuum: Clean rooms'
sequence:
- service: vacuum.send_command
data:
entity_id: vacuum.xiaomi_roborock_s50
command: app_segment_clean
params: >-
{% set ns = namespace(COMMAND = "") -%}
{%- set ROOM_FLAGS = expand('group.vacuum_clean_rooms') -%}
{%- for flag in ROOM_FLAGS -%}
{%- if flag.entity_id | regex_match("input_boolean.vacuum_clean_room_", ignorecase=False) and
is_state(flag.entity_id,'on') -%}
{%- set ROOM = flag.entity_id.split("vacuum_clean_room_")[1] -%}
{%- set ROOM_NUMBER = states('input_number.vacuum_clean_room_number_' + ROOM)|int -%}
{%- set CLEAN_COUNT = states('input_number.vacuum_clean_room_count_' + ROOM)|int -%}
{%- set ROOM_NUMBER_STRING = (ROOM_NUMBER|string +",") * CLEAN_COUNT -%}
{%- set ns.COMMAND = ns.COMMAND + ROOM_NUMBER_STRING -%}
{%- endif -%}
{%- endfor -%}
{%- set ns.COMMAND = (ns.COMMAND)[:-1] -%}
[{{ ns.COMMAND }}]
Probably earlier I started the script before it was actually updated in HA after correction.
So to be sure I restarted HA - and the script works!
Now everything looks OK:
expanded control panel:
expanded settings with restricted access:
hey, I’m new in HA so sorry for probably stupid questions. questions are related to both Xiaomi Cloud Vacuum Map Extractor
and Lovelace Xiaomi Vacuum Map card
:
Lovelace Xiaomi Vacuum Map card
). I understand, that probably it is out of scope, but for new users it can be very helpful. tried first via Vacuum
integration, but entity didn’t appear. then tried via Xiaomi Miio
and finally get entity. but this integration cannot be configured via config. is it correct way?rooms/room_numbers
attribute - and what next? in tons of comments I found that I should check it in dev tools. how? what should I do to see it? https://i.imgur.com/OECBfta.png why docs is so not new-user-friendly
Lovelace Xiaomi Vacuum Map card
, but bottom row still has mixed texts from english and russian. is it a bug? missing translation? misconfiguration? https://i.imgur.com/XJyWlIE.png
thanks in advance.
That is the way I have set up mine, over a year ago. As far as I know, that’s still how it’s done.
Vacuum configuration depends on specific model, I am not able to cover all cases. You should use an integration that supports your model, built-in Xiaomi Miio is always a good first shot.
It’s possible to do it. Discussion: link
This screenshot shows attributes of the vacuum, room numbers are in attributes of a camera entity.
These values are entity states/attributes, which currently are not translated. Maybe I will add possibility to translate them in future versions of the card.
@3_14 thank you, finally got what I wanted:
tap_action/hold_action/double_tap_action
options in config, but better to have example.
Kind of this code (russian:Choto tipa takogo):
- type: custom:button-card
template: button_card_template__simple_button_red
name: Сбросить наработку щетки
tap_action:
action: call-service
service: vacuum.send_command
service_data:
entity_id: '[[SENSOR_VACUUM]]'
command: reset_consumable
params:
- main_brush_work_time
confirmation: &ref_confirmation
text: |
Сбросить время наработки?
Данное действие необратимо
...
- type: custom:button-card
template: button_card_template__simple_button_red
name: Сбросить наработку щетки
tap_action:
action: call-service
service: vacuum.send_command
service_data:
entity_id: '[[SENSOR_VACUUM]]'
command: reset_consumable
params:
- side_brush_work_time
confirmation: *ref_confirmation
...
- type: custom:button-card
template: button_card_template__simple_button_red
name: Сбросить наработку фильтра
tap_action:
action: call-service
service: vacuum.send_command
service_data:
entity_id: '[[SENSOR_VACUUM]]'
command: reset_consumable
params:
- filter_work_time
confirmation: *ref_confirmation
...
- type: custom:button-card
template: button_card_template__simple_button_red
name: Сбросить наработку сенсоров
tap_action:
action: call-service
service: vacuum.send_command
service_data:
entity_id: '[[SENSOR_VACUUM]]'
command: reset_consumable
params:
- sensor_dirty_time
confirmation: *ref_confirmation
This has stopped working on the latest beta, 2021.12.0b1 error below
Entity camera.xiaomi_cloud_map_extractor (<class ‘custom_components.xiaomi_cloud_map_extractor.camera.VacuumCamera’>) implements device_state_attributes. Please report it to the custom component author
And now these warnings in 2021.12.0 release.
Why do I constantly have this:
I have 2.1.1 installed via HACS.
This error originated from a custom integration.
Logger: custom_components.xiaomi_cloud_map_extractor.camera
Source: custom_components/xiaomi_cloud_map_extractor/camera.py:333
Integration: xiaomi_cloud_map_extractor (documentation, issues)
First occurred: 09:14:27 (1 occurrences)
Last logged: 09:14:27
Unable to retrieve map data
But does it work despite this error?
I see the same errors like @sender in the error logs. On a daily base and multiple times. They happen since v.1-times already but I just ignore them because all is seemingly working despite of the error:
However, what is strange is that this error only occurs on one of my two identic S5 Max devices (same model, same firmware, same configuration, same wlan/ssid).
maybe a wifi issue?
This is in fact what I am suspecting although I have full wifi coverage throughout the whole floor.
I have done several wifi-resets before but it does not help. But as I said before: Since the vacuum doesn’t seem to loose its functionality I have learned to just ignore the error messages (although they somehow still bother me )
There are several steps that are required for successful map download:
If any of these steps fails to succeed the map will not be returned.
The error messages are only showing from time to time (multiple times daily though). The map retrieval itself seems to work:
For me the maps also shows (works) but this is one of the top-level errors all day…
Hi Tamsy,
can you share your COde?
Damn looks good
Sure, but it is not finished yet. Still work in progress.
Within configuration.yaml :
camera:
- platform: xiaomi_cloud_map_extractor
host: !secret xiaomi_vacuum_host_unten
token: !secret xiaomi_vacuum_token_unten
username: !secret xiaomi_cloud_username
password: !secret xiaomi_cloud_password
country: "de"
name: "Roborock unten"
scan_interval: 10
store_map_raw: true
colors:
color_map_inside: [32, 115, 185]
color_map_outside: [19, 87, 148]
color_map_wall: [100, 196, 254]
color_map_wall_v2: [93, 109, 126]
color_grey_wall: [93, 109, 126]
color_path: [147, 194, 238]
color_goto_path: [0, 255, 0]
color_predicted_path: [255, 255, 0, 0]
color_zones: [0xAD, 0xD8, 0xFF, 0x8F]
color_zones_outline: [0xAD, 0xD8, 0xFF]
color_virtual_walls: [255, 0, 0]
color_no_go_zones: [255, 33, 55, 127]
color_no_go_zones_outline: [255, 0, 0]
color_no_mop_zones: [163, 130, 211, 127]
color_no_mop_zones_outline: [163, 130, 211]
color_charger: [0x66, 0xfe, 0xda, 0x7f]
color_robo: [75, 235, 149]
color_unknown: [0, 0, 0]
color_scan: [0xDF, 0xDF, 0xDF]
draw: ['all']
attributes:
- calibration_points
- charger
- cleaned_rooms
- country
- goto_path
- goto_predicted_path
- goto
- ignored_obstacles_with_photo
- ignored_obstacles
- image
- is_empty
- map_name
- no_go_areas
- no_mopping_areas
- obstacles_with_photo
- obstacles
- path
- room_numbers
- rooms
- vacuum_position
- vacuum_room_name
- vacuum_room
- walls
- zones
Within Lovelace (raw) :
type: custom:xiaomi-vacuum-map-card
title: Roborock S5 Max (unten)
vacuum_platform: KrzysztofHajdamowicz/miio2
map_source:
camera: camera.roborock_unten
calibration_source:
camera: true
camera_calibration: true
entity: vacuum.roborock_s5_max_unten
map_modes:
- template: vacuum_clean_zone
- template: vacuum_goto
- template: vacuum_clean_zone_predefined
predefined_selections:
- zones:
- - 29126
- 18301
- 37050
- 24630
label:
text: Diele Eingang
x: 33500
'y': 19800
icon:
name: mdi:home-import-outline
x: 33500
'y': 21000
- zones:
- - 25244
- 22368
- 29266
- 28637
label:
text: Beanbag Zone
x: 27300
'y': 25000
icon:
name: mdi:sofa
x: 27300
'y': 26000
- zones:
- - 29126
- 24685
- 35069
- 28647
label:
text: Esstisch
x: 32500
'y': 26000
icon:
name: mdi:table-chair
x: 32500
'y': 27000
- zones:
- - 35069
- 25345
- 38096
- 28647
label:
text: Pantry
x: 36650
'y': 26000
icon:
name: mdi:pot-steam-outline
x: 36650
'y': 27000
- zones:
- - 38303
- 25398
- 40131
- 28793
label:
text: Küche
x: 39190
'y': 26000
icon:
name: mdi:pot-steam-outline
x: 39190
'y': 27000
- zones:
- - 25035
- 32398
- 28900
- 37099
label:
text: Büro
x: 27000
'y': 33500
icon:
name: mdi:chair-rolling
x: 27000
'y': 35000
- zones:
- - 27072
- 28637
- 29005
- 32241
label:
text: Flur
x: 28000
'y': 29300
icon:
name: mdi:home-floor-1
x: 28000
'y': 30800
- zones:
- - 25244
- 29890
- 27020
- 32084
label:
text: Server
x: 26000
'y': 30300
icon:
name: mdi:server-network
x: 26000
'y': 31800
- zones:
- - 25244
- 18398
- 29318
- 22107
label:
text: Gästezimmer
x: 27100
'y': 19100
icon:
name: mdi:bed
x: 27250
'y': 20300