Giter VIP home page Giter VIP logo

lovelace-valetudo-map-card's Introduction

Valetudo Map Card

Display the map from a valetudo-enabled robot in a home assistant dashboard card.

Installation

It is highly recommended to use HACS for managing custom extensions of Home Assistant.

Follow the HACS installation instructions.

It is necessary to "take control" over the dashboards before downloading the "Valetudo Map Card".

  1. Go to the Overview dashboard
  2. Click on the pencil-icon on the top right
  3. In the dialog click on the three dots on the top right
  4. In the context menu click on "take control"
  5. In the next dialog click on "take control" again

Then, open HACS, go to Frontend and click "Explore & Download Repositories" and search for "Valetudo Map Card". Select it and choose "Download".

Configuration

MQTT

This card makes use of Valetudo's MQTT support. MQTT has to be configured in Home Assistant and Valetudo.

Custom card

To get the card up and running, head over to https://hass.valetudo.cloud for a short walkthrough.

Usage examples

Displaying with the vacuum entity

image

For easy control of the vacuum, consider using a vertical-stack with an entities card like so:

type: vertical-stack
cards:
  - vacuum: valetudo_thirstyserpentinestingray
    type: custom:valetudo-map-card
  - entities:
      - vacuum.valetudo_thirstyserpentinestingray
    type: entities

Displaying as overlay

When combining this card with Home Assistant's picture-elements, you could use this to show your vacuum's position on top of your house. Make sure to set both show_floor: false and background_color: transparent in this card:

type: picture-elements
image: https://online.visual-paradigm.com/repository/images/e5728e49-09ce-4c95-b83c-482deee24386.png
elements:
  - type: 'custom:valetudo-map-card'
    vacuum: valetudo_thirstyserpentinestingray
    show_floor: false
    background_color: transparent

Then use map_scale and crop to make it fit.

Options

Name Type Default Description
type string Required custom:valetudo-map-card
vacuum string Required Name of the vacuum in MQTT (without vacuum. prefix)
title string Vacuum Title to show in the card header
show_map boolean true Show the map
background_color string Background color of the card
floor_color string '--valetudo-map-floor-color', '--secondary-background-color' Floor color
floor_opacity number 1 Floor opacity
wall_color string '--valetudo-map-wall-color', '--accent-color' Wall
wall_opacity number 1 Wall opacity
currently_cleaned_zone_color string '--valetudo-currently_cleaned_zone_color', '--secondary-text-color' Color of zones selected for cleanup
currently_cleaned_zone_opacity number 0.5 Opacity of the currently cleaned zones
no_go_area_color string '--valetudo-no-go-area-color', '--accent-color' No go area color
no_go_area_opacity number 0.5 Opacity of the no go areas
no_mop_area_color string '--valetudo-no-mop-area-color', '--secondary-text-color' No mop area color
no_mop_area_opacity number 0.5 Opacity of the no mop areas
virtual_wall_color string '--valetudo-virtual-wall-color', '--accent-color' Virtual wall color
virtual_wall_opacity number 1 Virtual wall opacity
virtual_wall_width number 1 Virtual wall line width
path_color string '--valetudo-map-path-color', '--primary-text-color' Path color
path_opacity number 1 Path opacity
path_width number 1 Path line width
segment_colors array '#19A1A1', '#7AC037', '#DF5618', '#F7C841' Segment colors
segment_opacity number 0.75 Segment opacity
show_floor boolean true Draw the floor on the map
show_dock boolean true Draw the charging dock on the map
show_vacuum boolean true Draw the vacuum on the map
show_walls boolean true Draw walls on the map
show_currently_cleaned_zones boolean true Show zones selected for zoned cleanup on the map
show_no_go_areas boolean true Draw no go areas on the map
show_no_mop_areas boolean true Draw no mop areas on the map
show_virtual_walls boolean true Draw virtual walls on the map
show_path boolean true Draw the path the vacuum took
show_currently_cleaned_zones_border boolean true Draw a border around the currently cleaned zones
show_no_go_border boolean true Draw a border around no go areas
show_no_mop_border boolean true Draw a border around no mop areas
show_predicted_path boolean true Draw the predicted path for the vacuum
show_goto_target boolean true Draw the go to target
show_segments boolean true Draw the floor segments on the map
show_status boolean true Show the status of vacuum_entity
show_battery_level boolean true Show the battery level of vacuum_entity
show_start_button boolean true Show the start button for vacuum_entity
show_pause_button boolean true Show the pause button for vacuum_entity
show_stop_button boolean true Show the stop button for vacuum_entity
show_home_button boolean true Show the home button for vacuum_entity
show_locate_button boolean true Show the locate button for vacuum_entity
goto_target_icon string mdi:pin The icon to use for the go to target
goto_target_color string 'blue' The color to use for the go to target icon
dock_icon string mdi:flash The icon to use for the charging dock
dock_color string 'green' The color to use for the charging dock icon
vacuum_icon string mdi:robot-vacuum The icon to use for the vacuum
vacuum_color string '--primary-text-color' The color to use for the vacuum icon
map_scale number 1 Scale the map by this value
icon_scale number 1 Scale the icons (vacuum & dock) by this value
rotate number 0 Value to rotate the map by (default is in deg, but a value like 2rad is valid too)
left_padding number 0 Value that moves the map number pixels from left to right
crop Object {top: 0, bottom: 0, left: 0, right: 0} Crop the map
min_height string 0 The minimum height of the card the map is displayed in, regardless of the map's size itself. Suffix with 'w' if you want it to be times the width (ex: 0.5625w is equivalent to a picture card's 16x9 aspect_ratio)
custom_buttons array [] An array of custom buttons. Options detailed below.

