mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Bump pyinsteon to 1.3.1 (#87788)
* Bump pyinsteon to 1.3.1 * Fix record received test * Fix status received test
This commit is contained in:
parent
8fddd0e53a
commit
926534bde2
@ -4,12 +4,6 @@ from typing import Any
|
|||||||
|
|
||||||
from pyinsteon import devices
|
from pyinsteon import devices
|
||||||
from pyinsteon.constants import ALDBStatus
|
from pyinsteon.constants import ALDBStatus
|
||||||
from pyinsteon.topics import (
|
|
||||||
ALDB_STATUS_CHANGED,
|
|
||||||
DEVICE_LINK_CONTROLLER_CREATED,
|
|
||||||
DEVICE_LINK_RESPONDER_CREATED,
|
|
||||||
)
|
|
||||||
from pyinsteon.utils import subscribe_topic, unsubscribe_topic
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components import websocket_api
|
from homeassistant.components import websocket_api
|
||||||
@ -271,33 +265,31 @@ async def websocket_notify_on_aldb_status(
|
|||||||
return
|
return
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def record_added(controller, responder, group):
|
def record_added(record, sender, deleted):
|
||||||
"""Forward ALDB events to websocket."""
|
"""Forward ALDB events to websocket."""
|
||||||
forward_data = {"type": "record_loaded"}
|
forward_data = {"type": "record_loaded"}
|
||||||
connection.send_message(websocket_api.event_message(msg["id"], forward_data))
|
connection.send_message(websocket_api.event_message(msg["id"], forward_data))
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def aldb_loaded():
|
def aldb_loaded(status):
|
||||||
"""Forward ALDB loaded event to websocket."""
|
"""Forward ALDB loaded event to websocket."""
|
||||||
forward_data = {
|
forward_data = {
|
||||||
"type": "status_changed",
|
"type": "status_changed",
|
||||||
"is_loading": device.aldb.status == ALDBStatus.LOADING,
|
"is_loading": status == ALDBStatus.LOADING,
|
||||||
}
|
}
|
||||||
connection.send_message(websocket_api.event_message(msg["id"], forward_data))
|
connection.send_message(websocket_api.event_message(msg["id"], forward_data))
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_cleanup() -> None:
|
def async_cleanup() -> None:
|
||||||
"""Remove signal listeners."""
|
"""Remove signal listeners."""
|
||||||
unsubscribe_topic(record_added, f"{DEVICE_LINK_CONTROLLER_CREATED}.{device.id}")
|
device.aldb.unsubscribe_record_changed(record_added)
|
||||||
unsubscribe_topic(record_added, f"{DEVICE_LINK_RESPONDER_CREATED}.{device.id}")
|
device.aldb.unsubscribe_status_changed(aldb_loaded)
|
||||||
unsubscribe_topic(aldb_loaded, f"{device.id}.{ALDB_STATUS_CHANGED}")
|
|
||||||
|
|
||||||
forward_data = {"type": "unsubscribed"}
|
forward_data = {"type": "unsubscribed"}
|
||||||
connection.send_message(websocket_api.event_message(msg["id"], forward_data))
|
connection.send_message(websocket_api.event_message(msg["id"], forward_data))
|
||||||
|
|
||||||
connection.subscriptions[msg["id"]] = async_cleanup
|
connection.subscriptions[msg["id"]] = async_cleanup
|
||||||
subscribe_topic(record_added, f"{DEVICE_LINK_CONTROLLER_CREATED}.{device.id}")
|
device.aldb.subscribe_record_changed(record_added)
|
||||||
subscribe_topic(record_added, f"{DEVICE_LINK_RESPONDER_CREATED}.{device.id}")
|
device.aldb.subscribe_status_changed(aldb_loaded)
|
||||||
subscribe_topic(aldb_loaded, f"{device.id}.{ALDB_STATUS_CHANGED}")
|
|
||||||
|
|
||||||
connection.send_result(msg[ID])
|
connection.send_result(msg[ID])
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""Utility methods for the Insteon platform."""
|
"""Utility methods for the Insteon platform."""
|
||||||
from pyinsteon.device_types import (
|
from pyinsteon.device_types.ipdb import (
|
||||||
AccessControl_Morningstar,
|
AccessControl_Morningstar,
|
||||||
ClimateControl_Thermostat,
|
ClimateControl_Thermostat,
|
||||||
ClimateControl_WirelessThermostat,
|
ClimateControl_WirelessThermostat,
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
"iot_class": "local_push",
|
"iot_class": "local_push",
|
||||||
"loggers": ["pyinsteon", "pypubsub"],
|
"loggers": ["pyinsteon", "pypubsub"],
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"pyinsteon==1.2.0",
|
"pyinsteon==1.3.1",
|
||||||
"insteon-frontend-home-assistant==0.2.0"
|
"insteon-frontend-home-assistant==0.2.0"
|
||||||
],
|
],
|
||||||
"usb": [
|
"usb": [
|
||||||
|
@ -1684,7 +1684,7 @@ pyialarm==2.2.0
|
|||||||
pyicloud==1.0.0
|
pyicloud==1.0.0
|
||||||
|
|
||||||
# homeassistant.components.insteon
|
# homeassistant.components.insteon
|
||||||
pyinsteon==1.2.0
|
pyinsteon==1.3.1
|
||||||
|
|
||||||
# homeassistant.components.intesishome
|
# homeassistant.components.intesishome
|
||||||
pyintesishome==1.8.0
|
pyintesishome==1.8.0
|
||||||
|
@ -1209,7 +1209,7 @@ pyialarm==2.2.0
|
|||||||
pyicloud==1.0.0
|
pyicloud==1.0.0
|
||||||
|
|
||||||
# homeassistant.components.insteon
|
# homeassistant.components.insteon
|
||||||
pyinsteon==1.2.0
|
pyinsteon==1.3.1
|
||||||
|
|
||||||
# homeassistant.components.ipma
|
# homeassistant.components.ipma
|
||||||
pyipma==3.0.5
|
pyipma==3.0.5
|
||||||
|
@ -5,7 +5,7 @@ from unittest.mock import AsyncMock, MagicMock, patch
|
|||||||
|
|
||||||
from pyinsteon.address import Address
|
from pyinsteon.address import Address
|
||||||
from pyinsteon.constants import ALDBStatus, ResponseStatus
|
from pyinsteon.constants import ALDBStatus, ResponseStatus
|
||||||
from pyinsteon.device_types import (
|
from pyinsteon.device_types.ipdb import (
|
||||||
AccessControl_Morningstar,
|
AccessControl_Morningstar,
|
||||||
DimmableLightingControl_KeypadLinc_8,
|
DimmableLightingControl_KeypadLinc_8,
|
||||||
GeneralController_RemoteLinc,
|
GeneralController_RemoteLinc,
|
||||||
|
@ -5,7 +5,8 @@ from unittest.mock import patch
|
|||||||
|
|
||||||
from pyinsteon import pub
|
from pyinsteon import pub
|
||||||
from pyinsteon.address import Address
|
from pyinsteon.address import Address
|
||||||
from pyinsteon.topics import ALDB_STATUS_CHANGED, DEVICE_LINK_CONTROLLER_CREATED
|
from pyinsteon.constants import ALDBStatus
|
||||||
|
from pyinsteon.topics import ALDB_LINK_CHANGED, ALDB_STATUS_CHANGED
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from homeassistant.components import insteon
|
from homeassistant.components import insteon
|
||||||
@ -223,7 +224,7 @@ async def test_notify_on_aldb_status(hass, hass_ws_client, aldb_data):
|
|||||||
msg = await ws_client.receive_json()
|
msg = await ws_client.receive_json()
|
||||||
assert msg["success"]
|
assert msg["success"]
|
||||||
|
|
||||||
pub.sendMessage(f"333333.{ALDB_STATUS_CHANGED}")
|
pub.sendMessage(f"333333.{ALDB_STATUS_CHANGED}", status=ALDBStatus.LOADED)
|
||||||
msg = await ws_client.receive_json()
|
msg = await ws_client.receive_json()
|
||||||
assert msg["event"]["type"] == "status_changed"
|
assert msg["event"]["type"] == "status_changed"
|
||||||
assert not msg["event"]["is_loading"]
|
assert not msg["event"]["is_loading"]
|
||||||
@ -245,10 +246,10 @@ async def test_notify_on_aldb_record_added(hass, hass_ws_client, aldb_data):
|
|||||||
assert msg["success"]
|
assert msg["success"]
|
||||||
|
|
||||||
pub.sendMessage(
|
pub.sendMessage(
|
||||||
f"{DEVICE_LINK_CONTROLLER_CREATED}.333333",
|
f"333333.{ALDB_LINK_CHANGED}",
|
||||||
controller=Address("11.11.11"),
|
record="some record",
|
||||||
responder=Address("33.33.33"),
|
sender=Address("11.11.11"),
|
||||||
group=100,
|
deleted=False,
|
||||||
)
|
)
|
||||||
msg = await ws_client.receive_json()
|
msg = await ws_client.receive_json()
|
||||||
assert msg["event"]["type"] == "record_loaded"
|
assert msg["event"]["type"] == "record_loaded"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user