Bump total-connect-client to 2025.1.4 (#136793)

This commit is contained in:
Austin Mroczek
2025-01-31 01:36:06 -08:00
committed by GitHub
parent fc979cd564
commit 270108e8e4
6 changed files with 43 additions and 26 deletions

View File

@ -73,7 +73,7 @@ class TotalConnectAlarm(TotalConnectLocationEntity, AlarmControlPanelEntity):
) -> None:
"""Initialize the TotalConnect status."""
super().__init__(coordinator, location)
self._partition_id = partition_id
self._partition_id = int(partition_id)
self._partition = self._location.partitions[partition_id]
"""
@ -81,7 +81,7 @@ class TotalConnectAlarm(TotalConnectLocationEntity, AlarmControlPanelEntity):
for most users with new support for partitions.
Add _# for partition 2 and beyond.
"""
if partition_id == 1:
if int(partition_id) == 1:
self._attr_name = None
self._attr_unique_id = str(location.location_id)
else:

View File

@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/totalconnect",
"iot_class": "cloud_polling",
"loggers": ["total_connect_client"],
"requirements": ["total-connect-client==2024.12"]
"requirements": ["total-connect-client==2025.1.4"]
}

2
requirements_all.txt generated
View File

@ -2902,7 +2902,7 @@ tololib==1.1.0
toonapi==0.3.0
# homeassistant.components.totalconnect
total-connect-client==2024.12
total-connect-client==2025.1.4
# homeassistant.components.tplink_lte
tp-connected==0.0.4

View File

@ -2330,7 +2330,7 @@ tololib==1.1.0
toonapi==0.3.0
# homeassistant.components.totalconnect
total-connect-client==2024.12
total-connect-client==2025.1.4
# homeassistant.components.tplink_omada
tplink-omada-client==1.4.3

View File

