Add Danfoss Ally thermostat and derivatives to ZHA (#86907)
* zha integration: Add danfoss specific clusters and attributes; add thermostat.pi_heating_demand and thermostat_ui.keypad_lockout * zha integration: fix Danfoss thermostat viewing direction not working because of use of bitmap8 instead of enum8 * ZHA Integration: add missing ThermostatChannelSensor * ZHA integration: format using black * zha integration: fix flake8 issues * ZHA danfoss: Add MinHeatSetpointLimit, MaxHeatSetpointLimit, add reporting and read config for danfoss and keypad_lockout. * ZHA danfoss: fix mypy complaining about type of _attr_entity_category * ZHA danfoss: ruff fix * fix tests * pylint: disable-next=hass-invalid-inheritance * fix pylint tests * refactoring * remove scheduled setpoint * remove scheduled setpoint in manufacturer specific * refactor * fix tests * change cluster ids * remove custom clusters * code quality * match clusters in manufacturerspecific on quirk class * fix comment * fix match on quirk in manufacturerspecific.py * correctly extend cluster handlers in manufacturerspecific.py and remove workaround for illegal use of attribute updated signals in climate.py * fix style * allow non-danfoss thermostats to work in manufacturerspecific.py * correct order of init of parent and subclasses in manufacturerspecific.py * improve entity names * fix pylint * explicitly state changing size of tuple * ignore tuple size change error * really ignore error * initial * fix tests * match on specific name and quirk name * don't restructure file as it is out of scope * move back * remove unnecessary change * fix tests * fix tests * remove code duplication * reduce code duplication * empty line * remove unused variable * end file on newline * comply with recent PRs * correctly initialize all attributes * comply with recent PRs * make class variables private * forgot one reference * swap 2 lines for consistency * reorder 2 lines * fix tests * align with recent PR * store cluster handlers in only one place * edit tests * use correct device for quirk id * change quirk id * fix tests * even if there is a quirk id, it doesn't have to have a specific cluster handler * add tests * use quirk id for manufacturer specific cluster handlers * use quirk_ids instead of quirks_classes * rename quirk_id * rename quirk_id * forgot to rename here * rename id * add tests * fix tests * fix tests * use quirk ids from zha_quirks * use quirk id from zha_quirks * wrong translation * sync changes with ZCL branch * sync * style * merge error * move bitmapSensor * merge error * merge error * watch the capitals * fix entity categories * more decapitalization * translate BitmapSensor * translate all enums * translate all enums * don't convert camelcase to snakecase * don't change enums at all * remove comments * fix bitmaps and add enum for algorithm scale factor * improve readability if bitmapsensor * fix capitals * better setpoint response time * feedback * lowercase every enum to adhere to the translation_key standard * remove enum state translations and use enums from quirks * correctly capitalize OrientationEnum * bump zha dependencies; this will have to be done in a separate PR, but this aids review * accidentally removed enum * tests * comment * Migrate reporting and ZCL attribute config out of `__init__` * hvac.py shouldn't be changed in this pull request * change wording comment * I forgot I changed the size of the tuple. --------- Co-authored-by: puddly <32534428+puddly@users.noreply.github.com>
This commit is contained in:
parent
707e422a31
commit
7f7128adbf
9 changed files with 711 additions and 5 deletions
|
@ -7,6 +7,7 @@ from typing import Any
|
|||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
from zhaquirks.danfoss import thermostat as danfoss_thermostat
|
||||
import zigpy.profiles.zha
|
||||
from zigpy.quirks import CustomCluster
|
||||
from zigpy.quirks.v2 import CustomDeviceV2, add_to_registry_v2
|
||||
|
@ -1316,3 +1317,61 @@ async def test_device_counter_sensors(
|
|||
state = hass.states.get(entity_id)
|
||||
assert state is not None
|
||||
assert state.state == "2"
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
async def zigpy_device_danfoss_thermostat(
|
||||
hass: HomeAssistant, zigpy_device_mock, zha_device_joined_restored
|
||||
):
|
||||
"""Device tracker zigpy danfoss thermostat device."""
|
||||
|
||||
zigpy_device = zigpy_device_mock(
|
||||
{
|
||||
1: {
|
||||
SIG_EP_INPUT: [
|
||||
general.Basic.cluster_id,
|
||||
general.PowerConfiguration.cluster_id,
|
||||
general.Identify.cluster_id,
|
||||
general.Time.cluster_id,
|
||||
general.PollControl.cluster_id,
|
||||
Thermostat.cluster_id,
|
||||
hvac.UserInterface.cluster_id,
|
||||
homeautomation.Diagnostic.cluster_id,
|
||||
],
|
||||
SIG_EP_OUTPUT: [general.Basic.cluster_id, general.Ota.cluster_id],
|
||||
SIG_EP_TYPE: zigpy.profiles.zha.DeviceType.THERMOSTAT,
|
||||
}
|
||||
},
|
||||
manufacturer="Danfoss",
|
||||
model="eTRV0100",
|
||||
)
|
||||
|
||||
zha_device = await zha_device_joined_restored(zigpy_device)
|
||||
return zha_device, zigpy_device
|
||||
|
||||
|
||||
async def test_danfoss_thermostat_sw_error(
|
||||
hass: HomeAssistant, zigpy_device_danfoss_thermostat
|
||||
) -> None:
|
||||
"""Test quirks defined thermostat."""
|
||||
|
||||
zha_device, zigpy_device = zigpy_device_danfoss_thermostat
|
||||
|
||||
entity_id = find_entity_id(
|
||||
Platform.SENSOR, zha_device, hass, qualifier="software_error"
|
||||
)
|
||||
assert entity_id is not None
|
||||
|
||||
cluster = zigpy_device.endpoints[1].diagnostic
|
||||
|
||||
await send_attributes_report(
|
||||
hass,
|
||||
cluster,
|
||||
{
|
||||
danfoss_thermostat.DanfossDiagnosticCluster.AttributeDefs.sw_error_code.id: 0x0001
|
||||
},
|
||||
)
|
||||
|
||||
hass_state = hass.states.get(entity_id)
|
||||
assert hass_state.state == "something"
|
||||
assert hass_state.attributes["Top_pcb_sensor_error"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue