Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor icon indicating copy to clipboard operation
Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor copied to clipboard

Always warning on update over x seconds

Open RexS98 opened this issue 3 years ago • 9 comments

Always receive 2 msg below

Updating xiaomi_cloud_map_extractor camera took longer than the scheduled update interval 0:00:05 Update of camera.xiaomi_cloud_map_extractor is taking over 10 seconds

RexS98 avatar Feb 03 '22 19:02 RexS98

Screenshot_20220208-234837_Home Assistant `Logger: homeassistant.components.camera Source: helpers/entity_platform.py:719 Integration: Caméra (documentation, issues) First occurred: 21:54:41 (36 occurrences) Last logged: 23:43:29

Updating xiaomi_cloud_map_extractor camera took longer than the scheduled update interval 0:00:05`

Mick51 avatar Feb 08 '22 22:02 Mick51

any update on that issue? map is being sampled every 10 seconds, when device is not connected having the error appear in logs will not assist anything, I think that the code that samples the cloud or device should continue sample it the same but without relation to the camera component, meaning it should be isolated to some kind of coordinator which will do the fetch data, while camera component is just taking the last state from the coordinator, can you please fix it?

thanks

elad-bar avatar May 20 '22 09:05 elad-bar

@elad-bar won't the coordinator cause similar entries in logs?

PiotrMachowski avatar May 24 '22 00:05 PiotrMachowski

@PiotrMachowski the warning messages are part of the base component, meaning if there is no response in {scan_interval}, it will throw message - every time it tries to update, with the coordinator, you control which message to throw, so essentially, you can write it once to log when the status is being changed from avialable to not avialble. In addition, the coordinator is holding the state, meaning the camera component will not need to wait for response, it will return the latest stored in the coordinator.

elad-bar avatar May 24 '22 07:05 elad-bar

Yeah, but coordinator also is refreshed automatically using some interval, so it might log something automatically as well. I have used this approach in other integrations, but they didn't have such problems

PiotrMachowski avatar May 24 '22 08:05 PiotrMachowski

right, but you can catch the exception and only log it if previous state was different

elad-bar avatar May 24 '22 08:05 elad-bar

Please review the PR (#289)

Separation between the camera component and data provider

  • Add vacuum manager to handle all the logic
  • Camera component will use the latest state of the vacuum manager
  • Map status to log messages - every time status is being changed, it will be logged accordingly, no need to call logger
  • Map device to handlers instead of IF statement

elad-bar avatar May 24 '22 13:05 elad-bar

For some reason this has become much more of an isuue after updating to the core-2022.7.0b0 beta version.

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:712
First occurred: 12:37:06 (2 occurrences)
Last logged: 12:40:12

Update of camera.upstairs_vacuum is taking over 10 seconds
Update of camera.downstairs_vacuum is taking over 10 seconds
------
This error originated from a custom integration.

Logger: custom_components.xiaomi_cloud_map_extractor.camera
Source: custom_components/xiaomi_cloud_map_extractor/camera.py:356
Integration: xiaomi_cloud_map_extractor (documentation, issues)
First occurred: 12:05:02 (10 occurrences)
Last logged: 13:58:02

Unable to retrieve map data

There does not seem to be an issue with the cameras though:

Screenshot 2022-07-01 at 14-04-15 Administration – Home Assistant

cameras.yaml

- platform: xiaomi_cloud_map_extractor
  name: Upstairs Vacuum
  host: 10.1.1.13
  token: !secret vacuum_token_2
  username: !secret vacuum_user
  password: !secret vacuum_passwd
  draw: ['all']
  auto_update: true
  scan_interval:
    seconds: 60
  colors:
    color_map_outside: [0, 0, 0, 0]
  map_transformation:
    rotate: 270
  attributes:
    - calibration_points

- platform: xiaomi_cloud_map_extractor
  name: Downstairs Vacuum
  host: 10.1.1.12
  token: !secret vacuum_token_1
  username: !secret vacuum_user
  password: !secret vacuum_passwd
  draw: ['all']
  auto_update: true
  scan_interval:
    seconds: 60
  colors:
    color_map_outside: [0, 0, 0, 0]
  attributes:
    - calibration_points

tomlut avatar Jul 01 '22 04:07 tomlut

I am also having this issue, has anyone found a fix for it? It doesnt actually seem to be negatively affecting anything though.

`Logger: homeassistant.helpers.entity Source: helpers/entity.py:514 First occurred: 3:55:41 AM (44 occurrences) Last logged: 7:30:25 AM

Update of camera.xiaomi_cloud_map_extractor is taking over 10 seconds`

cameras.yaml

  • platform: xiaomi_cloud_map_extractor host: !secret janet_host token: !secret janet_token username: !secret roborock_username password: !secret roborock_password draw: ["all"] attributes: - calibration_points map_transformation: rotate: 180

snel6424 avatar Aug 24 '22 01:08 snel6424