Add support for HmIP-eTRV-E to homematicip_cloud (#82876)

* Add device HmIP-eTRV-E

* Fix test
pull/82913/head
hahn-th 2022-11-29 11:13:53 +01:00 committed by GitHub
parent 987c7a28a9
commit 9f8dea10f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 164 additions and 5 deletions

View File

@ -3,7 +3,11 @@ from __future__ import annotations
from typing import Any
from homematicip.aio.device import AsyncHeatingThermostat, AsyncHeatingThermostatCompact
from homematicip.aio.device import (
AsyncHeatingThermostat,
AsyncHeatingThermostatCompact,
AsyncHeatingThermostatEvo,
)
from homematicip.aio.group import AsyncHeatingGroup
from homematicip.base.enums import AbsenceType
from homematicip.device import Switch
@ -312,11 +316,16 @@ class HomematicipHeatingGroup(HomematicipGenericEntity, ClimateEntity):
@property
def _first_radiator_thermostat(
self,
) -> AsyncHeatingThermostat | AsyncHeatingThermostatCompact | None:
) -> AsyncHeatingThermostat | AsyncHeatingThermostatCompact | AsyncHeatingThermostatEvo | None:
"""Return the first radiator thermostat from the hmip heating group."""
for device in self._device.devices:
if isinstance(
device, (AsyncHeatingThermostat, AsyncHeatingThermostatCompact)
device,
(
AsyncHeatingThermostat,
AsyncHeatingThermostatCompact,
AsyncHeatingThermostatEvo,
),
):
return device

View File

