Skip to content

Commit

Permalink
Add Z-wave climate sensor override for Heatit Z-TRM6 (#103896)
Browse files Browse the repository at this point in the history
* add some basic overrides for z-trm6

* switched id and type

* add fixtures some lints

* duplicate tests of z-trm3

* add broken test for trm6

* fix tests, remove name from fixtures, fix comment

* lints

* forgot lints

* add better description on pwer mode

* Update comment v2

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* fix space from github web merge

* lint on fixture

* fix permissions on fixture

---------

Co-authored-by: geir råness <11741725+geirra@users.noreply.github.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
  • Loading branch information
3 people committed Nov 24, 2023
1 parent a3eb442 commit d4450c6
Show file tree
Hide file tree
Showing 4 changed files with 2,267 additions and 0 deletions.
62 changes: 62 additions & 0 deletions homeassistant/components/zwave_js/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,68 @@ class ZWaveDiscoverySchema:
primary_value=SWITCH_BINARY_CURRENT_VALUE_SCHEMA,
assumed_state=True,
),
# Heatit Z-TRM6
ZWaveDiscoverySchema(
platform=Platform.CLIMATE,
hint="dynamic_current_temp",
manufacturer_id={0x019B},
product_id={0x3001},
product_type={0x0030},
primary_value=ZWaveValueDiscoverySchema(
command_class={CommandClass.THERMOSTAT_MODE},
property={THERMOSTAT_MODE_PROPERTY},
type={ValueType.NUMBER},
),
data_template=DynamicCurrentTempClimateDataTemplate(
lookup_table={
# Floor sensor
"Floor": ZwaveValueID(
property_=THERMOSTAT_CURRENT_TEMP_PROPERTY,
command_class=CommandClass.SENSOR_MULTILEVEL,
endpoint=4,
),
# Internal sensor
"Internal": ZwaveValueID(
property_=THERMOSTAT_CURRENT_TEMP_PROPERTY,
command_class=CommandClass.SENSOR_MULTILEVEL,
endpoint=2,
),
# Internal with limit by floor sensor
"Internal with floor limit": ZwaveValueID(
property_=THERMOSTAT_CURRENT_TEMP_PROPERTY,
command_class=CommandClass.SENSOR_MULTILEVEL,
endpoint=2,
),
# External sensor (connected to device)
"External": ZwaveValueID(
property_=THERMOSTAT_CURRENT_TEMP_PROPERTY,
command_class=CommandClass.SENSOR_MULTILEVEL,
endpoint=3,
),
# External sensor (connected to device) with limit by floor sensor (2x sensors)
"External with floor limit": ZwaveValueID(
property_=THERMOSTAT_CURRENT_TEMP_PROPERTY,
command_class=CommandClass.SENSOR_MULTILEVEL,
endpoint=3,
),
# PWER - Power regulator mode (no sensor used).
# This mode is not supported by the climate entity.
# Heating is set by adjusting parameter 25.
# P25: Set % of time the relay should be active when using PWER mode.
# (30-minute duty cycle)
# Use the air temperature as current temperature in the climate entity
# as we have nothing else.
"Power regulator": ZwaveValueID(
property_=THERMOSTAT_CURRENT_TEMP_PROPERTY,
command_class=CommandClass.SENSOR_MULTILEVEL,
endpoint=2,
),
},
dependent_value=ZwaveValueID(
property_=2, command_class=CommandClass.CONFIGURATION, endpoint=0
),
),
),
# Heatit Z-TRM3
ZWaveDiscoverySchema(
platform=Platform.CLIMATE,
Expand Down
14 changes: 14 additions & 0 deletions tests/components/zwave_js/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,12 @@ def climate_eurotronic_spirit_z_state_fixture():
return json.loads(load_fixture("zwave_js/climate_eurotronic_spirit_z_state.json"))


@pytest.fixture(name="climate_heatit_z_trm6_state", scope="session")
def climate_heatit_z_trm6_state_fixture():
"""Load the climate HEATIT Z-TRM6 thermostat node state fixture data."""
return json.loads(load_fixture("zwave_js/climate_heatit_z_trm6_state.json"))


@pytest.fixture(name="climate_heatit_z_trm3_state", scope="session")
def climate_heatit_z_trm3_state_fixture():
"""Load the climate HEATIT Z-TRM3 thermostat node state fixture data."""
Expand Down Expand Up @@ -897,6 +903,14 @@ def climate_eurotronic_spirit_z_fixture(client, climate_eurotronic_spirit_z_stat
return node


@pytest.fixture(name="climate_heatit_z_trm6")
def climate_heatit_z_trm6_fixture(client, climate_heatit_z_trm6_state):
"""Mock a climate radio HEATIT Z-TRM6 node."""
node = Node(client, copy.deepcopy(climate_heatit_z_trm6_state))
client.driver.controller.nodes[node.node_id] = node
return node


@pytest.fixture(name="climate_heatit_z_trm3_no_value")
def climate_heatit_z_trm3_no_value_fixture(
client, climate_heatit_z_trm3_no_value_state
Expand Down

0 comments on commit d4450c6

Please sign in to comment.