PiotrMachowski / Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor

This custom integration provides a way to present a live view of a map for Xiaomi (Roborock/Viomi/Roidmi/Dreame) vacuums without a need for rooting.
MIT License
1.13k stars 122 forks source link

camera.turn_off does not disable automatic updates #426

Open peterjuras opened 1 year ago

peterjuras commented 1 year ago

Checklist

The problem

Hi! First of all thank you for creating this extension, it's really amazing! 🎉

I am using your suggested blueprint to disable automatic updates of the map when the robot is not running, to prevent API rate limit as well as generally preserve resources for me (and Xiaomi 😊).

I have the impression that turning off the camera via the camera.turn_off service is not working correctly, it still appears to be updating the map every 5 seconds.

Do you know where the issue could be?

What version of an integration has described problem?

v2.2.0

What was the last working version of an integration?

No response

What vacuum model do you have problems with?

roborock.vacuum.s7

What version of Home Assistant do you use?

2023.4.6

What type of installation are you running?

Home Assistant OS

Camera's configuration

- platform: xiaomi_cloud_map_extractor
  name: Roomba
  host: !secret xiaomi_vacuum_host
  token: !secret xiaomi_vacuum_token
  username: !secret xiaomi_cloud_username
  password: !secret xiaomi_cloud_password
  country: de
  draw: ["all"]
  map_transformation:
    rotate: 90
  colors:
    color_map_outside: [34, 42, 48]
  # Color palette from https://colorkit.co/palette/ff595e-ff924c-ffca3a-c5ca30-8ac926-52a675-1982c4-4267ac-6a4c93-b5a6c9/
  room_colors:
    "16":
      - 255
      - 89
      - 94
    "17":
      - 255
      - 146
      - 76
    "18":
      - 255
      - 202
      - 58
    "19":
      - 197
      - 202
      - 48
    "20":
      - 138
      - 201
      - 38
    "21":
      - 82
      - 166
      - 117
    "22":
      - 25
      - 130
      - 196
    "23": 
      - 155
      - 246
      - 255
    "24":
      - 255
      - 255
      - 234
    "25":
      - 181
      - 166
      - 201
  attributes:
    - calibration_points
    - rooms

Errors shown in the HA logs (if applicable)

2023-04-23 09:06:05.684 WARNING (MainThread) [homeassistant.components.camera] Updating xiaomi_cloud_map_extractor camera took longer than the scheduled update interval 0:00:05

(Even after the camera service "turn_off" has been called)

Additional information

No response

PiotrMachowski commented 1 year ago

Can you show a yaml code of an automation you have created based on the blueprint?

peterjuras commented 1 year ago

Hi Piotr, thanks for the reply!

This is the code - however the camera updates also don't stop if I call the camera.turn_off service manually.

- id: '1682202102755'
  alias: Disable vacuum camera update when docked
  description: ''
  use_blueprint:
    path: PiotrMachowski/disable_vacuum_camera_update_when_docked.yaml
    input:
      vacuum: vacuum.roomba
      camera: camera.roomba
craggyh commented 1 year ago

I have this same issue and I think it may be related to the following error:

This entity ('camera.xiaomi_cloud_map_extractor') does not have a unique ID, therefore its settings cannot be managed from the UI.

I think because the camera doesn't have a unique id it can't be managed i.e turned off, from HA.

PiotrMachowski commented 1 year ago

@craigueh no, this is a different functionality

craggyh commented 1 year ago

Are you sure? When I list my camera entity in HA it shows as Read Only because it doesn't have a unique id. If it's read only would this explain why HA is not able to disable the camera and shows no options in the UI to disable?

PiotrMachowski commented 1 year ago

Yes, I'm sure. This issue is about disabling camera updates, not disabling entity. Unique id is required for disabling entity

craggyh commented 1 year ago

Oh, I thought disabling the camera updates worked by disabling the camera entity. So what does the camera.turn_off service do? Does it perform so other action but leave the entity enabled? I don't see anything happening in the logs when this service is called.

Thanks.

PiotrMachowski commented 1 year ago

It should turn off updating the state of the camera and keep the current one.

auanasgheps commented 1 year ago

In my case, the blueprint did not cover the idle state of my Dreame vacuum. I created an updated version and for my Dreame works fine.

https://github.com/PiotrMachowski/Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor/commit/f8b005b5c73b820783bb09a84ecc47129140e6fa

judasferret commented 10 months ago

I also have this issue with roborock s7. Have tried turn_off service , setting the auto_update false and scan_interval really large but seems map still always updates every 5 minutes/300 seconds (resulting in an api ban from xiaomi service)

auanasgheps commented 10 months ago

@judasferret try my blueprint!

Davst commented 9 months ago

Just got rate-limited with my s5, this seems to affect me as well.

craggyh commented 9 months ago

Yeah I got sick of this, rate limiting happening every other day no matter what I tried. in the end I flashed Valetudo and disconnected from cloud. Best thing ever. All control is now local and never an issue loading maps.

Davst commented 9 months ago

Is there anything except waiting to get out of rate limiting?

Valetudo has been interesting for me for a while.. but my Girlfriend almost always uses the app to run the vacuum cleaner so I'm a bit iffy about it cause of that.

craggyh commented 9 months ago

I never found a fix for the rate limiting and I spent a lot of time on the issue.

I’ve honestly never looked back since moving to valetudo. Losing the app was a non issue for my wife. I have everything needed in Homeassistant and there’s always the very capable valetudo web interface if your girlfriend prefers.

craggyh commented 9 months ago

Here's my own conditional card for docked/cleaning and shortcuts for each zone to clean. It's one of the few mods where the WAF is high, my wife actually prefers it to the app :-) I also have a few automations for cleaning finished and mop still attached etc.

Screenshot 2023-11-10 at 10-50-52 Overview – Home Assistant Screenshot 2023-11-10 at 10-51-20 Overview – Home Assistant

PiotrMachowski commented 9 months ago

@craigueh Vacuum Map card works with Valetudo as well ;)

craggyh commented 9 months ago

Oh, that looks nice. Can it render the map from Valetodu? I had to use a lovelace-valetudo-map-card to render the map as Valetudo only exports json data and not a typical camera feed.

Davst commented 9 months ago

@PiotrMachowski Any idea why this is happening? Tried fixing it now by adding both your automations to my setup.. to have 2 points of fallback so that both are active.. that way i can run a 3600 refresh on the map when docked

also added idle and paused to the trigger states

@craigueh nice.. thanks for the inspiration... if we don't ju st give up and get a new vacuum that doesn't keep getting limited on black friday we I might try valetudo. If we do... I'll be donating this one to my parents so that'll mean the app firmware is the way to go.