Colors can be any valid CSS value in the card config, like name (red), hex code (#FF0000), rgb(255,255,255), rgba(255,255,255,0.8)...

Custom Buttons

Custom buttons can be added to this card when vacuum_entity is set. Each custom button supports the following options:

Name Type Default Description
service string Required The service to call when this button is pressed
service_data Object {} Optional service data that will be passed to the service
icon string mdi:radiobox-blank The icon that will represent the custom button
text string "" Optional text to display next to the icon

License

Lovelace Valetudo Map Card is licensed under the MIT license.

lovelace-valetudo-map-card's People

Contributors

auduny avatar bbbenji avatar doemeins avatar forast3r avatar hepoh3 avatar hypfer avatar infinity312 avatar ingoschi avatar jkmf avatar jurajnyiri avatar kamicater avatar lukich48 avatar mannil avatar markusressel avatar noxhirsch avatar rp86 avatar salim-b avatar sqozz avatar stefanmd023 avatar stek29 avatar thelastproject avatar torvitas avatar trancefam avatar zvldz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

lovelace-valetudo-map-card's Issues

Please add an option to have no title in the map card

Just updated the map card via HACs and now my button is messed up because the title (even if set blank) pushes the map down and makes it smaller. In this button, the map is supposed to be the entire right side of the button, in line with the vacuum icon.
Screen Shot 2020-05-03 at 02 11 10

High CPU usage with live map

Whenever starts a clean from my vacuum, CPU usage on homeassistant container goes up to 100% inmediatly when viewing the card.

I'm not sure if it's the same problem as this issue on another live map for vacuum project: Live map camera loads CPU #66, it seems that the browser tries to get an updated image every 10-15 milliseconds.

Add MQTT support

@Hypfer, the lead developer of Valetudo, made pretty clear the REST API is not a supported way of getting the data and we're supposed to use MQTT to get the data. Support for MQTT thus needs to be added to this project.

xiaomi_map state tab

Hello

The xiaomi_map in states logs all the coordinates of the map. It causes the states to freeze up and i cant scroll.

Is there a way to solve this?

Map initially loads as black

Hey!

Thanks for a super awesome HA card, this makes my Valetudo setup much cleaner as it removes the need for MQTT and docker containers.

I did want to raise this to see if it could be improved at all. I noticed on various clients (iOS app, Chrome, Safari) the live map initially loads as black, then resolves into colour after somewhere between 1-3 seconds. It can also occur when resizing the window.

Screenshot 2019-08-27 at 21 02 47

It would be great if it could display immediately - depending on where the delay is, or it could initially show the floor colour, before resolving in the objects? Happy to help with any further info you need!

HASS / Lovelace is running on a NUC like device (Intel x5-Z8350 4 x 1.92Ghz) custom built Ubuntu w/ Docker-CE. I see the CPU spike to around 15% when the page loads with the card if that's any help.

Breaks my lovelace config?

Hi,

This is exactly what I am looking for, but I don't understand why it is not working.
I have put the files in /www/community/lovelace-valetudo-map-card
I have put the resource in the Raw config editor.
I have added the sensor in my configuration.yaml (should I change anything here?)

Then I added a "Manual card" in lovelace with the example you wrote in the readme. But after saving it shows a blank page on Home Assistant, everything in that tab is hidden. If I go out of editing mode I can see the other cards, but not the map, and when trying to remove the card it is not possible, as no cards are shown. I have to delete it with the Raw editor.

Thank you!

Virtual wall width set to 0 still draws the line

Hello!

First of all, thank you for your amazing card. Now that summer is arriving I have set up a virtual wall in the balcony door, but it shows up in the map. I thought that setting "virtual_wall_width" to zero would do the trick, but it does not.

I have modified your code and now it does not draw it, but I think you won't like my solution so I better suggest it here!

Thanks!

/Xtract

Cannot read property 'states' of undefined

Ha 0.110 breaks valetudo-map-card when placed in picture elements.

hui-weather-forecast-card.ts:39 hui-picture-elements-card TypeError: Cannot read property 'states' of undefined
    at HTMLElement.set hass [as hass] (valetudo-map-card.js:304)
    at ha-state-label-badge.ts:24
    at Array.map (<anonymous>)
    at HTMLElement.value (ha-state-label-badge.ts:24)
    at s (hui-weather-forecast-card.ts:39)
    at hui-weather-forecast-card.ts:39
    at l (hui-weather-forecast-card.ts:39)
    at Module.Ht (hui-weather-forecast-card.ts:39)
    at u (hui-element.js:1)
    at HTMLElement.setConfig (hui-element.js:1)

MQTT with hostname not working

I have the following configuration working:

"mqtt": {
"enabled": true,
"server": "192.168.X.X",
"port": 1883,
"clientId": "",
"username": "myuser",
"password": "myasswd",
"usetls": false,
"caPath": "/mnt/data/valetudo/ca.pem",
"qos": 0,
"identifier": "abstellraum-staubsauger",
"topicPrefix": "valetudo",
"autoconfPrefix": "homeassistant",
"provideMapData": true
},

This configuration is not working:

"mqtt": {
"enabled": true,
"server": "mqtthost.my.domain",
"port": 1883,
"clientId": "",
"username": "myuser",
"password": "myasswd",
"usetls": false,
"caPath": "/mnt/data/valetudo/ca.pem",
"qos": 0,
"identifier": "abstellraum-staubsauger",
"topicPrefix": "valetudo",
"autoconfPrefix": "homeassistant",
"provideMapData": true
},

Can someone point in the right direction how to get this working with the hostname set? I am able to ping the hostname from the vacuum command line.

Regards
Richard

Smooth travel path

Minor issue. Would it be possible to smooth the path of the vacuum icon travel? I know we're getting the data from mqtt but there must be some way to ease the transition so it's less twitchy. Thanks for a great card!

Problem add map home assistant core

Hello friends, I have roborock s50, I installed Valetudo RE, it works in HA as MQTT, but the maps part does not work and I am not able to make it work, try this configuration:

I will try to put the steps that I have followed to see if I do something wrong or something is missing …

Copy the inside https://github.com/Poeschl/Hassio-Addons/tree/master/valetudo-mapper of this repository to / docker / homeassistant / custom_components / valetudo-mapper /

Config.json valetudo-mapper:

{
“mqtt”: {
“identifier”: “rockrobo”,
“topicPrefix”: “valetudo”,
“autoconfPrefix”: “homeassistant”,
“broker_url”: “mqtt: // admin: [email protected]: 1883”,
“caPath”: “”,
“mapSettings”: {
“drawPath”: true,
“drawCharger”: true,
“drawRobot”: true,
“drawForbiddenZones”: true,
“drawVirtualWalls”: true,
“border”: 2,
“scale”: 4,
“gradientBackground”: true
},
“mapDataTopic”: “valetudo / rockrobo / map_data”,
“minMillisecondsBetweenMapUpdates”: 10000,
“publishMapImage”: true,
“publishMapData”: true
}
}

config.json roborock:

root @ rockrobo: / mnt / data / valetudo # nano config.json
GNU nano 2.2.6 File: config.json

{
“spots”: [],
“areas”: [],
“ztimers”: [],
“mqtt”: {
“enabled”: true,
“identifier”: “rockrobo”,
“topicPrefix”: “valetudo”,
“autoconfPrefix”: “homeassistant”,
“broker_url”: “mqtt: // admin: [email protected]”,
“provideMapData”: true,
“mapSettings”: {
“drawPath”: true,
“drawCharger”: true,
“drawRobot”: true,
“border”: 2,
“scale”: 4
},
“caPath”: “”

Configuration.yaml

discovery: true
discovery_prefix: homeassistant

sensor:

platform: mqtt
state_topic: “valetudo / rockrobo / state”
json_attributes_topic: “valetudo / rockrobo / map_data_parsed”
name: xiaomi_map
value_template: ‘OK’
scan_interval: 5
remember:
exclude:
entities:

  • sensor.xiaomi_map

I add custom card:

crop:
bottom: 0
left: 0
right: 0
top: 0
entity: sensor.xiaomi_map
min_height: 0
rotate: 0
type: ‘custom: valetudo-map-card’

I tried to create docker but it gives exec error user process caused “exec format error”
I use Portainer and docker from:

Pure Home Assistant (not HASSIO)
MQTT
PORTAINER
etc…

Latest version hangs browser

Hi, after updating to latest version when i click on the view with Valetudo map card whole browser freezes. I've just downgraded to the previous version of card and everyting works ok.
Please help.

I'm running Home Assistant 0.114.0

Default transparency for zones

Currently, no-go areas and currently selected zones for cleanup draw a box with complete opacity. This hides the whole map below it. The color generation feature needs to be smarter and set transparency by default.

Add option 'vacuum_color'

Hello,

would it be possible to add option 'vacuum_color' to define vacuum icon color?

Regards,
Jacek

Custom element doesn't exist: valetudo-map-card.

I have installed the frontend addon using HACS, but (even after restarting HA), when im trying to add the card as per documentation, im getting this error:

Custom element doesn't exist: valetudo-map-card.

Screenshot from 2020-08-18 13-48-22

Cannot assign to read only property 'rotate' of object

Lovelace card states "Cannot assign to read only property 'rotate' of object '#'" when setting the rotate value to any number other than 0.

Example config:

type: 'custom:valetudo-map-card'
entity: sensor.robovac_map
rotate: 180
crop:
  top: 0
  bottom: 0
  left: 0
  right: 0
min_height: 0

Interestingly, rotate: 3.14rad works fine.

I believe this started showing up in Home Assistant v0.106.1 which might help either narrow the issue or mean it's not an issue on your end. I'm also not 100% sure if/how the setConfig() function has changed throwing the new error, but would love some help tracking it down.

Cropping is unintuitive

Is it possible to zoom a map?
Ive tried playing with map_scale parameter, setting it to 1.5 or 2 but it doesnt zoom.

Valetudo 0.6.0 support

New map format will need a lot of rewriting

  • Charger location
  • Robot location
  • Floor
  • Walls
  • Path
  • No go areas
  • Virtual walls
  • Active zones (previously: currently_cleaned_zones)

Location icon of vacuum did not change in 0.110

Hi,
after installation 0.110 the icon of the vacuum didn't move over the map. It is stucked at left upper corner during movement of the robot. The Path of the robot is visible. Here a screenshot of my map:

grafik

add pause button

Hello ). It would be good to add a pause button. When I use zoned cleanup (always) stop button definitely erase my map. I have Xiaomi vacuum 1s

High memory usage

I've been running this on a Pi 3B and it seems that this card chews through memory quite rapidly? I noticed the memory usage in my system monitor was at 146MB but within a few minutes was down to 44MB and now I can no longer access the web GUI and the Pi will need a reboot.

Anyone else experience this?

Map doesn't load if no virtual walls are defined.

If you haven't defined any virtual walls, the attribute is not added on the sensor, this causes this error when trying to load the map: TypeError: mapData.attributes.virtual_walls is undefined.

Graphical glitches in no_go_area with transpararent colour

Two or three lines form around the no_go_area and vary with the virtual_wall_width parameter :
this is normal?

no go area 2
no go area 1

  - type: 'custom:valetudo-map-card'
    entity: sensor.xiaomi_map
    map_scale: 1.7
    icon_scale: 1
    rotate: 0
    path_color: black
    virtual_wall_color: red
    virtual_wall_width: 5
    no_go_area_color: rgba(255, 0, 0, 0.2)
    crop:
      top: 100
      bottom: 100
      left: 100
      right: 70
    dock_color: Orange
    vacuum_color: purple
    min_height: 0

Originally posted by @rmickael62 in #18 (comment)

Render map image to file for external usage

Hi there, great project 👍

A while ago I used the image renderer of Valetudo and its REST API to display the map in Home Assistant. Since then, this card has replaced it, since it is much more versatile.

However, afaik, it is currently not possible to use the rendered map image from this custom component as a notification image. To allow this I would be interested in a way to render the map not only in the browser, but also to a file, possibly using a customized homeassistant service call. That way the image file can be used by other services, like f.ex. a notify service.

I am not sure if this lovelace component is the right place to ask for this, so feel free to guide me to other places if necessary.
Thx

Map won't show up after plugin update

Hello,

I've been running the plugin smoothly and yesterday I decided to run the update. After that I can't see the map anymore and sometimes it even hides all the content from the lovelace tab where the map is. Any suggestion to fix this?

Regards.

Not working with Home Assistant 0.106

With version 0.106 this card stops working. This is because starting from this version, the config object is no longer extensible (see here). A quick and dirty fix: add the following line at the very top of the setConfig method

config = JSON.parse(JSON.stringify(config))

Tested and working, but there may be other, more elegant solutions.

Add hints to custom buttons ?

The custom buttons are great (once I figured out how to implement them). I had to pick icons for them, which could sometimes be a little opaque, especially for a housemate. It would be very useful to add hint bubbles when you hover over the icons. These could default to something like the command, but be changeable.

How configure valetudo-map-floor-color?

Hi,

i'm try used this --valetudo-map-floor-color and --secondary-background-color without success on lovelace.. :(
Can you share an exemple please?

Thank you.

Infinite loading inside vertical-stack-in-card

Hi,

at first I have to thank you for your amazin work.
I'm using the card since it poped up in my hacs. After I configured everything it works fine but since I updatet the card yesterday I didn't see the map anymore only the spinner:/ I've tested different browser and the IOS app.

I've checked the documentation for changes since the last version but did not find anything.

Can you give me a hint for debugging this error?

Aspect Ratio

Please add aspect ratio support for card like a picture card using camera! I need it to set final card size so that it does not change after cropping the map

Add possibility to set cards background color (transparent - to use image as floorplan)

Currently it's only possible to set floor_color to transparent ('rgba(0, 0, 0, 0)'), but to use an image as floorplan in the background, it's necessary to make the actual background of the card itself transparent.

With the lovelace picture-elements card it's easy to set an image as background that reflects the floorplan. On top of that the lovelace-valetudo-map-card can be added with its customizations

type: picture-elements
image: https://online.visual-paradigm.com/repository/images/e5728e49-09ce-4c95-b83c-482deee24386.png
elements:
  - type: 'custom:valetudo-map-card'
    entity: sensor.xiaomi_map
    map_scale: 1.2
    style:
      left: 50%
      top: 50%
    floor_color: 'rgba(0, 0, 0, 0)'
    path_color: 'rgba(255, 0, 0, 1)'

It would be great to be able to configure the cards background color.
Thanks for looking into it!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.