From b569364f8059131748f66d6ae79b252b00608759 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Sat, 2 Mar 2024 14:04:56 -0500 Subject: [PATCH] Add boiler monitor --- boiler-monitor.yaml | 247 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 247 insertions(+) create mode 100644 boiler-monitor.yaml diff --git a/boiler-monitor.yaml b/boiler-monitor.yaml new file mode 100644 index 0000000..c981954 --- /dev/null +++ b/boiler-monitor.yaml @@ -0,0 +1,247 @@ +substitutions: + node_name: "cms-boiler-monitor" + node_verbose_name: "Boiler Monitor" + +packages: + cms: !include packages/cms-general.yaml + +esp32: + board: lolin_s2_mini + +status_led: + pin: GPIO15 + +uart: + tx_pin: 11 + rx_pin: 10 + baud_rate: 38400 + +modbus: + +modbus_controller: + id: boiler1 + 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