From 537154da83b82979648ca5964d419a618f63b02b Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Sat, 2 Mar 2024 14:27:15 -0500 Subject: [PATCH] boiler-monitor: Move sensors into a templated package --- boiler-monitor.yaml | 227 +----------------------------------- packages/modbus-boiler.yaml | 224 +++++++++++++++++++++++++++++++++++ 2 files changed, 229 insertions(+), 222 deletions(-) create mode 100644 packages/modbus-boiler.yaml diff --git a/boiler-monitor.yaml b/boiler-monitor.yaml index c981954..ed68de2 100644 --- a/boiler-monitor.yaml +++ b/boiler-monitor.yaml @@ -4,6 +4,11 @@ substitutions: packages: cms: !include packages/cms-general.yaml + boiler1: !include + file: packages/modbus-boiler.yaml + vars: + controller_id: boiler1 + sensor_name_prefix: "B1 " esp32: board: lolin_s2_mini @@ -23,225 +28,3 @@ modbus_controller: address: 0x1 setup_priority: -10 update_interval: 30s - -text_sensor: - ## Trend Status ## - - platform: modbus_controller - modbus_controller_id: boiler1 - name: Demand source - address: 0x0006 - register_type: read - raw_encode: HEXBYTES - lambda: |- - uint16_t value = modbus_controller::word_from_hex_str(x, 0); - switch (value) { - case 0: return std::string("Unknown"); - case 1: return std::string("No source demand"); - case 2: return std::string("CH"); - case 3: return std::string("DHW"); - case 4: return std::string("Lead Lag slave"); - case 5: return std::string("Lead Lag master"); - case 6: return std::string("CH frost protection"); - case 7: return std::string("DHW frost protection"); - case 8: return std::string("No demand due to burner switch (register 199) turned off"); - case 9: return std::string("DHW storage"); - case 10: return std::string("Reserved"); - case 11: return std::string("Warm weather shutdown"); - case 12: return std::string("Hot standby"); - } - return x; - - - ## BURNER CONTROL STATUS ## - - platform: modbus_controller - modbus_controller_id: boiler1 - name: Burner control status - address: 0x0020 - register_type: read - raw_encode: HEXBYTES - lambda: |- - uint16_t value = modbus_controller::word_from_hex_str(x, 0); - switch (value) { - case 0: return std::string("Disabled"); - case 1: return std::string("Locked out"); - case 4: return std::string("Anti-short cycle"); - case 5: return std::string("Unconfigured safety data"); - case 34: return std::string("Standby Hold"); - case 35: return std::string("Standby Delay"); - case 48: return std::string("Normal Standby"); - case 49: return std::string("Preparing"); - case 50: return std::string("Ignition"); - case 51: return std::string("Firing"); - case 52: return std::string("Postpurge"); - } - // Reserved - return x; - - - platform: modbus_controller - modbus_controller_id: boiler1 - name: Lockout code - address: 0x0022 - register_type: read - raw_encode: HEXBYTES - lambda: |- - uint16_t value = modbus_controller::word_from_hex_str(x, 0); - switch (value) { - case 0: return std::string("No lockout"); - // TODO: see Table 9 - } - return x; - - - platform: modbus_controller - modbus_controller_id: boiler1 - name: Alarm reason - address: 0x0023 - register_type: read - raw_encode: HEXBYTES - lambda: |- - uint16_t value = modbus_controller::word_from_hex_str(x, 0); - switch (value) { - case 0: return std::string("None"); - case 1: return std::string("Lockout"); - case 2: return std::string("Alert"); - case 3: return std::string("Other"); - } - return x; - - ## CENTRAL HEATING (CH) STATUS ## - - platform: modbus_controller - modbus_controller_id: boiler1 - name: CH status - address: 0x0040 - register_type: read - raw_encode: HEXBYTES - lambda: |- - uint16_t value = modbus_controller::word_from_hex_str(x, 0); - switch (value) { - case 0: return std::string("Unknown"); - case 1: return std::string("Disabled"); - case 2: return std::string("Normal"); - case 3: return std::string("Suspended"); - } - return x; - - - ## PUMP STATUS ## - # TODO: map to text (bitmap) - - platform: modbus_controller - modbus_controller_id: boiler1 - name: Pump A status - address: 0x005D - register_type: read - raw_encode: HEXBYTES - - # TODO: map to text (bitmap) - - platform: modbus_controller - modbus_controller_id: boiler1 - name: Pump B status - address: 0x005E - register_type: read - raw_encode: HEXBYTES - - ## LEAD LAG STATUS ## - - platform: modbus_controller - modbus_controller_id: boiler1 - name: "Lead Lag master status" - address: 0x00A0 - register_type: read - raw_encode: HEXBYTES - lambda: |- - uint16_t value = modbus_controller::word_from_hex_str(x, 0); - switch (value) { - case 0: return std::string("Unknown"); - case 1: return std::string("Disabled"); - case 2: return std::string("Normal"); - case 3: return std::string("Suspended"); - } - return x; - - # TODO: map to text (bitmap) - - platform: modbus_controller - modbus_controller_id: boiler1 - name: "Lead Lag slave status" - address: 0x00A1 - register_type: read - raw_encode: HEXBYTES - -# Derived from "SOLA Modbus I/F" Rev. 4.1.1 -# https://www.ccontrols.com/support/dp/OEMModbusSIS4_1_1_1_1.pdf -sensor: - ## Trend Status ## - - platform: modbus_controller - modbus_controller_id: boiler1 - name: Outlet (S3S4) or Outlet limit (S3) sensor - address: 0x0007 - register_type: read - value_type: U_WORD # U16 - unit_of_measurement: '°C' - accuracy_decimals: 1 - filters: - - multiply: 0.1 - - - platform: modbus_controller - modbus_controller_id: boiler1 - name: Inlet (S1) sensor - address: 0x000B - register_type: read - value_type: U_WORD # U16 - unit_of_measurement: '°C' - accuracy_decimals: 1 - filters: - - multiply: 0.1 - - - ## STATISTICS ## - - platform: modbus_controller - modbus_controller_id: boiler1 - name: Burner cycle count - address: 0x0080 - register_type: read - value_type: U_DWORD # U32 - - - platform: modbus_controller - modbus_controller_id: boiler1 - name: Burner run time - address: 0x0082 - register_type: read - value_type: U_DWORD # U32 - unit_of_measurement: h - - - platform: modbus_controller - modbus_controller_id: boiler1 - name: CH pump cycle count - address: 0x0084 - register_type: read - value_type: U_DWORD # U32 - - - platform: modbus_controller - modbus_controller_id: boiler1 - name: System pump cycle count - address: 0x0088 - register_type: read - value_type: U_DWORD # U32 - - - platform: modbus_controller - modbus_controller_id: boiler1 - name: Boiler pump cycle count - address: 0x008A - register_type: read - value_type: U_DWORD # U32 - - - platform: modbus_controller - modbus_controller_id: boiler1 - name: Controller cycle count - address: 0x008E - register_type: read - value_type: U_DWORD # U32 - - - platform: modbus_controller - modbus_controller_id: boiler1 - name: Controller run time - address: 0x0090 - register_type: read - value_type: U_DWORD # U32 - unit_of_measurement: h diff --git a/packages/modbus-boiler.yaml b/packages/modbus-boiler.yaml new file mode 100644 index 0000000..5360628 --- /dev/null +++ b/packages/modbus-boiler.yaml @@ -0,0 +1,224 @@ +defaults: + sensor_name_prefix: "" + +text_sensor: + ## Trend Status ## + - platform: modbus_controller + modbus_controller_id: ${controller_id} + name: ${sensor_name_prefix}Demand source + address: 0x0006 + register_type: read + raw_encode: HEXBYTES + lambda: |- + uint16_t value = modbus_controller::word_from_hex_str(x, 0); + switch (value) { + case 0: return std::string("Unknown"); + case 1: return std::string("No source demand"); + case 2: return std::string("CH"); + case 3: return std::string("DHW"); + case 4: return std::string("Lead Lag slave"); + case 5: return std::string("Lead Lag master"); + case 6: return std::string("CH frost protection"); + case 7: return std::string("DHW frost protection"); + case 8: return std::string("No demand due to burner switch (register 199) turned off"); + case 9: return std::string("DHW storage"); + case 10: return std::string("Reserved"); + case 11: return std::string("Warm weather shutdown"); + case 12: return std::string("Hot standby"); + } + return x; + + + ## BURNER CONTROL STATUS ## + - platform: modbus_controller + modbus_controller_id: ${controller_id} + name: ${sensor_name_prefix}Burner control status + address: 0x0020 + register_type: read + raw_encode: HEXBYTES + lambda: |- + uint16_t value = modbus_controller::word_from_hex_str(x, 0); + switch (value) { + case 0: return std::string("Disabled"); + case 1: return std::string("Locked out"); + case 4: return std::string("Anti-short cycle"); + case 5: return std::string("Unconfigured safety data"); + case 34: return std::string("Standby Hold"); + case 35: return std::string("Standby Delay"); + case 48: return std::string("Normal Standby"); + case 49: return std::string("Preparing"); + case 50: return std::string("Ignition"); + case 51: return std::string("Firing"); + case 52: return std::string("Postpurge"); + } + // Reserved + return x; + + - platform: modbus_controller + modbus_controller_id: ${controller_id} + name: ${sensor_name_prefix}Lockout code + address: 0x0022 + register_type: read + raw_encode: HEXBYTES + lambda: |- + uint16_t value = modbus_controller::word_from_hex_str(x, 0); + switch (value) { + case 0: return std::string("No lockout"); + // TODO: see Table 9 + } + return x; + + - platform: modbus_controller + modbus_controller_id: ${controller_id} + name: ${sensor_name_prefix}Alarm reason + address: 0x0023 + register_type: read + raw_encode: HEXBYTES + lambda: |- + uint16_t value = modbus_controller::word_from_hex_str(x, 0); + switch (value) { + case 0: return std::string("None"); + case 1: return std::string("Lockout"); + case 2: return std::string("Alert"); + case 3: return std::string("Other"); + } + return x; + + ## CENTRAL HEATING (CH) STATUS ## + - platform: modbus_controller + modbus_controller_id: ${controller_id} + name: ${sensor_name_prefix}CH status + address: 0x0040 + register_type: read + raw_encode: HEXBYTES + lambda: |- + uint16_t value = modbus_controller::word_from_hex_str(x, 0); + switch (value) { + case 0: return std::string("Unknown"); + case 1: return std::string("Disabled"); + case 2: return std::string("Normal"); + case 3: return std::string("Suspended"); + } + return x; + + + ## PUMP STATUS ## + # TODO: map to text (bitmap) + - platform: modbus_controller + modbus_controller_id: ${controller_id} + name: ${sensor_name_prefix}Pump A status + address: 0x005D + register_type: read + raw_encode: HEXBYTES + + # TODO: map to text (bitmap) + - platform: modbus_controller + modbus_controller_id: ${controller_id} + name: ${sensor_name_prefix}Pump B status + address: 0x005E + register_type: read + raw_encode: HEXBYTES + + ## LEAD LAG STATUS ## + - platform: modbus_controller + modbus_controller_id: ${controller_id} + name: ${sensor_name_prefix}"Lead Lag master status" + address: 0x00A0 + register_type: read + raw_encode: HEXBYTES + lambda: |- + uint16_t value = modbus_controller::word_from_hex_str(x, 0); + switch (value) { + case 0: return std::string("Unknown"); + case 1: return std::string("Disabled"); + case 2: return std::string("Normal"); + case 3: return std::string("Suspended"); + } + return x; + + # TODO: map to text (bitmap) + - platform: modbus_controller + modbus_controller_id: ${controller_id} + name: ${sensor_name_prefix}"Lead Lag slave status" + address: 0x00A1 + register_type: read + raw_encode: HEXBYTES + +# Derived from "SOLA Modbus I/F" Rev. 4.1.1 +# https://www.ccontrols.com/support/dp/OEMModbusSIS4_1_1_1_1.pdf +sensor: + ## Trend Status ## + - platform: modbus_controller + modbus_controller_id: ${controller_id} + name: ${sensor_name_prefix}Outlet (S3S4) or Outlet limit (S3) sensor + address: 0x0007 + register_type: read + value_type: U_WORD # U16 + unit_of_measurement: '°C' + accuracy_decimals: 1 + filters: + - multiply: 0.1 + + - platform: modbus_controller + modbus_controller_id: ${controller_id} + name: ${sensor_name_prefix}Inlet (S1) sensor + address: 0x000B + register_type: read + value_type: U_WORD # U16 + unit_of_measurement: '°C' + accuracy_decimals: 1 + filters: + - multiply: 0.1 + + + ## STATISTICS ## + - platform: modbus_controller + modbus_controller_id: ${controller_id} + name: ${sensor_name_prefix}Burner cycle count + address: 0x0080 + register_type: read + value_type: U_DWORD # U32 + + - platform: modbus_controller + modbus_controller_id: ${controller_id} + name: ${sensor_name_prefix}Burner run time + address: 0x0082 + register_type: read + value_type: U_DWORD # U32 + unit_of_measurement: h + + - platform: modbus_controller + modbus_controller_id: ${controller_id} + name: ${sensor_name_prefix}CH pump cycle count + address: 0x0084 + register_type: read + value_type: U_DWORD # U32 + + - platform: modbus_controller + modbus_controller_id: ${controller_id} + name: ${sensor_name_prefix}System pump cycle count + address: 0x0088 + register_type: read + value_type: U_DWORD # U32 + + - platform: modbus_controller + modbus_controller_id: ${controller_id} + name: ${sensor_name_prefix}Boiler pump cycle count + address: 0x008A + register_type: read + value_type: U_DWORD # U32 + + - platform: modbus_controller + modbus_controller_id: ${controller_id} + name: ${sensor_name_prefix}Controller cycle count + address: 0x008E + register_type: read + value_type: U_DWORD # U32 + + - platform: modbus_controller + modbus_controller_id: ${controller_id} + name: ${sensor_name_prefix}Controller run time + address: 0x0090 + register_type: read + value_type: U_DWORD # U32 + unit_of_measurement: h