mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Fix control 4 on os 2 (#119104)
This commit is contained in:
parent
0873322af7
commit
ea3097f84c
@ -120,7 +120,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
director_all_items = json.loads(director_all_items)
|
||||
entry_data[CONF_DIRECTOR_ALL_ITEMS] = director_all_items
|
||||
|
||||
entry_data[CONF_UI_CONFIGURATION] = json.loads(await director.getUiConfiguration())
|
||||
# Check if OS version is 3 or higher to get UI configuration
|
||||
entry_data[CONF_UI_CONFIGURATION] = None
|
||||
if int(entry_data[CONF_DIRECTOR_SW_VERSION].split(".")[0]) >= 3:
|
||||
entry_data[CONF_UI_CONFIGURATION] = json.loads(
|
||||
await director.getUiConfiguration()
|
||||
)
|
||||
|
||||
# Load options from config entry
|
||||
entry_data[CONF_SCAN_INTERVAL] = entry.options.get(
|
||||
|
@ -81,11 +81,18 @@ async def async_setup_entry(
|
||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||
) -> None:
|
||||
"""Set up Control4 rooms from a config entry."""
|
||||
entry_data = hass.data[DOMAIN][entry.entry_id]
|
||||
ui_config = entry_data[CONF_UI_CONFIGURATION]
|
||||
|
||||
# OS 2 will not have a ui_configuration
|
||||
if not ui_config:
|
||||
_LOGGER.debug("No UI Configuration found for Control4")
|
||||
return
|
||||
|
||||
all_rooms = await get_rooms(hass, entry)
|
||||
if not all_rooms:
|
||||
return
|
||||
|
||||
entry_data = hass.data[DOMAIN][entry.entry_id]
|
||||
scan_interval = entry_data[CONF_SCAN_INTERVAL]
|
||||
_LOGGER.debug("Scan interval = %s", scan_interval)
|
||||
|
||||
@ -119,8 +126,6 @@ async def async_setup_entry(
|
||||
if "parentId" in item and k > 1
|
||||
}
|
||||
|
||||
ui_config = entry_data[CONF_UI_CONFIGURATION]
|
||||
|
||||
entity_list = []
|
||||
for room in all_rooms:
|
||||
room_id = room["id"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user