@ -49,20 +49,15 @@ USER = {
"UserFeatureList": "Master=0,User Administration=0,Configuration Administration=0",
}
RESPONSE_AUTHENTICATE = {
RESPONSE_SESSION_DETAILS = {
"ResultCode": ResultCode.SUCCESS.value,
"SessionID": 1,
"ResultData": "Success",
"SessionID": "12345",
"Locations": LOCATIONS,
"ModuleFlags": MODULE_FLAGS,
"UserInfo": USER,
}
RESPONSE_AUTHENTICATE_FAILED = {
"ResultCode": ResultCode.BAD_USER_OR_PASSWORD.value,
"ResultData": "test bad authentication",
}
PARTITION_DISARMED = {
"PartitionID": "1",
"ArmingState": ArmingState.DISARMED,
@ -359,13 +354,13 @@ OPTIONS_DATA = {AUTO_BYPASS: False, CODE_REQUIRED: False}
OPTIONS_DATA_CODE_REQUIRED = {AUTO_BYPASS: False, CODE_REQUIRED: True}
PARTITION_DETAILS_1 = {
"PartitionID": 1,
"PartitionID": "1",
"ArmingState": ArmingState.DISARMED.value,
"PartitionName": "Test1",
}
PARTITION_DETAILS_2 = {
"PartitionID": 2,
"PartitionID": "2",
"ArmingState": ArmingState.DISARMED.value,
"PartitionName": "Test2",
}
@ -402,6 +397,12 @@ RESPONSE_GET_ZONE_DETAILS_SUCCESS = {
TOTALCONNECT_REQUEST = (
"homeassistant.components.totalconnect.TotalConnectClient.request"
)
TOTALCONNECT_GET_CONFIG = (
"homeassistant.components.totalconnect.TotalConnectClient._get_configuration"
)
TOTALCONNECT_REQUEST_TOKEN = (
"homeassistant.components.totalconnect.TotalConnectClient._request_token"
)
async def setup_platform(
@ -420,7 +421,7 @@ async def setup_platform(
mock_entry.add_to_hass(hass)
responses = [
RESPONSE_AUTHENTICATE,
RESPONSE_SESSION_DETAILS,
RESPONSE_PARTITION_DETAILS,
RESPONSE_GET_ZONE_DETAILS_SUCCESS,
RESPONSE_DISARMED,
@ -433,6 +434,8 @@ async def setup_platform(
TOTALCONNECT_REQUEST,
side_effect=responses,
) as mock_request,
patch(TOTALCONNECT_GET_CONFIG, side_effect=None),
patch(TOTALCONNECT_REQUEST_TOKEN, side_effect=None),
):
assert await async_setup_component(hass, DOMAIN, {})
assert mock_request.call_count == 5
@ -448,17 +451,21 @@ async def init_integration(hass: HomeAssistant) -> MockConfigEntry:
mock_entry.add_to_hass(hass)
responses = [
RESPONSE_AUTHENTICATE,
RESPONSE_SESSION_DETAILS,
RESPONSE_PARTITION_DETAILS,
RESPONSE_GET_ZONE_DETAILS_SUCCESS,
RESPONSE_DISARMED,
RESPONSE_DISARMED,
]
with patch(
TOTALCONNECT_REQUEST,
side_effect=responses,
) as mock_request:
with (
patch(
TOTALCONNECT_REQUEST,
side_effect=responses,
) as mock_request,
patch(TOTALCONNECT_GET_CONFIG, side_effect=None),
patch(TOTALCONNECT_REQUEST_TOKEN, side_effect=None),
):
await hass.config_entries.async_setup(mock_entry.entry_id)
assert mock_request.call_count == 5
await hass.async_block_till_done()

View File

@ -18,13 +18,15 @@ from homeassistant.data_entry_flow import FlowResultType
from .common import (
CONFIG_DATA,
CONFIG_DATA_NO_USERCODES,
RESPONSE_AUTHENTICATE,
RESPONSE_DISARMED,
RESPONSE_GET_ZONE_DETAILS_SUCCESS,
RESPONSE_PARTITION_DETAILS,
RESPONSE_SESSION_DETAILS,
RESPONSE_SUCCESS,
RESPONSE_USER_CODE_INVALID,
TOTALCONNECT_GET_CONFIG,
TOTALCONNECT_REQUEST,
TOTALCONNECT_REQUEST_TOKEN,
USERNAME,
)
@ -48,7 +50,7 @@ async def test_user_show_locations(hass: HomeAssistant) -> None:
"""Test user locations form."""
# user/pass provided, so check if valid then ask for usercodes on locations form
responses = [
RESPONSE_AUTHENTICATE,
RESPONSE_SESSION_DETAILS,
RESPONSE_PARTITION_DETAILS,
RESPONSE_GET_ZONE_DETAILS_SUCCESS,
RESPONSE_DISARMED,
@ -61,6 +63,8 @@ async def test_user_show_locations(hass: HomeAssistant) -> None:
TOTALCONNECT_REQUEST,
side_effect=responses,
) as mock_request,
patch(TOTALCONNECT_GET_CONFIG, side_effect=None),
patch(TOTALCONNECT_REQUEST_TOKEN, side_effect=None),
patch(
"homeassistant.components.totalconnect.async_setup_entry", return_value=True
),
@ -180,7 +184,7 @@ async def test_reauth(hass: HomeAssistant) -> None:
async def test_no_locations(hass: HomeAssistant) -> None:
"""Test with no user locations."""
responses = [
RESPONSE_AUTHENTICATE,
RESPONSE_SESSION_DETAILS,
RESPONSE_PARTITION_DETAILS,
RESPONSE_GET_ZONE_DETAILS_SUCCESS,
RESPONSE_DISARMED,
@ -191,6 +195,8 @@ async def test_no_locations(hass: HomeAssistant) -> None:
TOTALCONNECT_REQUEST,
side_effect=responses,
) as mock_request,
patch(TOTALCONNECT_GET_CONFIG, side_effect=None),
patch(TOTALCONNECT_REQUEST_TOKEN, side_effect=None),
patch(
"homeassistant.components.totalconnect.async_setup_entry", return_value=True
),
@ -221,7 +227,7 @@ async def test_options_flow(hass: HomeAssistant) -> None:
config_entry.add_to_hass(hass)
responses = [
RESPONSE_AUTHENTICATE,
RESPONSE_SESSION_DETAILS,
RESPONSE_PARTITION_DETAILS,
RESPONSE_GET_ZONE_DETAILS_SUCCESS,
RESPONSE_DISARMED,
@ -229,7 +235,11 @@ async def test_options_flow(hass: HomeAssistant) -> None:
RESPONSE_DISARMED,
]
with patch(TOTALCONNECT_REQUEST, side_effect=responses):
with (
patch(TOTALCONNECT_REQUEST, side_effect=responses),
patch(TOTALCONNECT_GET_CONFIG, side_effect=None),
patch(TOTALCONNECT_REQUEST_TOKEN, side_effect=None),
):
assert await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()