Again, many thanks for your reply.
I got it working!!!
A little sum up for everyone who has similar difficulties getting a live map into HA:
- Install Valetudo on your vacuum following official instructions. My advice: Install old xiaomi app to get the token, use dustbuilder to create your firmware and install that created firmware using RRCC. Its the shortest and most fail-save way I guess.
- Once done you can easily install valetudo RE from this point on. Just download the .deb file from valetudo re releases, place it onto the vacuum and install it using
dpkg -i filename.deb
. Other installation methods can be found here but again, I guess this is the easiest one. - Now you should have a fully working vacuum running valetudo re. On itās IP adress you should see a working live map. Next is on how to get that into home assistant.
- If you havenāt, install mosquitto broker addon for home assistant following the official guide. Keep in mind to create a dedicated home assistant user for later use with mosquitto. Once installed you should add
mqtt:
broker: IP_of_machine_mosquitto_is_running_on
to your config.yaml. For me this was the very same my whole Home Assistant is running on.
- Now comes the part with valetudo-mapper:
From what I understood valetudo re is only broadcasting raw data via mqtt to save resources on the vacuum itself. valetudo-mapper is a little helper program that converts this raw data into an image and passes it along to whatever mqtt service you want.
For that to work you first have to setup your config.json on the vacuum itself to actually broadcast the data. Here is my example config. You find that on your vacuum at mnt/data/valetudo/config.json
"mqtt": {
"enabled": true,
"identifier": "tachikoma",
"topicPrefix": "valetudo",
"autoconfPrefix": "homeassistant",
"broker_url": "mqtt://HA-username:password@MosquittobrookerIPAdress",
"provideMapData": true,
"mapSettings": {
"drawPath": true,
"drawCharger": true,
"drawRobot": true,
"border": 2,
"scale": 4
},
"caPath": ""
},
"dummycloud": {
"spoofedIP": "203.0.113.1",
"bindIP": "127.0.0.1"
},
"webInterface": {
"localization": "en",
"hideMapReload": true,
"style": ""
},
"httpAuth": {
"enabled": false,
"username": "valetudo",
"password": "valetudo"
},
"telegramBot": {
"enabled": false,
"token": "",
"password": "",
"host": "",
"proxy": "",
"clients": [],
"sendConsumables": true,
"sendConsumablesEvery": false
},
"allowSSHKeyUpload": true,
"map_upload_host": "http://127.0.0.1"
}
- With that done your vacuum should broadcast all the necessary data via mqtt.
I went to install valetudo-mapper via docker. It gets a little catchy as the official instruction say one shoud map the /app/config.json for the mapper. I did that but docker told me āconfig.jsonā was a directory not a file. It was my mistake: you first have to create the config.json yourself and place it where docker can find it, else docker would map everything as a directory. Second one should build the container. I used this command:
docker run -d -v /path/to/your/config.json:/app/config.json roflcoopter/valetudo-mapper
This is my config.json:
{
"mqtt" : {
"identifier": "tachikoma",
"topicPrefix": "valetudo",
"autoconfPrefix": "homeassistant",
"broker_url": "mqtt://HA-username:password@MosquittobrookerIPAdress:1884",
"caPath": "",
"mapSettings": {
"drawPath": true,
"drawCharger": true,
"drawRobot": true,
"drawForbiddenZones": true,
"drawVirtualWalls": true,
"border": 2,
"scale": 4,
"gradientBackground": true,
"crop_x1": 30,
"crop_y1": 70,
"crop_x2": 440,
"crop_y2": 440
},
"mapDataTopic": "valetudo/tachikoma/map_data",
"minMillisecondsBetweenMapUpdates": 10000,
"publishMapImage": true,
"publishMapData": true
},
"webserver": {
"enabled": true,
"port": 3000
}
}
Note that you should use the same identifier, āTachikomaā or the name of your vacuum so that valetudo-mapper knows where to catch the data from. The broker url should be your mosquitto service in home assistant as the mapper will send the created image to this destination.
Edit: Running a docker container separately from HA proved to be unstable for me. It crashed several times. So I followed @komadori1 's advice and added this repository and installed valetudo-mapper as add-on in home assistant. Now everything runs smooth as butter
- Almost done:
Head over to your configuration.yaml and add the map sensor:
sensor:
- platform: mqtt
state_topic: "valetudo/tachikoma/state"
json_attributes_topic: "valetudo/tachikoma/map_data_parsed"
name: tachikoma_map
value_template: 'OK'
scan_interval: 5
recorder:
exclude:
entities:
- sensor.tachikoma_map
Restart home assistant and add the valetudo-map-card for lovelace from HACS to any home screen with this code
type: 'custom:valetudo-map-card'
entity: sensor.tachikoma_map
crop:
bottom: 0
left: 0
right: 0
top: 0
icon_scale: 1
map_scale: 1
min_height: 0
rotate: 0
show_dock: true
show_path: true
show_vacuum: true
Hopefully you see the same result as me: