From 194729154595d5b499914a94d33a28d291e58a23 Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Mon, 30 May 2022 19:46:33 +0200 Subject: [PATCH] Add missing Hxx sensors (Closes: #55) --- README.md | 9 +++ components/victron/sensor.py | 82 +++++++++++++++++++++++- components/victron/victron.cpp | 108 +++++++++++++++++++++++++------- components/victron/victron.h | 38 +++++++++++ smartshunt-esp8266-example.yaml | 21 ++++++- 5 files changed, 231 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 93e33cb..416f556 100644 --- a/README.md +++ b/README.md @@ -141,11 +141,20 @@ The available numeric sensors are: - `time_to_go` - `depth_of_the_deepest_discharge` - `depth_of_the_last_discharge` +- `depth_of_the_average_discharge` - `number_of_charge_cycles` - `number_of_full_discharges` +- `cumulative_amp_hours_drawn` - `min_battery_voltage` - `max_battery_voltage` - `last_full_charge` +- `number_of_automatic_synchronizations` +- `number_of_low_main_voltage_alarms` +- `number_of_high_main_voltage_alarms` +- `number_of_low_auxiliary_voltage_alarms` +- `number_of_high_auxiliary_voltage_alarms` +- `min_auxiliary_battery_voltage` +- `max_auxiliary_battery_voltage` - `amount_of_discharged_energy` - `amount_of_charged_energy` diff --git a/components/victron/sensor.py b/components/victron/sensor.py index 38ea29c..fd210a2 100644 --- a/components/victron/sensor.py +++ b/components/victron/sensor.py @@ -61,14 +61,25 @@ CONF_STATE_OF_CHARGE = "state_of_charge" CONF_TIME_TO_GO = "time_to_go" CONF_DEPTH_OF_THE_DEEPEST_DISCHARGE = "depth_of_the_deepest_discharge" CONF_DEPTH_OF_THE_LAST_DISCHARGE = "depth_of_the_last_discharge" +CONF_DEPTH_OF_THE_AVERAGE_DISCHARGE = "depth_of_the_average_discharge" CONF_NUMBER_OF_CHARGE_CYCLES = "number_of_charge_cycles" CONF_NUMBER_OF_FULL_DISCHARGES = "number_of_full_discharges" +CONF_CUMULATIVE_AMP_HOURS_DRAWN = "cumulative_amp_hours_drawn" CONF_MIN_BATTERY_VOLTAGE = "min_battery_voltage" CONF_MAX_BATTERY_VOLTAGE = "max_battery_voltage" CONF_LAST_FULL_CHARGE = "last_full_charge" +CONF_NUMBER_OF_AUTOMATIC_SYNCHRONIZATIONS = "number_of_automatic_synchronizations" +CONF_NUMBER_OF_LOW_MAIN_VOLTAGE_ALARMS = "number_of_low_main_voltage_alarms" +CONF_NUMBER_OF_HIGH_MAIN_VOLTAGE_ALARMS = "number_of_high_main_voltage_alarms" +CONF_NUMBER_OF_LOW_AUXILIARY_VOLTAGE_ALARMS = "number_of_low_auxiliary_voltage_alarms" +CONF_NUMBER_OF_HIGH_AUXILIARY_VOLTAGE_ALARMS = "number_of_high_auxiliary_voltage_alarms" +CONF_MIN_AUXILIARY_BATTERY_VOLTAGE = "min_auxiliary_battery_voltage" +CONF_MAX_AUXILIARY_BATTERY_VOLTAGE = "max_auxiliary_battery_voltage" CONF_AMOUNT_OF_DISCHARGED_ENERGY = "amount_of_discharged_energy" CONF_AMOUNT_OF_CHARGED_ENERGY = "amount_of_charged_energy" +UNIT_AMPERE_HOURS = "Ah" + SENSORS = [ CONF_BATTERY_VOLTAGE, CONF_AC_OUT_VOLTAGE, @@ -100,11 +111,20 @@ SENSORS = [ CONF_TIME_TO_GO, CONF_DEPTH_OF_THE_DEEPEST_DISCHARGE, CONF_DEPTH_OF_THE_LAST_DISCHARGE, + CONF_DEPTH_OF_THE_AVERAGE_DISCHARGE, CONF_NUMBER_OF_CHARGE_CYCLES, CONF_NUMBER_OF_FULL_DISCHARGES, + CONF_CUMULATIVE_AMP_HOURS_DRAWN, CONF_MIN_BATTERY_VOLTAGE, CONF_MAX_BATTERY_VOLTAGE, CONF_LAST_FULL_CHARGE, + CONF_NUMBER_OF_AUTOMATIC_SYNCHRONIZATIONS, + CONF_NUMBER_OF_LOW_MAIN_VOLTAGE_ALARMS, + CONF_NUMBER_OF_HIGH_MAIN_VOLTAGE_ALARMS, + CONF_NUMBER_OF_LOW_AUXILIARY_VOLTAGE_ALARMS, + CONF_NUMBER_OF_HIGH_AUXILIARY_VOLTAGE_ALARMS, + CONF_MIN_AUXILIARY_BATTERY_VOLTAGE, + CONF_MAX_AUXILIARY_BATTERY_VOLTAGE, CONF_AMOUNT_OF_DISCHARGED_ENERGY, CONF_AMOUNT_OF_CHARGED_ENERGY, ] @@ -259,10 +279,11 @@ CONFIG_SCHEMA = cv.Schema( device_class=DEVICE_CLASS_POWER, ), cv.Optional(CONF_CONSUMED_AMP_HOURS): sensor.sensor_schema( - unit_of_measurement=UNIT_AMPERE, - icon=ICON_CURRENT_AC, + unit_of_measurement=UNIT_AMPERE_HOURS, + icon=ICON_EMPTY, accuracy_decimals=3, - device_class=DEVICE_CLASS_POWER, + device_class=DEVICE_CLASS_EMPTY, + state_class=STATE_CLASS_MEASUREMENT, ), cv.Optional(CONF_STATE_OF_CHARGE): sensor.sensor_schema( unit_of_measurement=UNIT_PERCENT, @@ -288,6 +309,12 @@ CONFIG_SCHEMA = cv.Schema( accuracy_decimals=3, device_class=DEVICE_CLASS_CURRENT, ), + cv.Optional(CONF_DEPTH_OF_THE_AVERAGE_DISCHARGE): sensor.sensor_schema( + unit_of_measurement=UNIT_AMPERE, + icon=ICON_CURRENT_AC, + accuracy_decimals=3, + device_class=DEVICE_CLASS_CURRENT, + ), cv.Optional(CONF_NUMBER_OF_CHARGE_CYCLES): sensor.sensor_schema( unit_of_measurement=UNIT_EMPTY, icon=ICON_EMPTY, @@ -300,6 +327,13 @@ CONFIG_SCHEMA = cv.Schema( accuracy_decimals=0, device_class=DEVICE_CLASS_EMPTY, ), + cv.Optional(CONF_CUMULATIVE_AMP_HOURS_DRAWN): sensor.sensor_schema( + unit_of_measurement=UNIT_AMPERE_HOURS, + icon=ICON_EMPTY, + accuracy_decimals=3, + device_class=DEVICE_CLASS_EMPTY, + state_class=STATE_CLASS_MEASUREMENT, + ), cv.Optional(CONF_MIN_BATTERY_VOLTAGE): sensor.sensor_schema( unit_of_measurement=UNIT_VOLT, icon=ICON_FLASH, @@ -318,6 +352,48 @@ CONFIG_SCHEMA = cv.Schema( accuracy_decimals=0, device_class=DEVICE_CLASS_EMPTY, ), + cv.Optional(CONF_NUMBER_OF_AUTOMATIC_SYNCHRONIZATIONS): sensor.sensor_schema( + unit_of_measurement=UNIT_EMPTY, + icon=ICON_EMPTY, + accuracy_decimals=0, + device_class=DEVICE_CLASS_EMPTY, + ), + cv.Optional(CONF_NUMBER_OF_LOW_MAIN_VOLTAGE_ALARMS): sensor.sensor_schema( + unit_of_measurement=UNIT_EMPTY, + icon=ICON_EMPTY, + accuracy_decimals=0, + device_class=DEVICE_CLASS_EMPTY, + ), + cv.Optional(CONF_NUMBER_OF_HIGH_MAIN_VOLTAGE_ALARMS): sensor.sensor_schema( + unit_of_measurement=UNIT_EMPTY, + icon=ICON_EMPTY, + accuracy_decimals=0, + device_class=DEVICE_CLASS_EMPTY, + ), + cv.Optional(CONF_NUMBER_OF_LOW_AUXILIARY_VOLTAGE_ALARMS): sensor.sensor_schema( + unit_of_measurement=UNIT_EMPTY, + icon=ICON_EMPTY, + accuracy_decimals=0, + device_class=DEVICE_CLASS_EMPTY, + ), + cv.Optional(CONF_NUMBER_OF_HIGH_AUXILIARY_VOLTAGE_ALARMS): sensor.sensor_schema( + unit_of_measurement=UNIT_EMPTY, + icon=ICON_EMPTY, + accuracy_decimals=0, + device_class=DEVICE_CLASS_EMPTY, + ), + cv.Optional(CONF_MIN_AUXILIARY_BATTERY_VOLTAGE): sensor.sensor_schema( + unit_of_measurement=UNIT_VOLT, + icon=ICON_FLASH, + accuracy_decimals=3, + device_class=DEVICE_CLASS_VOLTAGE, + ), + cv.Optional(CONF_MAX_AUXILIARY_BATTERY_VOLTAGE): sensor.sensor_schema( + unit_of_measurement=UNIT_VOLT, + icon=ICON_FLASH, + accuracy_decimals=3, + device_class=DEVICE_CLASS_VOLTAGE, + ), cv.Optional(CONF_AMOUNT_OF_DISCHARGED_ENERGY): sensor.sensor_schema( unit_of_measurement=UNIT_WATT_HOURS, icon=ICON_POWER, diff --git a/components/victron/victron.cpp b/components/victron/victron.cpp index dacca08..37f7371 100644 --- a/components/victron/victron.cpp +++ b/components/victron/victron.cpp @@ -539,19 +539,19 @@ void VictronComponent::handle_value_() { int value; if (label_ == "V") { - this->publish_state_(battery_voltage_sensor_, atoi(value_.c_str()) / 1000.0); // NOLINT(cert-err34-c) + this->publish_state_(battery_voltage_sensor_, atoi(value_.c_str()) / 1000.0f); // NOLINT(cert-err34-c) return; } // "V2" mV Channel 2 (battery) voltage if (label_ == "V2") { - this->publish_state_(battery_voltage_2_sensor_, atoi(value_.c_str()) / 1000.0); // NOLINT(cert-err34-c) + this->publish_state_(battery_voltage_2_sensor_, atoi(value_.c_str()) / 1000.0f); // NOLINT(cert-err34-c) return; } // "V3" mV Channel 3 (battery) voltage if (label_ == "V3") { - this->publish_state_(battery_voltage_3_sensor_, atoi(value_.c_str()) / 1000.0); // NOLINT(cert-err34-c) + this->publish_state_(battery_voltage_3_sensor_, atoi(value_.c_str()) / 1000.0f); // NOLINT(cert-err34-c) return; } @@ -560,7 +560,7 @@ void VictronComponent::handle_value_() { // "DM" %o Mid-point deviation of the battery bank if (label_ == "VPV") { - this->publish_state_(panel_voltage_sensor_, atoi(value_.c_str()) / 1000.0); // NOLINT(cert-err34-c) + this->publish_state_(panel_voltage_sensor_, atoi(value_.c_str()) / 1000.0f); // NOLINT(cert-err34-c) return; } @@ -570,24 +570,24 @@ void VictronComponent::handle_value_() { } if (label_ == "I") { - this->publish_state_(battery_current_sensor_, atoi(value_.c_str()) / 1000.0); // NOLINT(cert-err34-c) + this->publish_state_(battery_current_sensor_, atoi(value_.c_str()) / 1000.0f); // NOLINT(cert-err34-c) return; } // "I2" mA Channel 2 battery current if (label_ == "I2") { - this->publish_state_(battery_current_2_sensor_, atoi(value_.c_str()) / 1000.0); // NOLINT(cert-err34-c) + this->publish_state_(battery_current_2_sensor_, atoi(value_.c_str()) / 1000.0f); // NOLINT(cert-err34-c) return; } // "I3" mA Channel 3 battery current if (label_ == "I3") { - this->publish_state_(battery_current_3_sensor_, atoi(value_.c_str()) / 1000.0); // NOLINT(cert-err34-c) + this->publish_state_(battery_current_3_sensor_, atoi(value_.c_str()) / 1000.0f); // NOLINT(cert-err34-c) return; } if (label_ == "IL") { - this->publish_state_(load_current_sensor_, atoi(value_.c_str()) / 1000.0); // NOLINT(cert-err34-c) + this->publish_state_(load_current_sensor_, atoi(value_.c_str()) / 1000.0f); // NOLINT(cert-err34-c) return; } @@ -615,14 +615,14 @@ void VictronComponent::handle_value_() { // "CE" mAh Consumed Amp Hours if (label_ == "CE") { - this->publish_state_(consumed_amp_hours_sensor_, atoi(value_.c_str()) / 1000.00); // NOLINT(cert-err34-c) + this->publish_state_(consumed_amp_hours_sensor_, atoi(value_.c_str()) / 1000.0f); // NOLINT(cert-err34-c) return; } // "SOC" %o State of charge if (label_ == "SOC") { // Per mill to % - this->publish_state_(state_of_charge_sensor_, atoi(value_.c_str()) * 0.10); // NOLINT(cert-err34-c) + this->publish_state_(state_of_charge_sensor_, atoi(value_.c_str()) * 0.10f); // NOLINT(cert-err34-c) return; } @@ -662,11 +662,17 @@ void VictronComponent::handle_value_() { // "H2" mAh Depth of the last discharge if (label_ == "H2") { // mAh -> Ah - this->publish_state_(depth_of_the_last_discharge_sensor_, atoi(value_.c_str()) / 1000.0); // NOLINT(cert-err34-c) + this->publish_state_(depth_of_the_last_discharge_sensor_, atoi(value_.c_str()) / 1000.0f); // NOLINT(cert-err34-c) return; } // "H3" mAh Depth of the average discharge + if (label_ == "H3") { + // mAh -> Ah + this->publish_state_(depth_of_the_average_discharge_sensor_, + atoi(value_.c_str()) / 1000.0); // NOLINT(cert-err34-c) + return; + } // "H4" Number of charge cycles if (label_ == "H4") { @@ -681,56 +687,116 @@ void VictronComponent::handle_value_() { } // "H6" mAh Cumulative Amp Hours drawn + if (label_ == "H6") { + // mAh -> Ah + if (value_ == "---") { + this->publish_state_(cumulative_amp_hours_drawn_sensor_, NAN); + return; + } + + this->publish_state_(cumulative_amp_hours_drawn_sensor_, atoi(value_.c_str()) / 1000.0f); // NOLINT(cert-err34-c) + return; + } + // "H7" mV Minimum main (battery) voltage if (label_ == "H7") { // mV to V - this->publish_state_(min_battery_voltage_sensor_, atoi(value_.c_str()) / 1000.00); // NOLINT(cert-err34-c) + this->publish_state_(min_battery_voltage_sensor_, atoi(value_.c_str()) / 1000.0f); // NOLINT(cert-err34-c) return; } // "H8" mV Maximum main (battery) voltage if (label_ == "H8") { // mV to V - this->publish_state_(max_battery_voltage_sensor_, atoi(value_.c_str()) / 1000.00); // NOLINT(cert-err34-c) + this->publish_state_(max_battery_voltage_sensor_, atoi(value_.c_str()) / 1000.0f); // NOLINT(cert-err34-c) return; } // "H9" S Number of seconds since last full charge if (label_ == "H9") { + if (value_ == "---") { + this->publish_state_(last_full_charge_sensor_, NAN); + return; + } + // sec -> min - this->publish_state_(last_full_charge_sensor_, (float) atoi(value_.c_str()) / 60.0); // NOLINT(cert-err34-c) + this->publish_state_(last_full_charge_sensor_, (float) atoi(value_.c_str()) / 60.0f); // NOLINT(cert-err34-c) return; } // "H10" Number of automatic synchronizations + if (label_ == "H10") { + if (value_ == "---") { + this->publish_state_(number_of_automatic_synchronizations_sensor_, NAN); + return; + } + + this->publish_state_(number_of_automatic_synchronizations_sensor_, atoi(value_.c_str())); // NOLINT(cert-err34-c) + return; + } + // "H11" Number of low main voltage alarms + if (label_ == "H11") { + this->publish_state_(number_of_low_main_voltage_alarms_sensor_, atoi(value_.c_str())); // NOLINT(cert-err34-c) + return; + } + // "H12" Number of high main voltage alarms + if (label_ == "H12") { + this->publish_state_(number_of_high_main_voltage_alarms_sensor_, atoi(value_.c_str())); // NOLINT(cert-err34-c) + return; + } + // "H13" Number of low auxiliary voltage alarms + if (label_ == "H13") { + this->publish_state_(number_of_low_auxiliary_voltage_alarms_sensor_, atoi(value_.c_str())); // NOLINT(cert-err34-c) + return; + } + // "H14" Number of high auxiliary voltage alarms + if (label_ == "H14") { + this->publish_state_(number_of_high_auxiliary_voltage_alarms_sensor_, + atoi(value_.c_str())); // NOLINT(cert-err34-c) + return; + } + // "H15" mV Minimum auxiliary (battery) voltage + if (label_ == "H15") { + // mV to V + this->publish_state_(min_auxiliary_battery_voltage_sensor_, + atoi(value_.c_str()) / 1000.0f); // NOLINT(cert-err34-c) + return; + } + // "H16" mV Maximum auxiliary (battery) voltage + if (label_ == "H16") { + // mV to V + this->publish_state_(max_auxiliary_battery_voltage_sensor_, + atoi(value_.c_str()) / 1000.0f); // NOLINT(cert-err34-c) + return; + } // "H17" 0.01 kWh Amount of discharged energy (BMV) / Amount of produced energy (DC monitor) if (label_ == "H17") { // Wh - this->publish_state_(amount_of_discharged_energy_sensor_, atoi(value_.c_str()) * 10.00); // NOLINT(cert-err34-c) + this->publish_state_(amount_of_discharged_energy_sensor_, atoi(value_.c_str()) * 10.0f); // NOLINT(cert-err34-c) return; } // "H18" 0.01 kWh Amount of charged energy (BMV) / Amount of consumed energy (DC monitor) if (label_ == "H18") { // Wh - this->publish_state_(amount_of_charged_energy_sensor_, atoi(value_.c_str()) * 10.00); // NOLINT(cert-err34-c) + this->publish_state_(amount_of_charged_energy_sensor_, atoi(value_.c_str()) * 10.0f); // NOLINT(cert-err34-c) return; } if (label_ == "H19") { - this->publish_state_(yield_total_sensor_, atoi(value_.c_str()) * 10); // NOLINT(cert-err34-c) + this->publish_state_(yield_total_sensor_, atoi(value_.c_str()) * 10.0f); // NOLINT(cert-err34-c) return; } if (label_ == "H20") { - this->publish_state_(yield_today_sensor_, atoi(value_.c_str()) * 10); // NOLINT(cert-err34-c) + this->publish_state_(yield_today_sensor_, atoi(value_.c_str()) * 10.0f); // NOLINT(cert-err34-c) return; } @@ -740,7 +806,7 @@ void VictronComponent::handle_value_() { } if (label_ == "H22") { - this->publish_state_(yield_yesterday_sensor_, atoi(value_.c_str()) * 10); // NOLINT(cert-err34-c) + this->publish_state_(yield_yesterday_sensor_, atoi(value_.c_str()) * 10.0f); // NOLINT(cert-err34-c) return; } @@ -796,12 +862,12 @@ void VictronComponent::handle_value_() { } if (label_ == "AC_OUT_V") { - this->publish_state_(ac_out_voltage_sensor_, atoi(value_.c_str()) / 100.0); // NOLINT(cert-err34-c) + this->publish_state_(ac_out_voltage_sensor_, atoi(value_.c_str()) / 100.0f); // NOLINT(cert-err34-c) return; } if (label_ == "AC_OUT_I") { - this->publish_state_(ac_out_current_sensor_, std::max(0.0, atoi(value_.c_str()) / 10.0)); // NOLINT(cert-err34-c) + this->publish_state_(ac_out_current_sensor_, std::max(0.0f, atoi(value_.c_str()) / 10.0f)); // NOLINT(cert-err34-c) return; } diff --git a/components/victron/victron.h b/components/victron/victron.h index ca96357..04f3723 100644 --- a/components/victron/victron.h +++ b/components/victron/victron.h @@ -108,12 +108,18 @@ class VictronComponent : public uart::UARTDevice, public Component { void set_depth_of_the_last_discharge_sensor(sensor::Sensor *depth_of_the_last_discharge_sensor) { depth_of_the_last_discharge_sensor_ = depth_of_the_last_discharge_sensor; } + void set_depth_of_the_average_discharge_sensor(sensor::Sensor *depth_of_the_average_discharge_sensor) { + depth_of_the_average_discharge_sensor_ = depth_of_the_average_discharge_sensor; + } void set_number_of_charge_cycles_sensor(sensor::Sensor *number_of_charge_cycles_sensor) { number_of_charge_cycles_sensor_ = number_of_charge_cycles_sensor; } void set_number_of_full_discharges_sensor(sensor::Sensor *number_of_full_discharges_sensor) { number_of_full_discharges_sensor_ = number_of_full_discharges_sensor; } + void set_cumulative_amp_hours_drawn_sensor(sensor::Sensor *cumulative_amp_hours_drawn_sensor) { + cumulative_amp_hours_drawn_sensor_ = cumulative_amp_hours_drawn_sensor; + } void set_min_battery_voltage_sensor(sensor::Sensor *min_battery_voltage_sensor) { min_battery_voltage_sensor_ = min_battery_voltage_sensor; } @@ -123,6 +129,29 @@ class VictronComponent : public uart::UARTDevice, public Component { void set_last_full_charge_sensor(sensor::Sensor *last_full_charge_sensor) { last_full_charge_sensor_ = last_full_charge_sensor; } + void set_number_of_automatic_synchronizations_sensor(sensor::Sensor *number_of_automatic_synchronizations_sensor) { + number_of_automatic_synchronizations_sensor_ = number_of_automatic_synchronizations_sensor; + } + void set_number_of_low_main_voltage_alarms_sensor(sensor::Sensor *number_of_low_main_voltage_alarms_sensor) { + number_of_low_main_voltage_alarms_sensor_ = number_of_low_main_voltage_alarms_sensor; + } + void set_number_of_high_main_voltage_alarms_sensor(sensor::Sensor *number_of_high_main_voltage_alarms_sensor) { + number_of_high_main_voltage_alarms_sensor_ = number_of_high_main_voltage_alarms_sensor; + } + void set_number_of_low_auxiliary_voltage_alarms_sensor( + sensor::Sensor *number_of_low_auxiliary_voltage_alarms_sensor) { + number_of_low_auxiliary_voltage_alarms_sensor_ = number_of_low_auxiliary_voltage_alarms_sensor; + } + void set_number_of_high_auxiliary_voltage_alarms_sensor( + sensor::Sensor *number_of_high_auxiliary_voltage_alarms_sensor) { + number_of_high_auxiliary_voltage_alarms_sensor_ = number_of_high_auxiliary_voltage_alarms_sensor; + } + void set_min_auxiliary_battery_voltage_sensor(sensor::Sensor *min_auxiliary_battery_voltage_sensor) { + min_auxiliary_battery_voltage_sensor_ = min_auxiliary_battery_voltage_sensor; + } + void set_max_auxiliary_battery_voltage_sensor(sensor::Sensor *max_auxiliary_battery_voltage_sensor) { + max_auxiliary_battery_voltage_sensor_ = max_auxiliary_battery_voltage_sensor; + } void set_amount_of_discharged_energy_sensor(sensor::Sensor *amount_of_discharged_energy_sensor) { amount_of_discharged_energy_sensor_ = amount_of_discharged_energy_sensor; } @@ -193,11 +222,20 @@ class VictronComponent : public uart::UARTDevice, public Component { sensor::Sensor *time_to_go_sensor_{nullptr}; sensor::Sensor *depth_of_the_deepest_discharge_sensor_{nullptr}; sensor::Sensor *depth_of_the_last_discharge_sensor_{nullptr}; + sensor::Sensor *depth_of_the_average_discharge_sensor_{nullptr}; sensor::Sensor *number_of_charge_cycles_sensor_{nullptr}; sensor::Sensor *number_of_full_discharges_sensor_{nullptr}; + sensor::Sensor *cumulative_amp_hours_drawn_sensor_{nullptr}; sensor::Sensor *min_battery_voltage_sensor_{nullptr}; sensor::Sensor *max_battery_voltage_sensor_{nullptr}; sensor::Sensor *last_full_charge_sensor_{nullptr}; + sensor::Sensor *number_of_automatic_synchronizations_sensor_{nullptr}; + sensor::Sensor *number_of_low_main_voltage_alarms_sensor_{nullptr}; + sensor::Sensor *number_of_high_main_voltage_alarms_sensor_{nullptr}; + sensor::Sensor *number_of_low_auxiliary_voltage_alarms_sensor_{nullptr}; + sensor::Sensor *number_of_high_auxiliary_voltage_alarms_sensor_{nullptr}; + sensor::Sensor *min_auxiliary_battery_voltage_sensor_{nullptr}; + sensor::Sensor *max_auxiliary_battery_voltage_sensor_{nullptr}; sensor::Sensor *amount_of_discharged_energy_sensor_{nullptr}; sensor::Sensor *amount_of_charged_energy_sensor_{nullptr}; text_sensor::TextSensor *alarm_condition_active_text_sensor_{nullptr}; diff --git a/smartshunt-esp8266-example.yaml b/smartshunt-esp8266-example.yaml index bf2741a..91a71bb 100644 --- a/smartshunt-esp8266-example.yaml +++ b/smartshunt-esp8266-example.yaml @@ -64,19 +64,34 @@ sensor: name: "${name} depth of the deepest discharge" depth_of_the_last_discharge: name: "${name} depth of the last discharge" - # TODO: H3 + depth_of_the_average_discharge: + name: "${name} depth of the average discharge" number_of_charge_cycles: name: "${name} number of charge cycles" number_of_full_discharges: name: "${name} number of full discharges" - # TODO: H6 + cumulative_amp_hours_drawn: + name: "${name} cumulative amp hours drawn" min_battery_voltage: name: "${name} min battery voltage" max_battery_voltage: name: "${name} max battery voltage" last_full_charge: name: "${name} last full charge" - # TODO: H10...H16 + number_of_automatic_synchronizations: + name: "${name} number of automatic synchronizations" + number_of_low_main_voltage_alarms: + name: "${name} number of low main voltage alarms" + number_of_high_main_voltage_alarms: + name: "${name} number of high main voltage alarms" + number_of_low_auxiliary_voltage_alarms: + name: "${name} number of low auxiliary voltage alarms" + number_of_high_auxiliary_voltage_alarms: + name: "${name} number of high auxiliary voltage alarms" + min_auxiliary_battery_voltage: + name: "${name} min auxiliary battery voltage" + max_auxiliary_battery_voltage: + name: "${name} max auxiliary battery voltage" amount_of_discharged_energy: name: "${name} amount of discharged energy" amount_of_charged_energy: