From fb721cc9070ec849436e8ba9bb7d2c3a7b462b82 Mon Sep 17 00:00:00 2001 From: Richard Arends Date: Sun, 12 Jan 2025 15:29:22 +0100 Subject: [PATCH 1/3] Add Active State Map --- CHANGELOG.md | 7 +++++++ heatpump.yaml | 23 ++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd4da03..474f11a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [5.1.0] - 2025-01-12 + +### Added + +- Active State Map: A sensor that represents the state as a number. This can be used for example in Grafana to plot a state time timeline + - 0: Inactive, 1: Heating, 2: Cooling, 3: DHW, 4: Defrosting, 99: Unknown (no mapping found) + ## [5.0.0] - 2024-11-24 ### Changed diff --git a/heatpump.yaml b/heatpump.yaml index ed9e60f..50fabce 100644 --- a/heatpump.yaml +++ b/heatpump.yaml @@ -42,7 +42,7 @@ esphome: friendly_name: "${description}" project: name: "${devicename}.${description}" - version: 4.1.2 + version: 5.0.0 esp32: board: esp32dev @@ -1104,6 +1104,27 @@ sensor: int t1s_dhw = t5 + dt1s5; return t1s_dhw; + - platform: template + name: "Active State Map" + id: "${devicename}_active_state_map" + unit_of_measurement: "" + accuracy_decimals: 0 # No decimals, value will show as integer + lambda: |- + static const std::map status_map = { + {"Inactive", 0}, + {"Heating", 1}, + {"Cooling", 2}, + {"DHW", 3}, + {"Defrosting", 4} + }; + + auto state_item = status_map.find(id(${devicename}_active_state).state); + if (state_item != status_map.end()) { + return state_item->second; // Return integer value that matches the string value (Heating, Cooling, etc..) + } else { + return 99; // No mapping found + } + binary_sensor: # Register: 0 -> Is also read as 'sensor' to read the complete value, used for the templated 'switch'(es) # Bit: 0 -> Is present in this config as a 'switch' From f5692b2c1790ac9023ffb01f5f72d44bfa4fa1f1 Mon Sep 17 00:00:00 2001 From: Richard Arends Date: Sun, 12 Jan 2025 15:30:11 +0100 Subject: [PATCH 2/3] Set version --- heatpump.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heatpump.yaml b/heatpump.yaml index 50fabce..72f8b84 100644 --- a/heatpump.yaml +++ b/heatpump.yaml @@ -42,7 +42,7 @@ esphome: friendly_name: "${description}" project: name: "${devicename}.${description}" - version: 5.0.0 + version: 5.1.0 esp32: board: esp32dev From e4c76fe2a82653d77049e67b31f551e8a780bb59 Mon Sep 17 00:00:00 2001 From: Richard Arends Date: Sun, 12 Jan 2025 15:31:40 +0100 Subject: [PATCH 3/3] Set version --- heatpump.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heatpump.yaml b/heatpump.yaml index 72f8b84..50fabce 100644 --- a/heatpump.yaml +++ b/heatpump.yaml @@ -42,7 +42,7 @@ esphome: friendly_name: "${description}" project: name: "${devicename}.${description}" - version: 5.1.0 + version: 5.0.0 esp32: board: esp32dev