@ -8,6 +8,7 @@ from homematicip.aio.device import (
AsyncFullFlushSwitchMeasuring,
AsyncHeatingThermostat,
AsyncHeatingThermostatCompact,
AsyncHeatingThermostatEvo,
AsyncHomeControlAccessPoint,
AsyncLightSensor,
AsyncMotionDetectorIndoor,
@ -75,7 +76,14 @@ async def async_setup_entry(
for device in hap.home.devices:
if isinstance(device, AsyncHomeControlAccessPoint):
entities.append(HomematicipAccesspointDutyCycle(hap, device))
if isinstance(device, (AsyncHeatingThermostat, AsyncHeatingThermostatCompact)):
if isinstance(
device,
(
AsyncHeatingThermostat,
AsyncHeatingThermostatCompact,
AsyncHeatingThermostatEvo,
),
):
entities.append(HomematicipHeatingThermostat(hap, device))
entities.append(HomematicipTemperatureSensor(hap, device))
if isinstance(

View File

@ -22,7 +22,7 @@ async def test_hmip_load_all_supported_devices(hass, default_mock_hap_factory):
test_devices=None, test_groups=None
)
assert len(mock_hap.hmip_device_by_entity_id) == 264
assert len(mock_hap.hmip_device_by_entity_id) == 267
async def test_hmip_remove_device(hass, default_mock_hap_factory):

View File

@ -193,6 +193,50 @@ async def test_hmip_temperature_sensor3(hass, default_mock_hap_factory):
assert ha_state.attributes[ATTR_TEMPERATURE_OFFSET] == 10
async def test_hmip_thermostat_evo_heating(hass, default_mock_hap_factory):
"""Test HomematicipHeatingThermostat for HmIP-eTRV-E."""
entity_id = "sensor.thermostat_evo_heating"
entity_name = "thermostat_evo Heating"
device_model = "HmIP-eTRV-E"
mock_hap = await default_mock_hap_factory.async_get_mock_hap(
test_devices=["thermostat_evo"]
)
ha_state, hmip_device = get_and_check_entity_basics(
hass, mock_hap, entity_id, entity_name, device_model
)
assert ha_state.state == "33"
await async_manipulate_test_data(hass, hmip_device, "valvePosition", 0.4)
ha_state = hass.states.get(entity_id)
assert ha_state.attributes[ATTR_UNIT_OF_MEASUREMENT] == PERCENTAGE
assert ha_state.state == "40"
async def test_hmip_thermostat_evo_temperature(hass, default_mock_hap_factory):
"""Test HomematicipTemperatureSensor."""
entity_id = "sensor.thermostat_evo_temperature"
entity_name = "thermostat_evo Temperature"
device_model = "HmIP-eTRV-E"
mock_hap = await default_mock_hap_factory.async_get_mock_hap(
test_devices=["thermostat_evo"]
)
ha_state, hmip_device = get_and_check_entity_basics(
hass, mock_hap, entity_id, entity_name, device_model
)
assert ha_state.state == "18.7"
assert ha_state.attributes[ATTR_UNIT_OF_MEASUREMENT] == TEMP_CELSIUS
await async_manipulate_test_data(hass, hmip_device, "valveActualTemperature", 23.5)
ha_state = hass.states.get(entity_id)
assert ha_state.state == "23.5"
await async_manipulate_test_data(hass, hmip_device, "temperatureOffset", 0.7)
ha_state = hass.states.get(entity_id)
assert ha_state.attributes[ATTR_TEMPERATURE_OFFSET] == 0.7
async def test_hmip_power_sensor(hass, default_mock_hap_factory):
"""Test HomematicipPowerSensor."""
entity_id = "sensor.flur_oben_power"

View File

@ -2736,6 +2736,104 @@
"type": "HEATING_THERMOSTAT_COMPACT",
"updateState": "UP_TO_DATE"
},
"3014F7110000000000000E70": {
"automaticValveAdaptionNeeded": false,
"availableFirmwareVersion": "1.0.10",
"connectionType": "HMIP_RF",
"firmwareVersion": "1.0.10",
"firmwareVersionInteger": 65546,
"functionalChannels": {
"0": {
"busConfigMismatch": null,
"coProFaulty": false,
"coProRestartNeeded": false,
"coProUpdateFailure": false,
"configPending": false,
"deviceId": "3014F7110000000000000E70",
"deviceOverheated": false,
"deviceOverloaded": false,
"devicePowerFailureDetected": false,
"deviceUndervoltage": false,
"displayContrast": 5,
"dutyCycle": false,
"functionalChannelType": "DEVICE_OPERATIONLOCK",
"groupIndex": 0,
"groups": ["00000000-0000-0000-0000-000000000012"],
"index": 0,
"label": "",
"lockJammed": null,
"lowBat": false,
"mountingOrientation": "RIGHT",
"multicastRoutingEnabled": false,
"operationLockActive": false,
"particulateMatterSensorCommunicationError": null,
"particulateMatterSensorError": null,
"powerShortCircuit": null,
"profilePeriodLimitReached": null,
"routerModuleEnabled": false,
"routerModuleSupported": false,
"rssiDeviceValue": -64,
"rssiPeerValue": -67,
"shortCircuitDataLine": null,
"supportedOptionalFeatures": {
"IFeatureBusConfigMismatch": false,
"IFeatureDeviceCoProError": false,
"IFeatureDeviceCoProRestart": false,
"IFeatureDeviceCoProUpdate": false,
"IFeatureDeviceIdentify": false,
"IFeatureDeviceOverheated": false,
"IFeatureDeviceOverloaded": false,
"IFeatureDeviceParticulateMatterSensorCommunicationError": false,
"IFeatureDeviceParticulateMatterSensorError": false,
"IFeatureDevicePowerFailure": false,
"IFeatureDeviceTemperatureHumiditySensorCommunicationError": false,
"IFeatureDeviceTemperatureHumiditySensorError": false,
"IFeatureDeviceTemperatureOutOfRange": false,
"IFeatureDeviceUndervoltage": false,
"IFeatureMulticastRouter": false,
"IFeaturePowerShortCircuit": false,
"IFeatureProfilePeriodLimit": false,
"IFeatureRssiValue": true,
"IFeatureShortCircuitDataLine": false,
"IOptionalFeatureDeviceErrorLockJammed": false,
"IOptionalFeatureDisplayContrast": true,
"IOptionalFeatureDutyCycle": true,
"IOptionalFeatureLowBat": true,
"IOptionalFeatureMountingOrientation": true
},
"temperatureHumiditySensorCommunicationError": null,
"temperatureHumiditySensorError": null,
"temperatureOutOfRange": false,
"unreach": false
},
"1": {
"deviceId": "3014F7110000000000000E70",
"functionalChannelType": "HEATING_THERMOSTAT_CHANNEL",
"groupIndex": 1,
"groups": ["00000000-0000-0000-0000-000000000013"],
"index": 1,
"label": "",
"setPointTemperature": 19.0,
"temperatureOffset": 0.5,
"valveActualTemperature": 18.7,
"valvePosition": 0.33,
"valveState": "ADAPTION_DONE"
}
},
"homeId": "00000000-0000-0000-0000-000000000001",
"id": "3014F7110000000000000E70",
"label": "thermostat_evo",
"lastStatusUpdate": 1644406143910,
"liveUpdateState": "LIVE_UPDATE_NOT_SUPPORTED",
"manufacturerCode": 1,
"modelId": 425,
"modelType": "HmIP-eTRV-E",
"oem": "eQ-3",
"permanentlyReachable": true,
"serializedGlobalTradeItemNumber": "3014F7110000000000000E70",
"type": "HEATING_THERMOSTAT_EVO",
"updateState": "UP_TO_DATE"
},
"3014F71100000000000TEST1": {
"availableFirmwareVersion": "0.0.0",
"connectionType": "HMIP_RF",