Refactor evohome test fixtures for improved testing (#126781)

This commit is contained in:
David Bonnes 2024-09-27 08:40:52 +01:00 committed by GitHub
parent 0b19831a7a
commit cff9e9abab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 936 additions and 135 deletions

View File

@ -11,9 +11,10 @@ USERNAME: Final = "test_user@gmail.com"
# The h-numbers refer to issues in HA's core repo
TEST_INSTALLS: Final = (
"minimal", # evohome (single zone, no DHW)
"default", # evohome (multi-zone, with DHW & ghost zones)
"h032585", # VisionProWifi (no preset_mode for TCS)
"minimal", # evohome: single zone, no DHW
"default", # evohome: multi-zone, with DHW
"h032585", # VisionProWifi: no preset modes for TCS, zoneId=systemId
"h099625", # RoundThermostat
"sys_004", # RoundModulation
)
# "botched", # as default: but with activeFaults, ghost zones & unknown types

View File

@ -0,0 +1,125 @@
{
"locationId": "2738909",
"gateways": [
{
"gatewayId": "2499896",
"temperatureControlSystems": [
{
"systemId": "3432522",
"zones": [
{
"zoneId": "3432521",
"name": "Dead Zone",
"temperatureStatus": { "isAvailable": false },
"setpointStatus": {
"targetHeatTemperature": 17.0,
"setpointMode": "FollowSchedule"
},
"activeFaults": []
},
{
"zoneId": "3432576",
"name": "Main Room",
"temperatureStatus": { "temperature": 19.0, "isAvailable": true },
"setpointStatus": {
"targetHeatTemperature": 17.0,
"setpointMode": "PermanentOverride"
},
"activeFaults": [
{
"faultType": "TempZoneActuatorCommunicationLost",
"since": "2022-03-02T15:56:01"
}
]
},
{
"zoneId": "3432577",
"name": "Front Room",
"temperatureStatus": { "temperature": 19.0, "isAvailable": true },
"setpointStatus": {
"targetHeatTemperature": 21.0,
"setpointMode": "TemporaryOverride",
"until": "2022-03-07T19:00:00Z"
},
"activeFaults": [
{
"faultType": "TempZoneActuatorLowBattery",
"since": "2022-03-02T04:50:20"
}
]
},
{
"zoneId": "3432578",
"temperatureStatus": { "temperature": 20.0, "isAvailable": true },
"activeFaults": [],
"setpointStatus": {
"targetHeatTemperature": 17.0,
"setpointMode": "FollowSchedule"
},
"name": "Kitchen"
},
{
"zoneId": "3432579",
"temperatureStatus": { "temperature": 20.0, "isAvailable": true },
"activeFaults": [],
"setpointStatus": {
"targetHeatTemperature": 16.0,
"setpointMode": "FollowSchedule"
},
"name": "Bathroom Dn"
},
{
"zoneId": "3432580",
"temperatureStatus": { "temperature": 21.0, "isAvailable": true },
"activeFaults": [],
"setpointStatus": {
"targetHeatTemperature": 16.0,
"setpointMode": "FollowSchedule"
},
"name": "Main Bedroom"
},
{
"zoneId": "3449703",
"temperatureStatus": { "temperature": 19.5, "isAvailable": true },
"activeFaults": [],
"setpointStatus": {
"targetHeatTemperature": 17.0,
"setpointMode": "FollowSchedule"
},
"name": "Kids Room"
},
{
"zoneId": "3449740",
"temperatureStatus": { "temperature": 21.5, "isAvailable": true },
"activeFaults": [],
"setpointStatus": {
"targetHeatTemperature": 16.5,
"setpointMode": "FollowSchedule"
},
"name": ""
},
{
"zoneId": "3450733",
"temperatureStatus": { "temperature": 19.5, "isAvailable": true },
"activeFaults": [],
"setpointStatus": {
"targetHeatTemperature": 14.0,
"setpointMode": "PermanentOverride"
},
"name": "Spare Room"
}
],
"dhw": {
"dhwId": "3933910",
"temperatureStatus": { "temperature": 23.0, "isAvailable": true },
"stateStatus": { "state": "Off", "mode": "PermanentOverride" },
"activeFaults": []
},
"activeFaults": [],
"systemModeStatus": { "mode": "AutoWithEco", "isPermanent": true }
}
],
"activeFaults": []
}
]
}

View File

@ -0,0 +1,346 @@
[
{
"locationInfo": {
"locationId": "2738909",
"name": "My Home",
"streetAddress": "1 Main Street",
"city": "London",
"country": "UnitedKingdom",
"postcode": "E1 1AA",
"locationType": "Residential",
"useDaylightSaveSwitching": true,
"timeZone": {
"timeZoneId": "GMTStandardTime",
"displayName": "(UTC+00:00) Dublin, Edinburgh, Lisbon, London",
"offsetMinutes": 0,
"currentOffsetMinutes": 60,
"supportsDaylightSaving": true
},
"locationOwner": {
"userId": "2263181",
"username": "user_2263181@gmail.com",
"firstname": "John",
"lastname": "Smith"
}
},
"gateways": [
{
"gatewayInfo": {
"gatewayId": "2499896",
"mac": "00D02DEE0000",
"crc": "1234",
"isWiFi": false
},
"temperatureControlSystems": [
{
"systemId": "3432522",
"modelType": "EvoTouch",
"zones": [
{
"zoneId": "3432521",
"modelType": "HeatingZone",
"setpointCapabilities": {
"maxHeatSetpoint": 35.0,
"minHeatSetpoint": 5.0,
"valueResolution": 0.5,
"canControlHeat": true,
"canControlCool": false,
"allowedSetpointModes": [
"PermanentOverride",
"FollowSchedule",
"TemporaryOverride"
],
"maxDuration": "1.00:00:00",
"timingResolution": "00:10:00"
},
"scheduleCapabilities": {
"maxSwitchpointsPerDay": 6,
"minSwitchpointsPerDay": 1,
"timingResolution": "00:10:00",
"setpointValueResolution": 0.5
},
"name": "Dead Zone",
"zoneType": "RadiatorZone"
},
{
"zoneId": "3432576",
"modelType": "HeatingZone",
"setpointCapabilities": {
"maxHeatSetpoint": 35.0,
"minHeatSetpoint": 5.0,
"valueResolution": 0.5,
"canControlHeat": true,
"canControlCool": false,
"allowedSetpointModes": [
"PermanentOverride",
"FollowSchedule",
"TemporaryOverride"
],
"maxDuration": "1.00:00:00",
"timingResolution": "00:10:00"
},
"scheduleCapabilities": {
"maxSwitchpointsPerDay": 6,
"minSwitchpointsPerDay": 1,
"timingResolution": "00:10:00",
"setpointValueResolution": 0.5
},
"name": "Main Room",
"zoneType": "RadiatorZone"
},
{
"zoneId": "3432577",
"modelType": "HeatingZone",
"setpointCapabilities": {
"maxHeatSetpoint": 35.0,
"minHeatSetpoint": 5.0,
"valueResolution": 0.5,
"canControlHeat": true,
"canControlCool": false,
"allowedSetpointModes": [
"PermanentOverride",
"FollowSchedule",
"TemporaryOverride"
],
"maxDuration": "1.00:00:00",
"timingResolution": "00:10:00"
},
"scheduleCapabilities": {
"maxSwitchpointsPerDay": 6,
"minSwitchpointsPerDay": 1,
"timingResolution": "00:10:00",
"setpointValueResolution": 0.5
},
"name": "Front Room",
"zoneType": "RadiatorZone"
},
{
"zoneId": "3432578",
"modelType": "HeatingZone",
"setpointCapabilities": {
"maxHeatSetpoint": 35.0,
"minHeatSetpoint": 5.0,
"valueResolution": 0.5,
"canControlHeat": true,
"canControlCool": false,
"allowedSetpointModes": [
"PermanentOverride",
"FollowSchedule",
"TemporaryOverride"
],
"maxDuration": "1.00:00:00",
"timingResolution": "00:10:00"
},
"scheduleCapabilities": {
"maxSwitchpointsPerDay": 6,
"minSwitchpointsPerDay": 1,
"timingResolution": "00:10:00",
"setpointValueResolution": 0.5
},
"name": "Kitchen",
"zoneType": "RadiatorZone"
},
{
"zoneId": "3432579",
"modelType": "HeatingZone",
"setpointCapabilities": {
"maxHeatSetpoint": 35.0,
"minHeatSetpoint": 5.0,
"valueResolution": 0.5,
"canControlHeat": true,
"canControlCool": false,
"allowedSetpointModes": [
"PermanentOverride",
"FollowSchedule",
"TemporaryOverride"
],
"maxDuration": "1.00:00:00",
"timingResolution": "00:10:00"
},
"scheduleCapabilities": {
"maxSwitchpointsPerDay": 6,
"minSwitchpointsPerDay": 1,
"timingResolution": "00:10:00",
"setpointValueResolution": 0.5
},
"name": "Bathroom Dn",
"zoneType": "RadiatorZone"
},
{
"zoneId": "3432580",
"modelType": "HeatingZone",
"setpointCapabilities": {
"maxHeatSetpoint": 35.0,
"minHeatSetpoint": 5.0,
"valueResolution": 0.5,
"canControlHeat": true,
"canControlCool": false,
"allowedSetpointModes": [
"PermanentOverride",
"FollowSchedule",
"TemporaryOverride"
],
"maxDuration": "1.00:00:00",
"timingResolution": "00:10:00"
},
"scheduleCapabilities": {
"maxSwitchpointsPerDay": 6,
"minSwitchpointsPerDay": 1,
"timingResolution": "00:10:00",
"setpointValueResolution": 0.5
},
"name": "Main Bedroom",
"zoneType": "RadiatorZone"
},
{
"zoneId": "3449703",
"modelType": "HeatingZone",
"setpointCapabilities": {
"maxHeatSetpoint": 35.0,
"minHeatSetpoint": 5.0,
"valueResolution": 0.5,
"canControlHeat": true,
"canControlCool": false,
"allowedSetpointModes": [
"PermanentOverride",
"FollowSchedule",
"TemporaryOverride"
],
"maxDuration": "1.00:00:00",
"timingResolution": "00:10:00"
},
"scheduleCapabilities": {
"maxSwitchpointsPerDay": 6,
"minSwitchpointsPerDay": 1,
"timingResolution": "00:10:00",
"setpointValueResolution": 0.5
},
"name": "Kids Room",
"zoneType": "RadiatorZone"
},
{
"zoneId": "3449740",
"modelType": "Unknown",
"setpointCapabilities": {
"maxHeatSetpoint": 35.0,
"minHeatSetpoint": 5.0,
"valueResolution": 0.5,
"canControlHeat": true,
"canControlCool": false,
"allowedSetpointModes": [
"PermanentOverride",
"FollowSchedule",
"TemporaryOverride"
],
"maxDuration": "1.00:00:00",
"timingResolution": "00:10:00"
},
"scheduleCapabilities": {
"maxSwitchpointsPerDay": 6,
"minSwitchpointsPerDay": 1,
"timingResolution": "00:10:00",
"setpointValueResolution": 0.5
},
"name": "",
"zoneType": "Unknown"
},
{
"zoneId": "3450733",
"modelType": "xxx",
"setpointCapabilities": {
"maxHeatSetpoint": 35.0,
"minHeatSetpoint": 5.0,
"valueResolution": 0.5,
"canControlHeat": true,
"canControlCool": false,
"allowedSetpointModes": [
"PermanentOverride",
"FollowSchedule",
"TemporaryOverride"
],
"maxDuration": "1.00:00:00",
"timingResolution": "00:10:00"
},
"scheduleCapabilities": {
"maxSwitchpointsPerDay": 6,
"minSwitchpointsPerDay": 1,
"timingResolution": "00:10:00",
"setpointValueResolution": 0.5
},
"name": "Spare Room",
"zoneType": "xxx"
}
],
"dhw": {
"dhwId": "3933910",
"dhwStateCapabilitiesResponse": {
"allowedStates": ["On", "Off"],
"allowedModes": [
"FollowSchedule",
"PermanentOverride",
"TemporaryOverride"
],
"maxDuration": "1.00:00:00",
"timingResolution": "00:10:00"
},
"scheduleCapabilitiesResponse": {
"maxSwitchpointsPerDay": 6,
"minSwitchpointsPerDay": 1,
"timingResolution": "00:10:00"
}
},
"allowedSystemModes": [
{
"systemMode": "HeatingOff",
"canBePermanent": true,
"canBeTemporary": false
},
{
"systemMode": "Auto",
"canBePermanent": true,
"canBeTemporary": false
},
{
"systemMode": "AutoWithReset",
"canBePermanent": true,
"canBeTemporary": false
},
{
"systemMode": "AutoWithEco",
"canBePermanent": true,
"canBeTemporary": true,
"maxDuration": "1.00:00:00",
"timingResolution": "01:00:00",
"timingMode": "Duration"
},
{
"systemMode": "Away",
"canBePermanent": true,
"canBeTemporary": true,
"maxDuration": "99.00:00:00",
"timingResolution": "1.00:00:00",
"timingMode": "Period"
},
{
"systemMode": "DayOff",
"canBePermanent": true,
"canBeTemporary": true,
"maxDuration": "99.00:00:00",
"timingResolution": "1.00:00:00",
"timingMode": "Period"
},
{
"systemMode": "Custom",
"canBePermanent": true,
"canBeTemporary": true,
"maxDuration": "99.00:00:00",
"timingResolution": "1.00:00:00",
"timingMode": "Period"
}
]
}
]
}
]
}
]

View File

@ -25,12 +25,7 @@
"targetHeatTemperature": 17.0,
"setpointMode": "PermanentOverride"
},
"activeFaults": [
{
"faultType": "TempZoneActuatorCommunicationLost",
"since": "2022-03-02T15:56:01"
}
]
"activeFaults": []
},
{
"zoneId": "3432577",
@ -41,12 +36,7 @@
"setpointMode": "TemporaryOverride",
"until": "2022-03-07T19:00:00Z"
},
"activeFaults": [
{
"faultType": "TempZoneActuatorLowBattery",
"since": "2022-03-02T04:50:20"
}
]
"activeFaults": []
},
{
"zoneId": "3432578",
@ -88,16 +78,6 @@
},
"name": "Kids Room"
},
{
"zoneId": "3449740",
"temperatureStatus": { "temperature": 21.5, "isAvailable": true },
"activeFaults": [],
"setpointStatus": {
"targetHeatTemperature": 16.5,
"setpointMode": "FollowSchedule"
},
"name": ""
},
{
"zoneId": "3450733",
"temperatureStatus": { "temperature": 19.5, "isAvailable": true },

View File

@ -218,35 +218,9 @@
"name": "Kids Room",
"zoneType": "RadiatorZone"
},
{
"zoneId": "3449740",
"modelType": "Unknown",
"setpointCapabilities": {
"maxHeatSetpoint": 35.0,
"minHeatSetpoint": 5.0,
"valueResolution": 0.5,
"canControlHeat": true,
"canControlCool": false,
"allowedSetpointModes": [
"PermanentOverride",
"FollowSchedule",
"TemporaryOverride"
],
"maxDuration": "1.00:00:00",
"timingResolution": "00:10:00"
},
"scheduleCapabilities": {
"maxSwitchpointsPerDay": 6,
"minSwitchpointsPerDay": 1,
"timingResolution": "00:10:00",
"setpointValueResolution": 0.5
},
"name": "",
"zoneType": "Unknown"
},
{
"zoneId": "3450733",
"modelType": "xxx",
"modelType": "HeatingZone",
"setpointCapabilities": {
"maxHeatSetpoint": 35.0,
"minHeatSetpoint": 5.0,
@ -268,7 +242,7 @@
"setpointValueResolution": 0.5
},
"name": "Spare Room",
"zoneType": "xxx"
"zoneType": "RadiatorZone"
}
],
"dhw": {

View File

@ -1,5 +1,5 @@
# serializer version: 1
# name: test_entities[default]
# name: test_entities[botched]
list([
StateSnapshot({
'attributes': ReadOnlyDict({
@ -408,6 +408,452 @@
}),
])
# ---
# name: test_entities[default]
list([
StateSnapshot({
'attributes': ReadOnlyDict({
'current_temperature': 19.7,
'friendly_name': 'My Home',
'hvac_modes': list([
<HVACMode.OFF: 'off'>,
<HVACMode.HEAT: 'heat'>,
]),
'icon': 'mdi:thermostat',
'max_temp': 35,
'min_temp': 7,
'preset_mode': 'eco',
'preset_modes': list([
'Reset',
'eco',
'away',
'home',
'Custom',
]),
'status': dict({
'active_system_faults': list([
]),
'system_id': '3432522',
'system_mode_status': dict({
'is_permanent': True,
'mode': 'AutoWithEco',
}),
}),
'supported_features': <ClimateEntityFeature: 400>,
}),
'context': <ANY>,
'entity_id': 'climate.my_home',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'heat',
}),
StateSnapshot({
'attributes': ReadOnlyDict({
'current_temperature': None,
'friendly_name': 'Dead Zone',
'hvac_modes': list([
<HVACMode.OFF: 'off'>,
<HVACMode.HEAT: 'heat'>,
]),
'max_temp': 35.0,
'min_temp': 5.0,
'preset_mode': 'none',
'preset_modes': list([
'none',
'temporary',
'permanent',
]),
'status': dict({
'active_faults': list([
]),
'setpoint_status': dict({
'setpoint_mode': 'FollowSchedule',
'target_heat_temperature': 17.0,
}),
'setpoints': dict({
'next_sp_from': '2024-07-10T14:10:00-07:00',
'next_sp_temp': 18.6,
'this_sp_from': '2024-07-10T00:00:00-07:00',
'this_sp_temp': 16.0,
}),
'temperature_status': dict({
'is_available': False,
}),
'zone_id': '3432521',
}),
'supported_features': <ClimateEntityFeature: 401>,
'temperature': 17.0,
}),
'context': <ANY>,
'entity_id': 'climate.dead_zone',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'heat',
}),
StateSnapshot({
'attributes': ReadOnlyDict({
'current_temperature': 19.0,
'friendly_name': 'Main Room',
'hvac_modes': list([
<HVACMode.OFF: 'off'>,
<HVACMode.HEAT: 'heat'>,
]),
'max_temp': 35.0,
'min_temp': 5.0,
'preset_mode': 'permanent',
'preset_modes': list([
'none',
'temporary',
'permanent',
]),
'status': dict({
'active_faults': list([
]),
'setpoint_status': dict({
'setpoint_mode': 'PermanentOverride',
'target_heat_temperature': 17.0,
}),
'setpoints': dict({
'next_sp_from': '2024-07-10T14:10:00-07:00',
'next_sp_temp': 18.6,
'this_sp_from': '2024-07-10T00:00:00-07:00',
'this_sp_temp': 16.0,
}),
'temperature_status': dict({
'is_available': True,
'temperature': 19.0,
}),
'zone_id': '3432576',
}),
'supported_features': <ClimateEntityFeature: 401>,
'temperature': 17.0,
}),
'context': <ANY>,
'entity_id': 'climate.main_room',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'heat',
}),
StateSnapshot({
'attributes': ReadOnlyDict({
'current_temperature': 19.0,
'friendly_name': 'Front Room',
'hvac_modes': list([
<HVACMode.OFF: 'off'>,
<HVACMode.HEAT: 'heat'>,
]),
'max_temp': 35.0,
'min_temp': 5.0,
'preset_mode': 'temporary',
'preset_modes': list([
'none',
'temporary',
'permanent',
]),
'status': dict({
'active_faults': list([
]),
'setpoint_status': dict({
'setpoint_mode': 'TemporaryOverride',
'target_heat_temperature': 21.0,
'until': '2022-03-07T11:00:00-08:00',
}),
'setpoints': dict({
'next_sp_from': '2024-07-10T14:10:00-07:00',
'next_sp_temp': 18.6,
'this_sp_from': '2024-07-10T00:00:00-07:00',
'this_sp_temp': 16.0,
}),
'temperature_status': dict({
'is_available': True,
'temperature': 19.0,
}),
'zone_id': '3432577',
}),
'supported_features': <ClimateEntityFeature: 401>,
'temperature': 21.0,
}),
'context': <ANY>,
'entity_id': 'climate.front_room',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'heat',
}),
StateSnapshot({
'attributes': ReadOnlyDict({
'current_temperature': 20.0,
'friendly_name': 'Kitchen',
'hvac_modes': list([
<HVACMode.OFF: 'off'>,
<HVACMode.HEAT: 'heat'>,
]),
'max_temp': 35.0,
'min_temp': 5.0,
'preset_mode': 'none',
'preset_modes': list([
'none',
'temporary',
'permanent',
]),
'status': dict({
'active_faults': list([
]),
'setpoint_status': dict({
'setpoint_mode': 'FollowSchedule',
'target_heat_temperature': 17.0,
}),
'setpoints': dict({
'next_sp_from': '2024-07-10T14:10:00-07:00',
'next_sp_temp': 18.6,
'this_sp_from': '2024-07-10T00:00:00-07:00',
'this_sp_temp': 16.0,
}),
'temperature_status': dict({
'is_available': True,
'temperature': 20.0,
}),
'zone_id': '3432578',
}),
'supported_features': <ClimateEntityFeature: 401>,
'temperature': 17.0,
}),
'context': <ANY>,
'entity_id': 'climate.kitchen',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'heat',
}),
StateSnapshot({
'attributes': ReadOnlyDict({
'current_temperature': 20.0,
'friendly_name': 'Bathroom Dn',
'hvac_modes': list([
<HVACMode.OFF: 'off'>,
<HVACMode.HEAT: 'heat'>,
]),
'max_temp': 35.0,
'min_temp': 5.0,
'preset_mode': 'none',
'preset_modes': list([
'none',
'temporary',
'permanent',
]),
'status': dict({
'active_faults': list([
]),
'setpoint_status': dict({
'setpoint_mode': 'FollowSchedule',
'target_heat_temperature': 16.0,
}),
'setpoints': dict({
'next_sp_from': '2024-07-10T14:10:00-07:00',
'next_sp_temp': 18.6,
'this_sp_from': '2024-07-10T00:00:00-07:00',
'this_sp_temp': 16.0,
}),
'temperature_status': dict({
'is_available': True,
'temperature': 20.0,
}),
'zone_id': '3432579',
}),
'supported_features': <ClimateEntityFeature: 401>,
'temperature': 16.0,
}),
'context': <ANY>,
'entity_id': 'climate.bathroom_dn',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'heat',
}),
StateSnapshot({
'attributes': ReadOnlyDict({
'current_temperature': 21.0,
'friendly_name': 'Main Bedroom',
'hvac_modes': list([
<HVACMode.OFF: 'off'>,
<HVACMode.HEAT: 'heat'>,
]),
'max_temp': 35.0,
'min_temp': 5.0,
'preset_mode': 'none',
'preset_modes': list([
'none',
'temporary',
'permanent',
]),
'status': dict({
'active_faults': list([
]),
'setpoint_status': dict({
'setpoint_mode': 'FollowSchedule',
'target_heat_temperature': 16.0,
}),
'setpoints': dict({
'next_sp_from': '2024-07-10T14:10:00-07:00',
'next_sp_temp': 18.6,
'this_sp_from': '2024-07-10T00:00:00-07:00',
'this_sp_temp': 16.0,
}),
'temperature_status': dict({
'is_available': True,
'temperature': 21.0,
}),
'zone_id': '3432580',
}),
'supported_features': <ClimateEntityFeature: 401>,
'temperature': 16.0,
}),
'context': <ANY>,
'entity_id': 'climate.main_bedroom',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'heat',
}),
StateSnapshot({
'attributes': ReadOnlyDict({
'current_temperature': 19.5,
'friendly_name': 'Kids Room',
'hvac_modes': list([
<HVACMode.OFF: 'off'>,
<HVACMode.HEAT: 'heat'>,
]),
'max_temp': 35.0,
'min_temp': 5.0,
'preset_mode': 'none',
'preset_modes': list([
'none',
'temporary',
'permanent',
]),
'status': dict({
'active_faults': list([
]),
'setpoint_status': dict({
'setpoint_mode': 'FollowSchedule',
'target_heat_temperature': 17.0,
}),
'setpoints': dict({
'next_sp_from': '2024-07-10T14:10:00-07:00',
'next_sp_temp': 18.6,
'this_sp_from': '2024-07-10T00:00:00-07:00',
'this_sp_temp': 16.0,
}),
'temperature_status': dict({
'is_available': True,
'temperature': 19.5,
}),
'zone_id': '3449703',
}),
'supported_features': <ClimateEntityFeature: 401>,
'temperature': 17.0,
}),
'context': <ANY>,
'entity_id': 'climate.kids_room',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'heat',
}),
StateSnapshot({
'attributes': ReadOnlyDict({
'current_temperature': 19.5,
'friendly_name': 'Spare Room',
'hvac_modes': list([
<HVACMode.OFF: 'off'>,
<HVACMode.HEAT: 'heat'>,
]),
'max_temp': 35.0,
'min_temp': 5.0,
'preset_mode': 'permanent',
'preset_modes': list([
'none',
'temporary',
'permanent',
]),
'status': dict({
'active_faults': list([
]),
'setpoint_status': dict({
'setpoint_mode': 'PermanentOverride',
'target_heat_temperature': 14.0,
}),
'setpoints': dict({
'next_sp_from': '2024-07-10T14:10:00-07:00',
'next_sp_temp': 18.6,
'this_sp_from': '2024-07-10T00:00:00-07:00',
'this_sp_temp': 16.0,
}),
'temperature_status': dict({
'is_available': True,
'temperature': 19.5,
}),
'zone_id': '3450733',
}),
'supported_features': <ClimateEntityFeature: 401>,
'temperature': 14.0,
}),
'context': <ANY>,
'entity_id': 'climate.spare_room',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'heat',
}),
StateSnapshot({
'attributes': ReadOnlyDict({
'away_mode': 'on',
'current_temperature': 23,
'friendly_name': 'Domestic Hot Water',
'icon': 'mdi:thermometer-lines',
'max_temp': 60,
'min_temp': 43,
'operation_list': list([
'auto',
'on',
'off',
]),
'operation_mode': 'off',
'status': dict({
'active_faults': list([
]),
'dhw_id': '3933910',
'setpoints': dict({
'next_sp_from': '2024-07-10T05:00:00-07:00',
'next_sp_state': 'Off',
'this_sp_from': '2024-07-10T04:00:00-07:00',
'this_sp_state': 'On',
}),
'state_status': dict({
'mode': 'PermanentOverride',
'state': 'Off',
}),
'temperature_status': dict({
'is_available': True,
'temperature': 23.0,
}),
}),
'supported_features': <WaterHeaterEntityFeature: 6>,
'target_temp_high': None,
'target_temp_low': None,
'temperature': None,
}),
'context': <ANY>,
'entity_id': 'water_heater.domestic_hot_water',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
}),
])
# ---
# name: test_entities[h032585]
list([
StateSnapshot({
@ -614,84 +1060,6 @@
}),
])
# ---
# name: test_entities[h118169]
list([
StateSnapshot({
'attributes': ReadOnlyDict({
'current_temperature': 21.5,
'friendly_name': 'My Home',
'hvac_modes': list([
<HVACMode.OFF: 'off'>,
<HVACMode.HEAT: 'heat'>,
]),
'icon': 'mdi:thermostat',
'max_temp': 35,
'min_temp': 7,
'status': dict({
'active_system_faults': list([
]),
'system_id': '333333',
'system_mode_status': dict({
'is_permanent': True,
'mode': 'Heat',
}),
}),
'supported_features': <ClimateEntityFeature: 384>,
}),
'context': <ANY>,
'entity_id': 'climate.my_home',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'heat',
}),
StateSnapshot({
'attributes': ReadOnlyDict({
'current_temperature': 21.5,
'friendly_name': 'THERMOSTAT',
'hvac_modes': list([
<HVACMode.OFF: 'off'>,
<HVACMode.HEAT: 'heat'>,
]),
'max_temp': 32.0,
'min_temp': 4.5,
'preset_mode': 'none',
'preset_modes': list([
'none',
'temporary',
'permanent',
]),
'status': dict({
'active_faults': list([
]),
'setpoint_status': dict({
'setpoint_mode': 'FollowSchedule',
'target_heat_temperature': 21.5,
}),
'setpoints': dict({
'next_sp_from': '2024-08-14T23:00:00-07:00',
'next_sp_temp': 18.1,
'this_sp_from': '2024-08-14T15:00:00-07:00',
'this_sp_temp': 15.9,
}),
'temperature_status': dict({
'is_available': True,
'temperature': 21.5,
}),
'zone_id': '444444',
}),
'supported_features': <ClimateEntityFeature: 401>,
'temperature': 21.5,
}),
'context': <ANY>,
'entity_id': 'climate.thermostat',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'heat',
}),
])
# ---
# name: test_entities[minimal]
list([
StateSnapshot({

View File

@ -12,7 +12,7 @@ from .conftest import setup_evohome
from .const import TEST_INSTALLS
@pytest.mark.parametrize("install", TEST_INSTALLS)
@pytest.mark.parametrize("install", [*TEST_INSTALLS, "botched"])
async def test_entities(
hass: HomeAssistant,
config: dict[str, str],

View File

@ -83,18 +83,20 @@ DOMAIN_STORAGE_BASE: Final = {
}
@pytest.mark.parametrize("install", ["minimal"])
@pytest.mark.parametrize("idx", TEST_STORAGE_NULL)
async def test_auth_tokens_null(
hass: HomeAssistant,
hass_storage: dict[str, Any],
config: dict[str, str],
idx: str,
install: str,
) -> None:
"""Test loading/saving authentication tokens when no cached tokens in the store."""
hass_storage[DOMAIN] = DOMAIN_STORAGE_BASE | {"data": TEST_STORAGE_NULL[idx]}
mock_client = await setup_evohome(hass, config, install="minimal")
mock_client = await setup_evohome(hass, config, install=install)
# Confirm client was instantiated without tokens, as cache was empty...
assert SZ_REFRESH_TOKEN not in mock_client.call_args.kwargs
@ -113,12 +115,14 @@ async def test_auth_tokens_null(
)
@pytest.mark.parametrize("install", ["minimal"])
@pytest.mark.parametrize("idx", TEST_STORAGE_DATA)
async def test_auth_tokens_same(
hass: HomeAssistant,
hass_storage: dict[str, Any],
config: dict[str, str],
idx: str,
install: str,
) -> None:
"""Test loading/saving authentication tokens when matching username."""
@ -142,12 +146,14 @@ async def test_auth_tokens_same(
assert dt_util.parse_datetime(data[SZ_ACCESS_TOKEN_EXPIRES]) == ACCESS_TOKEN_EXP_DTM
@pytest.mark.parametrize("install", ["minimal"])
@pytest.mark.parametrize("idx", TEST_STORAGE_DATA)
async def test_auth_tokens_past(
hass: HomeAssistant,
hass_storage: dict[str, Any],
config: dict[str, str],
idx: str,
install: str,
) -> None:
"""Test loading/saving authentication tokens with matching username, but expired."""
@ -180,12 +186,14 @@ async def test_auth_tokens_past(
)
@pytest.mark.parametrize("install", ["minimal"])
@pytest.mark.parametrize("idx", TEST_STORAGE_DATA)
async def test_auth_tokens_diff(
hass: HomeAssistant,
hass_storage: dict[str, Any],
config: dict[str, str],
idx: str,
install: str,
) -> None:
"""Test loading/saving authentication tokens when unmatched username."""
@ -194,7 +202,6 @@ async def test_auth_tokens_diff(
mock_client = await setup_evohome(
hass, config | {CONF_USERNAME: USERNAME_DIFF}, install="minimal"
)
# Confirm client was instantiated without tokens, as username was different...
assert SZ_REFRESH_TOKEN not in mock_client.call_args.kwargs
assert SZ_ACCESS_TOKEN not in mock_client.call_args.kwargs