Valetudo RE integration (patform_template and possibly automatic map calibration)
See original GitHub issueDescription
I have recently flashed my vacuum with Valetudo RE and would love a seamless integration in HA with your amazing card.
Therefore two features would be neat
- Have a
platform_template
for Valetudo RE, which directly sends MQTT commands to the robot (or a different topic and add an automation which parses the data to the format required by Valetudo re. - (future?) Enable automatic calibration of the map: I found a way to generate calibration points from Valetudo RE’s mapper. Moments ago I asked for a feature request over there to auto-calibrate and serve the calibration points.
Solution
platform_template This is how far I got:
I have cloned your repo and my work-in-progress platform_template
currently looks like this(excerpt):
{
"map_modes": {
"defaultTemplates": ["vacuum_clean_zone", "vacuum_goto"],
"templates": {
"vacuum_clean_zone_predefined": {
"name": "map_mode.vacuum_clean_zone_predefined",
"icon": "mdi:floor-plan",
"selection_type": "PREDEFINED_RECTANGLE",
"max_selections": 5,
"coordinates_rounding": true,
"repeats_type": "INTERNAL",
"max_repeats": 3,
"service_call_schema": {
"service": "mqtt.publish",
"service_data": {
"topic": "vacuum/bb8/custom_command",
"payload": "{ \"command\": \"zoned_cleanup\", \"zone_ids\": [{ \"id\": [[selection_id]], \"repeats\": [[repeats]] }], \"afterCleaning\": \"Base\" }"
}
}
}
}
},
"tiles": {
"from_attributes": [
{
"attribute": "mainBrush",
"label": "tile.main_brush_left.label",
"icon": "mdi:fan-speed-1",
"unit": "unit.hour_shortcut"
},
{
"attribute": "sideBrush",
"label": "tile.side_brush_left.label",
"icon": "mdi:fan-speed-2",
"unit": "unit.hour_shortcut"
},
{
"attribute": "filter",
"label": "tile.filter_left.label",
"icon": "mdi:air-filter",
"unit": "unit.hour_shortcut"
}
],
"from_sensors": []
}
}
And the card:
type: custom:xiaomi-vacuum-map-card
title: Xiaomi Card TESTING
preset_name: Live map
entity: vacuum.rockrobo
map_source:
camera: camera.rockrobo_map_data
map_locked: true
vacuum_platform: mqtt_generic
debug: true
calibration_source:
calibration_points:
- vacuum:
x: 23800
'y': 22600
map:
x: 21
'y': 21
- vacuum:
x: 30250
'y': 29850
map:
x: 537
'y': 601
- vacuum:
x: 36700
'y': 22600
map:
x: 1053
'y': 21
map_modes:
- template: vacuum_clean_zone
- template: vacuum_clean_zone_predefined
predefined_selections:
- zones:
- - 28889
- 23472
- 30306
- 24685
label:
text: Bad
x: 29500
'y': 24000
offset_y: 35
icon:
name: mdi:shower
x: 29500
'y': 24000
- zones:
- - 28475
- 24604
- 30665
- 25960
- - 28676
- 25871
- 30219
- 29701
label:
text: Flur
x: 29500
'y': 27200
offset_y: 35
icon:
name: mdi:pot-mix
x: 29500
'y': 27200
The sensor integration works well.
Unfortunately the parsing of parameters [[selection_id]] and [[repeats]] is not yet resolved correctly, neither works |[[jsonize]]
as suggested in your [readme](- |[[jsonize]]
: if value ends with this modifier it will be decoded as a JSON). Is this limited to service_data
or is also applicable to payload
? Maybe you could point me in the right direction, how to accomplish this.
calibration points Unfortunately, I do not really know how to achieve auto-calibration. I believe parsing them initialized from the robot itself should be the way to go. But how to make them accessible to your card?
Alternatives
No response
Context
The Valetudo RE MQTT api for the “clean predefined zones” should go to topic
valetudo/rockrobo/custom_command
and look like this:
{
"command": "zoned_cleanup",
"zone_ids": [
"Foo",
{
"id": "Bar",
"repeats": 2
}
],
"afterCleaning": "Stop"
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (10 by maintainers)
Top GitHub Comments
You don’t have to create a platform template to define your own service calls, it is possible by default in the card. Below you have modes that will work with current version of the card. Please notice that they all use
selection_type: ROOM
- that’s because Valetudo uses identifiers, not coordinates.Thank you for the integration of
Valetudo RE
. I finally found the time to pull the latest version of your card and test it.I can confirm that
vacuum_clean_segment
andvacuum_goto_predefined
works.