flopon / valetudo-mapper

Valetudo companion service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

valetudo

valetudo mapper

ex. I can't belive it's not Valetudo

This is a simple companion service for valetudo which does all the heavy lifting.

Since both CPU and Memory are limited on the robot, PNG generation for third-party components has been moved here.

Just run this via npm start on a host with enough resources. There's also a dockerfile and automated builds available on Docker Hub.

To override the configuration inside the docker container, map it to /app/config.json. It may look like this:

{
        "mqtt" : {
            "identifier": "rockrobo",
            "topicPrefix": "valetudo",
            "autoconfPrefix": "homeassistant",
            "broker_url": "mqtt://user:pass@example.com:port",
            "caPath": "",
            "mapDataTopic": "valetudo/rockrobo/map_data",
            "minMillisecondsBetweenMapUpdates": 10000,
            "publishMapImage": true,
            "publishMapData": false
        },
        "mapSettings": {
            "colors": {
                "background": "#33a1f5",
                "background2": "#046cd4",
                "floor": "#56affc",
                "obstacle_strong": "#a1dbff",
                "path": "white",
                "forbidden_marker": "red",
                "forbidden_zone": "rgba(255, 0, 0, 0.38)",
                "cleaned_marker": "rgba(53, 125, 46, 1.0)",
                "cleaned_zone": "rgba(107, 244, 66, 0.3)",
                "cleaned_block": "rgba(107, 244, 36, 0.34)"
            },
            "drawPath": true,
            "drawCharger": true,
            "drawRobot": true,
            "drawCurrentlyCleanedZones": false,
            "drawCurrentlyCleanedBlocks": false,
            "drawForbiddenZones": true,
            "drawVirtualWalls": true,
            "scale": 4,
            "gradientBackground": true,
            "autoCrop": 20,
            "crop_x1": 30,
            "crop_y1": 70,
            "crop_x2": 440,
            "crop_y2": 440,
            "rotate": 90
        },
        "webserver": {
            "enabled": false,
            "port": 3000
        }
}

Most options are self-explanatory. Autocrop allows to get rid of empty spaces at the edges of the image, its value determines how much pixels to keep at the border. Specifying manual crop values you can cut out mirrored artifacts outside of the actual rooms on the map.

You can also run a multiple instances of a single valetudo mapper with different configuration files. For this start the instance with ./node app.js -f /path/to/config.json. You may also need to add the -c key to generate a new custom config file if it doesn't exist.

Map PNG example in HA

map

Static raster image looks worse than browser generated via HTML Canvas but will do when JS is unavailable.

FHEM, ioBroker, etc

If you set webserver.enabled to true, the map PNG will be available at http://host:port/api/map/image

About

Valetudo companion service

License:Apache License 2.0


Languages

Language:JavaScript 99.7%Language:Dockerfile 0.3%