Soma connect update (#85682)
* Add support for Connect U1 * update pysoma to latest version * Changes requested by epenet * Extend exeption handling to pass all testspull/86086/head
parent
cb36905ce5
commit
9b835f88c7
|
@ -54,9 +54,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Set up Soma from a config entry."""
|
||||
hass.data[DOMAIN] = {}
|
||||
hass.data[DOMAIN][API] = SomaApi(entry.data[HOST], entry.data[PORT])
|
||||
devices = await hass.async_add_executor_job(hass.data[DOMAIN][API].list_devices)
|
||||
hass.data[DOMAIN][DEVICES] = devices["shades"]
|
||||
api = await hass.async_add_executor_job(SomaApi, entry.data[HOST], entry.data[PORT])
|
||||
devices = await hass.async_add_executor_job(api.list_devices)
|
||||
hass.data[DOMAIN] = {API: api, DEVICES: devices["shades"]}
|
||||
|
||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||
|
||||
|
|
|
@ -37,7 +37,13 @@ class SomaFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
|
||||
async def async_step_creation(self, user_input=None):
|
||||
"""Finish config flow."""
|
||||
api = SomaApi(user_input["host"], user_input["port"])
|
||||
try:
|
||||
api = await self.hass.async_add_executor_job(
|
||||
SomaApi, user_input["host"], user_input["port"]
|
||||
)
|
||||
except RequestException:
|
||||
_LOGGER.error("Connection to SOMA Connect failed with RequestException")
|
||||
return self.async_abort(reason="connection_error")
|
||||
try:
|
||||
result = await self.hass.async_add_executor_job(api.list_devices)
|
||||
_LOGGER.info("Successfully set up Soma Connect")
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/soma",
|
||||
"codeowners": ["@ratsept", "@sebfortier2288"],
|
||||
"requirements": ["pysoma==0.0.10"],
|
||||
"requirements": ["pysoma==0.0.12"],
|
||||
"iot_class": "local_polling",
|
||||
"loggers": ["api"]
|
||||
}
|
||||
|
|
|
@ -1970,7 +1970,7 @@ pysnmplib==5.0.20
|
|||
pysnooz==0.8.3
|
||||
|
||||
# homeassistant.components.soma
|
||||
pysoma==0.0.10
|
||||
pysoma==0.0.12
|
||||
|
||||
# homeassistant.components.spc
|
||||
pyspcwebgw==0.4.0
|
||||
|
|
|
@ -1414,7 +1414,7 @@ pysnmplib==5.0.20
|
|||
pysnooz==0.8.3
|
||||
|
||||
# homeassistant.components.soma
|
||||
pysoma==0.0.10
|
||||
pysoma==0.0.12
|
||||
|
||||
# homeassistant.components.spc
|
||||
pyspcwebgw==0.4.0
|
||||
|
|
Loading…
Reference in New Issue