Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map Camera #33

Closed
stibe881 opened this issue May 12, 2020 · 13 comments
Closed

Map Camera #33

stibe881 opened this issue May 12, 2020 · 13 comments
Labels
question Further information is requested

Comments

@stibe881
Copy link

stibe881 commented May 12, 2020

Hi
hat do I have to enter in map camera? Can you give an example?
It is a dropdown box. but when I click on it, there is no selection.

thank you

BR
Stibe

@denysdovhan
Copy link
Owner

You have to specify a camera entity that streams live map of your vacuum. I guess you don't have any options because you don't have camera entities.

@denysdovhan denysdovhan added the question Further information is requested label May 12, 2020
@CarpeDiemRo
Copy link

I have the same question. How do I have to define this entity? As far as I understood is based on generic_camera. Can you give me more detail, please?

@denysdovhan
Copy link
Owner

It's well described here: https://macbury.github.io/SmartHouse/HomeAssistant/Vacuum/

@CarpeDiemRo
Copy link

Thanks a lot. I have doubts to root my vacuum. I will think about it.

@stibe881
Copy link
Author

stibe881 commented May 12, 2020

Ok. But which still_image_url i need? I tried with the follow:

http://<IP from Vacuum>/#map.html
http://<IP from Vacuum>/api/map/latest
http://<IP from Vacuum>/jpg/image.jpg

All of this doesn't work

Here ist the complete sensor. I tried with both:

camera:
  - platform: generic
    name: Saugroboter1
    still_image_url: http://<IP from Vacuum>/#map.html

  - platform: generic
    name: Saugroboter2
    still_image_url: http://<IP from Vacuum>/api/map/latest

@denysdovhan denysdovhan reopened this May 12, 2020
@stibe881
Copy link
Author

Thanks for reopening. You have any solution for my problem?

@denysdovhan
Copy link
Owner

@stibe881 I really don’t know how to help you. I decided not to flash my vacuum, since there’s no information if my model is supported. I don’t use map feature and just reimplemented that from cards I was inspired from. I haven’t had a chance to test them on a real device :(

Probably the best way to solve your problem is to ask someone in HA community forum. Or, hopefully, someone will help you in this thread.

Really sorry, but I don’t know how to help you 🙏

@tinuva
Copy link

tinuva commented May 13, 2020

ok I got the map funciton to work.

Here is what I did for my method:

  1. Vacuum flashed with Valetudo-RE found at https://github.com/rand256/valetudo
  2. Enable mqtt in /mnt/data/valetudo/config.json
  3. Set up valetudo-mapper on a raspberri-pi or whatever. I have it in docker on my HA pc. https://github.com/rand256/valetudo-mapper

This will create a discovered camera entity for you in HA.

Screen Shot 2020-05-13 at 3 50 36 PM

@stibe881
Copy link
Author

ok I got the map funciton to work.

Here is what I did for my method:

  1. Vacuum flashed with Valetudo-RE found at https://github.com/rand256/valetudo
  2. Enable mqtt in /mnt/data/valetudo/config.json
  3. Set up valetudo-mapper on a raspberri-pi or whatever. I have it in docker on my HA pc. https://github.com/rand256/valetudo-mapper

This will create a discovered camera entity for you in HA.

Screen Shot 2020-05-13 at 3 50 36 PM

Hi tinuva
Thanks for your answer.
Now i have the roborock with mqtt in my home assistant.

but how can i install this? https://github.com/rand256/valetudo-mapper

can i this install on my home assistant server (ubuntu)?

i tried this. but there comes the folloe error messages when i write "npm start":

npm ERR! Linux 4.15.0-99-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "start"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! path /root/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open '/root/package.json'
npm ERR! enoent ENOENT: no such file or directory, open '/root/package.json'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR! /root/npm-debug.log

the config file i write in my roborock vacuum on the follow path:

/mnt/data/valetudo/config.json
is this correctly?

many thanks :)

@tinuva
Copy link

tinuva commented May 14, 2020

ok to answer your question, yes you install it on your ubuntu server. However I would recommend running it in docker, its much easier.

Important notes, https://github.com/rand256/valetudo-mapper will only work if you used firmware from https://github.com/rand256/valetudo - the reason for this is, they split the mapper to run on a separate server instead of on the robot. Otherwise it uses up too much resources on the robot. The below I have tested on a gen1 robot using firmware vacuum_4007_valetudo_re_0_9_4.pkg

My docker compose file look like this:
docker-compose.yaml

version: '3.5'
networks:
  default:
    driver: bridge
    ipam:
      driver: default
      config:
      - subnet: 172.36.0.0/16
services:
  valetudo-mapper:
    container_name: valetudo-mapper
    restart: always
    image: rand256/valetudo-mapper:latest
    volumes:
      - /data/docker/valetudo-mapper/config.json:/app/config.json

Now to make the above work, you need to add the config in /data/docker/valetudo-mapper/config.json
(this is only for the mapper, but it should look similar to the config on your robot)

{
  "mqtt": {
    "identifier": "rockrobo",
    "topicPrefix": "valetudo",
    "autoconfPrefix": "homeassistant",
    "broker_url": "mqtt://comms.heaven.za.net",
    "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
  },
  "webserver": {
    "enabled": false,
    "port": 3000
  }
}

Config snippet file on the robot: (import part is, your identifier and topic and broker should match that of the mapper config, so that HA pick all of it automatically.

root@rockrobo:~# cat /mnt/data/valetudo/config.json
{
  "spots": [],
  "areas": [],
  "ztimers": [],
  "mqtt": {
    "enabled": true,
    "identifier": "rockrobo",
    "topicPrefix": "valetudo",
    "autoconfPrefix": "homeassistant",
    "broker_url": "mqtt://comms.heaven.za.net",
    "provideMapData": true,
    "caPath": "",
    "qos": 0
  },

Then you restart the service on the robot: service valetudo restart
Start the mapper on your server (be in same folder as your docker-compose.yaml file): docker-compose up -d && docker-compose logs -f --tail 10

Now in HA you need the following config somewhere, mine is in a package: (or do it in the web ui)

vacuum:
  - platform: mqtt

In your lovelace UI while editing this card, you should now see a new camera entity named camera.rockrobo_map if you used the above identifier + topic that I used.

@stibe881
Copy link
Author

@tinuva
Thank you. but i dont work with docker. and i don't no how i can make it.
maybe you have time for a teamviewer session? :)

I would probably have to flash my roborock again. I suspect that valetudo is installed there and not valetudo re.

@pkishino
Copy link

you can do the same thing with valetudo. I have it working fine with valetudo.. for valetudo you need to setup https://github.com/Hypfer/ICantBelieveItsNotValetudo
then launch the npm server (you dont need the webserver, it will create an mqtt png entry) and HA will create a mqtt camera entry, and use this.

@vaproloff
Copy link

vaproloff commented May 24, 2020

Hello everyone!

I have a problem with displaying live map using this integration.
Everything works, but Chrome tab with this lovelace card starts to load CPU to 60-80% when using map camera (from Valetudo via MQTT).

When I remove parameter 'map: camera.rockrobo_map' - problem disappears.
I have picture-entity card with the same camera entity - no problems, only within this custom card.

Update: Using Chrome dev tools I've discovered that this custom card loads camera image every 10-15 milliseconds. I suppose this process loads CPU.

Any suggestions to fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

7 participants