From 352c0e87f670db6168a345d96ec84b42976d5aad Mon Sep 17 00:00:00 2001 From: veista Date: Thu, 22 Dec 2022 22:27:55 +0200 Subject: [PATCH] Added Central Heating Setpoint Sensor Added CH Setpoint Sensor Changed Min Bus Version On CH select --- custom_components/nilan/device.py | 15 +++++++++++++++ custom_components/nilan/device_map.py | 16 ++++++++++++---- custom_components/nilan/manifest.json | 2 +- custom_components/nilan/sensor.py | 11 +++++++++++ 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/custom_components/nilan/device.py b/custom_components/nilan/device.py index 0340017..d971396 100644 --- a/custom_components/nilan/device.py +++ b/custom_components/nilan/device.py @@ -592,6 +592,21 @@ async def get_room_master_temperature(self) -> float: _LOGGER.error("Could not read get_room_master_temperature") return None + async def get_central_heating_setpoint(self) -> float: + """get Central Heating Temperature Setpoint.""" + result = await self._modbus.async_pymodbus_call( + self._unit_id, CTS602InputRegisters.central_heat_heat_ext_set, 1, "input" + ) + if result is not None: + value = int.from_bytes( + result.registers[0].to_bytes(2, "little", signed=False), + "little", + signed=True, + ) + return float(value) / 100 + _LOGGER.error("Could not read get_central_heating_setpoint") + return None + async def get_exchanger_efficiency(self) -> float: """get AirTemp Efficiency Pct""" result = await self._modbus.async_pymodbus_call( diff --git a/custom_components/nilan/device_map.py b/custom_components/nilan/device_map.py index fca1e05..0de4999 100644 --- a/custom_components/nilan/device_map.py +++ b/custom_components/nilan/device_map.py @@ -115,7 +115,7 @@ ), }, "get_t11_electric_water_heater_temperature": { - "entity_type": "sensor", + "entity_type": "water_heater", "min_bus_version": 1, "supported_devices": ( 19, @@ -124,7 +124,7 @@ ), }, "get_t12_compressor_water_heater_temperature": { - "entity_type": "sensor", + "entity_type": "water_heater", "min_bus_version": 1, "supported_devices": ( 19, @@ -236,6 +236,14 @@ "min_bus_version": 1, "supported_devices": (None,), }, + "get_central_heating_setpoint": { + "entity_type": "sensor", + "min_bus_version": 1, + "supported_devices": ( + 20, + 21, + ), + }, "get_display_led_1_state": { "entity_type": "binary_sensor", "min_bus_version": 1, @@ -561,7 +569,7 @@ }, "get_central_heat_select": { "entity_type": "select", - "min_bus_version": 22, + "min_bus_version": 19, # PH "supported_devices": ( 20, 21, @@ -714,7 +722,7 @@ }, "get_supply_air_after_heating": { "entity_type": "switch", - "min_bus_version": 20, + "min_bus_version": 19, # PH "supported_devices": (None,), }, "get_min_supply_step": { diff --git a/custom_components/nilan/manifest.json b/custom_components/nilan/manifest.json index 643fa81..3c90980 100644 --- a/custom_components/nilan/manifest.json +++ b/custom_components/nilan/manifest.json @@ -1,7 +1,7 @@ { "domain": "nilan", "name": "Nilan", - "version": "1.1.5", + "version": "1.1.6", "config_flow": true, "documentation": "https://github.com/veista/nilan", "requirements": ["pymodbus==2.5.3"], diff --git a/custom_components/nilan/sensor.py b/custom_components/nilan/sensor.py index f6cd618..ffafbe1 100644 --- a/custom_components/nilan/sensor.py +++ b/custom_components/nilan/sensor.py @@ -241,6 +241,17 @@ None, ) ], + "get_central_heating_setpoint": [ + Map( + "Central Heating Setpoint", + TEMP_CELSIUS, + SensorDeviceClass.TEMPERATURE, + SensorStateClass.MEASUREMENT, + None, + None, + None, + ) + ], "get_humidity": [ Map( "Humidity",