sca075 / mqtt_vacuum_camera

Camera Integration for Home Assistant to export and render all Vacuums connected via MQTT( including Valetudo Hypfer and RE(rand256)) Maps.
Apache License 2.0
103 stars 5 forks source link

Can't change Room color #84

Closed N1c093 closed 8 months ago

N1c093 commented 8 months ago

Checklist

The problem

I tried to change the room color from room 1-8. Sadly I get an error when I try to save the changes. It doesn't matter which color I pick. In the UI I get the error: Unknown error occurred

In general I think the default colors are to close to each other and it's hard to see the differences between the rooms and the robot path.

What version of an integration has described problem?

v1.5.8

What was the last working version of an integration?

No response

What vacuum model do you have problems with?

Roborock S5 Max

Please firmware installed on your Vacuum.

Valetudo 2023.12.0

What type of platform you use?

VEMLinux (Virtual Machine) such as Proxmox, VMWare, etc.

What version of Home Assistant do you use?

core-2024.2.1

What type of installation are you running?

Home Assistant OS

Camera's settings.

No response

Logs or Errors shown in the HA snapshots (please enable the Debug Mode)

2024-02-19 15:46:44.286 DEBUG (MainThread) [custom_components.valetudo_vacuum_camera.config_flow] Options edit in progress.. options before edit: {'rotate_image': '0', 'crop_image': '50', 'margins': '150', 'trim_top': '0', 'trim_bottom': '0', 'trim_left': '0', 'trim_right': '0', 'show_vac_status': False, 'enable_www_snapshots': False, 'color_charger': [255, 128, 0], 'color_move': [238, 247, 255], 'color_wall': [255, 255, 0], 'color_robot': [255, 255, 204], 'color_go_to': [0, 255, 0], 'color_no_go': [255, 0, 0], 'color_zone_clean': [255, 255, 255], 'color_background': [0, 125, 255], 'color_text': [255, 255, 255], 'alpha_charger': 255.0, 'alpha_move': 255.0, 'alpha_wall': 255.0, 'alpha_robot': 255.0, 'alpha_go_to': 255.0, 'alpha_no_go': 125.0, 'alpha_zone_clean': 125.0, 'alpha_background': 255.0, 'alpha_text': 255.0, 'color_room_0': [135, 206, 250], 'color_room_1': [176, 226, 255], 'color_room_2': [165, 105, 18], 'color_room_3': [164, 211, 238], 'color_room_4': [141, 182, 205], 'color_room_5': [96, 123, 139], 'color_room_6': [224, 255, 255], 'color_room_7': [209, 238, 238], 'color_room_8': [180, 205, 205], 'color_room_9': [122, 139, 139], 'color_room_10': [175, 238, 238], 'color_room_11': [84, 153, 199], 'color_room_12': [133, 193, 233], 'color_room_13': [245, 176, 65], 'color_room_14': [82, 190, 128], 'color_room_15': [72, 201, 176], 'alpha_room_0': 255.0, 'alpha_room_1': 255.0, 'alpha_room_2': 255.0, 'alpha_room_3': 255.0, 'alpha_room_4': 255.0, 'alpha_room_5': 255.0, 'alpha_room_6': 255.0, 'alpha_room_7': 255.0, 'alpha_room_8': 255.0, 'alpha_room_9': 255.0, 'alpha_room_10': 255.0, 'alpha_room_11': 255.0, 'alpha_room_12': 255.0, 'alpha_room_13': 255.0, 'alpha_room_14': 255.0, 'alpha_room_15': 255.0}
2024-02-19 15:46:44.293 INFO (MainThread) [custom_components.valetudo_vacuum_camera.config_flow] staubi_camera: Options Configuration Started.
2024-02-19 15:46:46.432 INFO (MainThread) [custom_components.valetudo_vacuum_camera.config_flow] staubi_camera: Options Configuration Started.
2024-02-19 15:46:46.433 INFO (MainThread) [custom_components.valetudo_vacuum_camera.config_flow] Rooms 1 to 8 Colours Configuration Started.
2024-02-19 15:46:51.784 INFO (MainThread) [custom_components.valetudo_vacuum_camera.config_flow] Rooms 1 to 8 Colours Configuration Started.
2024-02-19 15:46:51.785 INFO (MainThread) [custom_components.valetudo_vacuum_camera.config_flow] Storing Updated Camera (staubi_camera) Options.
2024-02-19 15:46:51.785 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 91, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 227, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 149, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 72, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 244, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 358, in async_configure
    result = await self._async_configure(flow_id, user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 404, in _async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 501, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/valetudo_vacuum_camera/config_flow.py", line 630, in async_step_rooms_colours_1
    return await self.async_step_opt_save()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/valetudo_vacuum_camera/config_flow.py", line 751, in async_step_opt_save
    opt_update = await update_options(self.bk_options, self.options)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/valetudo_vacuum_camera/common.py", line 151, in update_options
    updated_options[key] = bk_options[key]
                           ~~~~~~~~~~^^^^^
KeyError: 'get_svg_file'

Additional information

No response

sca075 commented 8 months ago

@N1c093 Thanks will check as soon and let you know.

N1c093 commented 8 months ago

@sca075 no hurry. It isn't so important to change the colors :)

sca075 commented 8 months ago

@sca075 no hurry.

It isn't so important to change the colors :)

@N1c093 About the default / initial colors.. I agree it was input just as example.

I did roughly check the code and.. it is strange.. but the key value (that is shown at the bottom of the log) should be there if you fresh install/setup the camera from scratch from the UI (no need to remove it with HACS).

From the data in your previous config (that do not have that value) it looks like there was again an issue with the migration.

Will fix it in the next release, thanks for letting me know what was installed before.

The workaround is to remove the camera from the HA configuration..

Screenshot 2024-02-19 at 18 57 30

In the camera Entry menu at the GUI, (do not uninstall it) then it setup with the GUI again the camera and then (rotation, margins as configured now) then the colors you prefer for your room's should be saved.

Let me know if this works and please, keep this open.. I mean there's a problem is in the migration from the version 1.5.7.x to 1.5.8 that need to be fix.

N1c093 commented 8 months ago

@sca075 It worked as you already expected. After I did a fresh install/setup, the problem was gone đź‘Ť

Thank you!

sca075 commented 8 months ago

@N1c093 the bug was fixed already in the rc2 but I forgot to add it to the list of the fixes.

sca075 commented 8 months ago

Released V1.5.9 including fix for this issue.