Skip to content

Commit 69f66ff

Browse files
authored
Correctly pass MopParserConfig for Roborock (home-assistant#157891)
1 parent d2c3543 commit 69f66ff

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

homeassistant/components/roborock/__init__.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,24 @@
1717
from roborock.data import UserData
1818
from roborock.devices.device import RoborockDevice
1919
from roborock.devices.device_manager import UserParams, create_device_manager
20+
from roborock.map.map_parser import MapParserConfig
2021

2122
from homeassistant.const import CONF_USERNAME, EVENT_HOMEASSISTANT_STOP
2223
from homeassistant.core import HomeAssistant
2324
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
2425
from homeassistant.helpers import device_registry as dr
2526
from homeassistant.helpers.aiohttp_client import async_get_clientsession
2627

27-
from .const import CONF_BASE_URL, CONF_USER_DATA, DOMAIN, PLATFORMS
28+
from .const import (
29+
CONF_BASE_URL,
30+
CONF_SHOW_BACKGROUND,
31+
CONF_USER_DATA,
32+
DEFAULT_DRAWABLES,
33+
DOMAIN,
34+
DRAWABLES,
35+
MAP_SCALE,
36+
PLATFORMS,
37+
)
2838
from .coordinator import (
2939
RoborockConfigEntry,
3040
RoborockCoordinators,
@@ -56,6 +66,15 @@ async def async_setup_entry(hass: HomeAssistant, entry: RoborockConfigEntry) ->
5666
user_params,
5767
cache=cache,
5868
session=async_get_clientsession(hass),
69+
map_parser_config=MapParserConfig(
70+
drawables=[
71+
drawable
72+
for drawable, default_value in DEFAULT_DRAWABLES.items()
73+
if entry.options.get(DRAWABLES, {}).get(drawable, default_value)
74+
],
75+
show_background=entry.options.get(CONF_SHOW_BACKGROUND, False),
76+
map_scale=MAP_SCALE,
77+
),
5978
)
6079
except RoborockInvalidCredentials as err:
6180
raise ConfigEntryAuthFailed(

0 commit comments

Comments
 (0)