mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Soma connect update (#85682)
* Add support for Connect U1 * update pysoma to latest version * Changes requested by epenet * Extend exeption handling to pass all tests
This commit is contained in:
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:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up Soma from a config entry."""
|
"""Set up Soma from a config entry."""
|
||||||
hass.data[DOMAIN] = {}
|
hass.data[DOMAIN] = {}
|
||||||
hass.data[DOMAIN][API] = SomaApi(entry.data[HOST], entry.data[PORT])
|
api = await hass.async_add_executor_job(SomaApi, entry.data[HOST], entry.data[PORT])
|
||||||
devices = await hass.async_add_executor_job(hass.data[DOMAIN][API].list_devices)
|
devices = await hass.async_add_executor_job(api.list_devices)
|
||||||
hass.data[DOMAIN][DEVICES] = devices["shades"]
|
hass.data[DOMAIN] = {API: api, DEVICES: devices["shades"]}
|
||||||
|
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
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):
|
async def async_step_creation(self, user_input=None):
|
||||||
"""Finish config flow."""
|
"""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:
|
try:
|
||||||
result = await self.hass.async_add_executor_job(api.list_devices)
|
result = await self.hass.async_add_executor_job(api.list_devices)
|
||||||
_LOGGER.info("Successfully set up Soma Connect")
|
_LOGGER.info("Successfully set up Soma Connect")
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/soma",
|
"documentation": "https://www.home-assistant.io/integrations/soma",
|
||||||
"codeowners": ["@ratsept", "@sebfortier2288"],
|
"codeowners": ["@ratsept", "@sebfortier2288"],
|
||||||
"requirements": ["pysoma==0.0.10"],
|
"requirements": ["pysoma==0.0.12"],
|
||||||
"iot_class": "local_polling",
|
"iot_class": "local_polling",
|
||||||
"loggers": ["api"]
|
"loggers": ["api"]
|
||||||
}
|
}
|
||||||
|
@ -1970,7 +1970,7 @@ pysnmplib==5.0.20
|
|||||||
pysnooz==0.8.3
|
pysnooz==0.8.3
|
||||||
|
|
||||||
# homeassistant.components.soma
|
# homeassistant.components.soma
|
||||||
pysoma==0.0.10
|
pysoma==0.0.12
|
||||||
|
|
||||||
# homeassistant.components.spc
|
# homeassistant.components.spc
|
||||||
pyspcwebgw==0.4.0
|
pyspcwebgw==0.4.0
|
||||||
|
@ -1414,7 +1414,7 @@ pysnmplib==5.0.20
|
|||||||
pysnooz==0.8.3
|
pysnooz==0.8.3
|
||||||
|
|
||||||
# homeassistant.components.soma
|
# homeassistant.components.soma
|
||||||
pysoma==0.0.10
|
pysoma==0.0.12
|
||||||
|
|
||||||
# homeassistant.components.spc
|
# homeassistant.components.spc
|
||||||
pyspcwebgw==0.4.0
|
pyspcwebgw==0.4.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user