Insteon bug fixes (#73791)

This commit is contained in:
Tom Harris 2022-06-22 04:04:11 -04:00 committed by GitHub
parent 4bfdc61045
commit 08b69319ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 16 deletions

View File

@ -99,8 +99,6 @@ def get_properties(device: Device, show_advanced=False):
continue continue
prop_schema = get_schema(prop, name, device.groups) prop_schema = get_schema(prop, name, device.groups)
if name == "momentary_delay":
print(prop_schema)
if prop_schema is None: if prop_schema is None:
continue continue
schema[name] = prop_schema schema[name] = prop_schema
@ -216,7 +214,7 @@ async def websocket_write_properties(
result = await device.async_write_config() result = await device.async_write_config()
await devices.async_save(workdir=hass.config.config_dir) await devices.async_save(workdir=hass.config.config_dir)
if result != ResponseStatus.SUCCESS: if result not in [ResponseStatus.SUCCESS, ResponseStatus.RUN_ON_WAKE]:
connection.send_message( connection.send_message(
websocket_api.error_message( websocket_api.error_message(
msg[ID], "write_failed", "properties not written to device" msg[ID], "write_failed", "properties not written to device"
@ -244,9 +242,10 @@ async def websocket_load_properties(
notify_device_not_found(connection, msg, INSTEON_DEVICE_NOT_FOUND) notify_device_not_found(connection, msg, INSTEON_DEVICE_NOT_FOUND)
return return
result, _ = await device.async_read_config(read_aldb=False) result = await device.async_read_config(read_aldb=False)
await devices.async_save(workdir=hass.config.config_dir) await devices.async_save(workdir=hass.config.config_dir)
if result != ResponseStatus.SUCCESS:
if result not in [ResponseStatus.SUCCESS, ResponseStatus.RUN_ON_WAKE]:
connection.send_message( connection.send_message(
websocket_api.error_message( websocket_api.error_message(
msg[ID], "load_failed", "properties not loaded from device" msg[ID], "load_failed", "properties not loaded from device"

View File

@ -4,8 +4,8 @@
"documentation": "https://www.home-assistant.io/integrations/insteon", "documentation": "https://www.home-assistant.io/integrations/insteon",
"dependencies": ["http", "websocket_api"], "dependencies": ["http", "websocket_api"],
"requirements": [ "requirements": [
"pyinsteon==1.1.0", "pyinsteon==1.1.1",
"insteon-frontend-home-assistant==0.1.0" "insteon-frontend-home-assistant==0.1.1"
], ],
"codeowners": ["@teharris1"], "codeowners": ["@teharris1"],
"dhcp": [ "dhcp": [

View File

@ -196,9 +196,8 @@ def async_register_services(hass):
for address in devices: for address in devices:
device = devices[address] device = devices[address]
if device != devices.modem and device.cat != 0x03: if device != devices.modem and device.cat != 0x03:
await device.aldb.async_load( await device.aldb.async_load(refresh=reload)
refresh=reload, callback=async_srv_save_devices await async_srv_save_devices()
)
async def async_srv_save_devices(): async def async_srv_save_devices():
"""Write the Insteon device configuration to file.""" """Write the Insteon device configuration to file."""

View File

@ -888,7 +888,7 @@ influxdb-client==1.24.0
influxdb==5.3.1 influxdb==5.3.1
# homeassistant.components.insteon # homeassistant.components.insteon
insteon-frontend-home-assistant==0.1.0 insteon-frontend-home-assistant==0.1.1
# homeassistant.components.intellifire # homeassistant.components.intellifire
intellifire4py==1.0.2 intellifire4py==1.0.2
@ -1556,7 +1556,7 @@ pyialarm==1.9.0
pyicloud==1.0.0 pyicloud==1.0.0
# homeassistant.components.insteon # homeassistant.components.insteon
pyinsteon==1.1.0 pyinsteon==1.1.1
# homeassistant.components.intesishome # homeassistant.components.intesishome
pyintesishome==1.7.6 pyintesishome==1.7.6

View File

@ -631,7 +631,7 @@ influxdb-client==1.24.0
influxdb==5.3.1 influxdb==5.3.1
# homeassistant.components.insteon # homeassistant.components.insteon
insteon-frontend-home-assistant==0.1.0 insteon-frontend-home-assistant==0.1.1
# homeassistant.components.intellifire # homeassistant.components.intellifire
intellifire4py==1.0.2 intellifire4py==1.0.2
@ -1047,7 +1047,7 @@ pyialarm==1.9.0
pyicloud==1.0.0 pyicloud==1.0.0
# homeassistant.components.insteon # homeassistant.components.insteon
pyinsteon==1.1.0 pyinsteon==1.1.1
# homeassistant.components.ipma # homeassistant.components.ipma
pyipma==2.0.5 pyipma==2.0.5

View File

@ -401,7 +401,7 @@ async def test_load_properties(hass, hass_ws_client, kpl_properties_data):
) )
device = devices["33.33.33"] device = devices["33.33.33"]
device.async_read_config = AsyncMock(return_value=(1, 1)) device.async_read_config = AsyncMock(return_value=1)
with patch.object(insteon.api.properties, "devices", devices): with patch.object(insteon.api.properties, "devices", devices):
await ws_client.send_json( await ws_client.send_json(
{ID: 2, TYPE: "insteon/properties/load", DEVICE_ADDRESS: "33.33.33"} {ID: 2, TYPE: "insteon/properties/load", DEVICE_ADDRESS: "33.33.33"}
@ -418,7 +418,7 @@ async def test_load_properties_failure(hass, hass_ws_client, kpl_properties_data
) )
device = devices["33.33.33"] device = devices["33.33.33"]
device.async_read_config = AsyncMock(return_value=(0, 0)) device.async_read_config = AsyncMock(return_value=0)
with patch.object(insteon.api.properties, "devices", devices): with patch.object(insteon.api.properties, "devices", devices):
await ws_client.send_json( await ws_client.send_json(
{ID: 2, TYPE: "insteon/properties/load", DEVICE_ADDRESS: "33.33.33"} {ID: 2, TYPE: "insteon/properties/load", DEVICE_ADDRESS: "33.33.33"}