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.12k stars 121 forks source link

Error on camera entity with 2024.01 beta #501

Closed Aohzan closed 6 months ago

Aohzan commented 6 months ago

Checklist

The problem

Hello Since the upgrade on last beta, the camera entity raise an error Thank you

What version of an integration has described problem?

2.2.1

What was the last working version of an integration?

No response

What vacuum model do you have problems with?

s5e

What version of Home Assistant do you use?

core-202401b0

What type of installation are you running?

Home Assistant Supervised

Camera's configuration

camera:
  - platform: xiaomi_cloud_map_extractor
    host: 192.168.1.227
    token: !secret xiaomi_vacuum_token
    username: !secret xiaomi_cloud_username
    password: !secret xiaomi_cloud_password
    name: Carte Robot Aspirateur
    country: de
    scan_interval:
      seconds: 10
    draw:
      - charger
      - path
      - goto_path
      - obstacles
      - ignored_obstacles
      - obstacles_with_photo
      - ignored_obstacles_with_photo
      - predicted_path
      # - no_go_zones
      # - no_mopping_zones
      - vacuum_position
      # - virtual_walls
      - zones
    attributes:
      - calibration_points
      # - rooms
      - goto
      - goto_path
      - goto_predicted_path
      # - is_empty
      - map_name
      - obstacles
      # - ignored_obstacles
      # - path
      # - room_numbers
      - vacuum_position
      - vacuum_room
    sizes:
      charger_radius: 2
      vacuum_radius: 4

    map_transformation:
      scale: 1.4
      rotate: 0
      trim:
        top: 30
        bottom: 20
        left: 30
        right: 20
    colors:
      color_map_outside: [20, 20, 20]
      color_path: [250, 250, 250]
      color_robo: [255, 0, 0]
      color_virtual_walls: [90, 90, 90]
      color_map_wall: [90, 90, 90]
      color_map_wall_v2: [90, 90, 90]

Errors shown in the HA logs (if applicable)

2023-12-28 19:37:28.737 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback _run_async_call_action(<HomeAssistant RUNNING>, <Job Camera u...7f7411e5f740>>) at /usr/src/homeassistant/homeassistant/helpers/event.py:1450
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1454, in _run_async_call_action
    hass.async_run_hass_job(job, time_tracker_utcnow())
  File "/usr/src/homeassistant/homeassistant/core.py", line 715, in async_run_hass_job
    hassjob.target(*args)
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1532, in interval_listener
    hass.async_run_hass_job(job, now)
  File "/usr/src/homeassistant/homeassistant/core.py", line 715, in async_run_hass_job
    hassjob.target(*args)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 424, in update_tokens
    entity.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 938, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1059, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in __async_calculate_state
    attr.update(self.state_attributes or {})
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 728, in state_attributes
    if self.frontend_stream_type:
       ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 573, in frontend_stream_type
    if CameraEntityFeature.STREAM not in self.supported_features:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'int' is not iterable

Additional information

No response

Aohzan commented 6 months ago

fixed in last beta

PiotrMachowski commented 6 months ago

Great 👍

Aohzan commented 6 months ago

@PiotrMachowski there is deprecation prolongation for features, see https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation