Fix Shelly device shutdown (#120881)
This commit is contained in:
parent
1209abc944
commit
b5367e5994
5 changed files with 21 additions and 10 deletions
|
@ -102,10 +102,11 @@ async def validate_input(
|
|||
ws_context,
|
||||
options,
|
||||
)
|
||||
await rpc_device.initialize()
|
||||
await rpc_device.shutdown()
|
||||
|
||||
sleep_period = get_rpc_device_wakeup_period(rpc_device.status)
|
||||
try:
|
||||
await rpc_device.initialize()
|
||||
sleep_period = get_rpc_device_wakeup_period(rpc_device.status)
|
||||
finally:
|
||||
await rpc_device.shutdown()
|
||||
|
||||
return {
|
||||
"title": rpc_device.name,
|
||||
|
@ -121,11 +122,15 @@ async def validate_input(
|
|||
coap_context,
|
||||
options,
|
||||
)
|
||||
await block_device.initialize()
|
||||
await block_device.shutdown()
|
||||
try:
|
||||
await block_device.initialize()
|
||||
sleep_period = get_block_device_sleep_period(block_device.settings)
|
||||
finally:
|
||||
await block_device.shutdown()
|
||||
|
||||
return {
|
||||
"title": block_device.name,
|
||||
CONF_SLEEP_PERIOD: get_block_device_sleep_period(block_device.settings),
|
||||
CONF_SLEEP_PERIOD: sleep_period,
|
||||
"model": block_device.model,
|
||||
CONF_GEN: gen,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue