Bump aioswitcher to 3.4.1 (#107730)

* switcher: added support for device_key logic included in aioswitcher==3.4.1

* switcher: small fix

* switcher: after lint

* switcher: fix missing device_key in tests

* remove device_key function

* fix missing device_key in tests
This commit is contained in:
YogevBokobza 2024-01-10 21:41:16 +02:00 committed by Franck Nijhof
parent d89659f196
commit b87bbd1529
No known key found for this signature in database
GPG key ID: D62583BA8AB11CA3
11 changed files with 27 additions and 9 deletions

View file

@ -89,8 +89,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
# New device - create device
_LOGGER.info(
"Discovered Switcher device - id: %s, name: %s, type: %s (%s)",
"Discovered Switcher device - id: %s, key: %s, name: %s, type: %s (%s)",
device.device_id,
device.device_key,
device.name,
device.device_type.value,
device.device_type.hex_rep,

View file

@ -142,7 +142,9 @@ class SwitcherThermostatButtonEntity(
try:
async with SwitcherType2Api(
self.coordinator.data.ip_address, self.coordinator.data.device_id
self.coordinator.data.ip_address,
self.coordinator.data.device_id,
self.coordinator.data.device_key,
) as swapi:
response = await self.entity_description.press_fn(swapi, self._remote)
except (asyncio.TimeoutError, OSError, RuntimeError) as err:

View file

@ -162,7 +162,9 @@ class SwitcherClimateEntity(
try:
async with SwitcherType2Api(
self.coordinator.data.ip_address, self.coordinator.data.device_id
self.coordinator.data.ip_address,
self.coordinator.data.device_id,
self.coordinator.data.device_key,
) as swapi:
response = await swapi.control_breeze_device(self._remote, **kwargs)
except (asyncio.TimeoutError, OSError, RuntimeError) as err:

View file

@ -98,7 +98,9 @@ class SwitcherCoverEntity(
try:
async with SwitcherType2Api(
self.coordinator.data.ip_address, self.coordinator.data.device_id
self.coordinator.data.ip_address,
self.coordinator.data.device_id,
self.coordinator.data.device_key,
) as swapi:
response = await getattr(swapi, api)(*args)
except (asyncio.TimeoutError, OSError, RuntimeError) as err:

View file

@ -10,7 +10,7 @@ from homeassistant.core import HomeAssistant
from .const import DATA_DEVICE, DOMAIN
TO_REDACT = {"device_id", "ip_address", "mac_address"}
TO_REDACT = {"device_id", "device_key", "ip_address", "mac_address"}
async def async_get_config_entry_diagnostics(

View file

@ -7,5 +7,5 @@
"iot_class": "local_push",
"loggers": ["aioswitcher"],
"quality_scale": "platinum",
"requirements": ["aioswitcher==3.3.0"]
"requirements": ["aioswitcher==3.4.1"]
}

View file

@ -111,7 +111,9 @@ class SwitcherBaseSwitchEntity(
try:
async with SwitcherType1Api(
self.coordinator.data.ip_address, self.coordinator.data.device_id
self.coordinator.data.ip_address,
self.coordinator.data.device_id,
self.coordinator.data.device_key,
) as swapi:
response = await getattr(swapi, api)(*args)
except (asyncio.TimeoutError, OSError, RuntimeError) as err:

View file

@ -368,7 +368,7 @@ aioslimproto==2.3.3
aiosteamist==0.3.2
# homeassistant.components.switcher_kis
aioswitcher==3.3.0
aioswitcher==3.4.1
# homeassistant.components.syncthing
aiosyncthing==0.5.1

View file

@ -341,7 +341,7 @@ aioslimproto==2.3.3
aiosteamist==0.3.2
# homeassistant.components.switcher_kis
aioswitcher==3.3.0
aioswitcher==3.4.1
# homeassistant.components.syncthing
aiosyncthing==0.5.1

View file

@ -26,6 +26,10 @@ DUMMY_DEVICE_ID1 = "a123bc"
DUMMY_DEVICE_ID2 = "cafe12"
DUMMY_DEVICE_ID3 = "bada77"
DUMMY_DEVICE_ID4 = "bbd164"
DUMMY_DEVICE_KEY1 = "18"
DUMMY_DEVICE_KEY2 = "01"
DUMMY_DEVICE_KEY3 = "12"
DUMMY_DEVICE_KEY4 = "07"
DUMMY_DEVICE_NAME1 = "Plug 23BC"
DUMMY_DEVICE_NAME2 = "Heater FE12"
DUMMY_DEVICE_NAME3 = "Breeze AB39"
@ -67,6 +71,7 @@ DUMMY_PLUG_DEVICE = SwitcherPowerPlug(
DeviceType.POWER_PLUG,
DeviceState.ON,
DUMMY_DEVICE_ID1,
DUMMY_DEVICE_KEY1,
DUMMY_IP_ADDRESS1,
DUMMY_MAC_ADDRESS1,
DUMMY_DEVICE_NAME1,
@ -78,6 +83,7 @@ DUMMY_WATER_HEATER_DEVICE = SwitcherWaterHeater(
DeviceType.V4,
DeviceState.ON,
DUMMY_DEVICE_ID2,
DUMMY_DEVICE_KEY2,
DUMMY_IP_ADDRESS2,
DUMMY_MAC_ADDRESS2,
DUMMY_DEVICE_NAME2,
@ -91,6 +97,7 @@ DUMMY_SHUTTER_DEVICE = SwitcherShutter(
DeviceType.RUNNER,
DeviceState.ON,
DUMMY_DEVICE_ID4,
DUMMY_DEVICE_KEY4,
DUMMY_IP_ADDRESS4,
DUMMY_MAC_ADDRESS4,
DUMMY_DEVICE_NAME4,
@ -102,6 +109,7 @@ DUMMY_THERMOSTAT_DEVICE = SwitcherThermostat(
DeviceType.BREEZE,
DeviceState.ON,
DUMMY_DEVICE_ID3,
DUMMY_DEVICE_KEY3,
DUMMY_IP_ADDRESS3,
DUMMY_MAC_ADDRESS3,
DUMMY_DEVICE_NAME3,

View file

@ -25,6 +25,7 @@ async def test_diagnostics(
{
"auto_shutdown": "02:00:00",
"device_id": REDACTED,
"device_key": REDACTED,
"device_state": {
"__type": "<enum 'DeviceState'>",
"repr": "<DeviceState.ON: ('01', 'on')>",