Skip to content

Commit

Permalink
Add data age at battery MQTT (#322)
Browse files Browse the repository at this point in the history
* Add data age at battery MQTT

* Update README.md

typo

* Update MQTT_Topics.md

typo

* Update PylontechCanReceiver.cpp

typo
  • Loading branch information
Phantomias2006 authored Jul 19, 2023
1 parent cea1f94 commit e06740f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 25 deletions.
51 changes: 26 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,31 +156,32 @@ Topics for 3 phases of a power meter is configurable. Given is an example for th

| Topic | R / W | Description | Value / Unit |
| --------------------------------------- | ----- | ---------------------------------------------------- | -------------------------- |
| battery/settings/chargeVoltage | R | Voltage | Volt (V) |
| battery/settings/chargeCurrentLimitation | R | | |
| battery/settings/dischargeCurrentLimitation | R | | |
| battery/stateOfCharge | R | | |
| battery/stateOfHealth | R | | |
| battery/voltage | R | | |
| battery/current | R | | |
| battery/temperature" | R | | |
| battery/alarm/overCurrentDischarge | R | | |
| battery/alarm/underTemperature | R | | |
| battery/alarm/overTemperature | R | | |
| battery/alarm/underVoltage | R | | |
| battery/alarm/overVoltage | R | | |
| battery/alarm/bmsInternal | R | | |
| battery/alarm/overCurrentCharge | R | | |
| battery/warning/highCurrentDischarge | R | | |
| battery/warning/lowTemperature | R | | |
| battery/warning/highTemperature | R | | |
| battery/warning/lowVoltage | R | | |
| battery/warning/highVoltage | R | | |
| battery/warning/bmsInternal | R | | |
| battery/manufacturer | R | | |
| battery/charging/chargeEnabled | R | | |
| battery/charging/dischargeEnabled | R | | |
| battery/charging/chargeImmediately | R | | |
| battery/settings/chargeVoltage | R | Voltage | Volt (V) |
| battery/settings/chargeCurrentLimitation | R | BMS requested max. charge current | Ampere (A) |
| battery/settings/dischargeCurrentLimitation | R | BMS requested max. discharge current | Ampere (A) |
| battery/stateOfCharge | R | State of Health | % |
| battery/stateOfHealth | R | State of Charge | % |
| battery/dataAge | R | How old the data is | Seconds |
| battery/voltage | R | Actual voltage | Volt (V) |
| battery/current | R | Actual current | Ampere (A) |
| battery/temperature" | R | Actual temperature | °C |
| battery/alarm/overCurrentDischarge | R | Alarm: High discharge current | 0 / 1 |
| battery/alarm/underTemperature | R | Alarm: Low temperature | 0 / 1 |
| battery/alarm/overTemperature | R | Alarm: High temperature | 0 / 1 |
| battery/alarm/underVoltage | R | Alarm: Low voltage | 0 / 1 |
| battery/alarm/overVoltage | R | Alarm: High voltage | 0 / 1 |
| battery/alarm/bmsInternal | R | Alarm: BMS internal | 0 / 1 |
| battery/alarm/overCurrentCharge | R | | |
| battery/warning/highCurrentDischarge | R | Warning: High discharge current | 0 / 1 |
| battery/warning/lowTemperature | R | Warning: Low temperature | 0 / 1 |
| battery/warning/highTemperature | R | Warning: High temperature | 0 / 1 |
| battery/warning/lowVoltage | R | Warning: Low voltage | 0 / 1 |
| battery/warning/highVoltage | R | Warning: High voltage | 0 / 1 |
| battery/warning/bmsInternal | R | Warning: BMS internal | 0 / 1 |
| battery/manufacturer | R | Manufacturer | String |
| battery/charging/chargeEnabled | R | Charge enabled flag | 0 / 1 |
| battery/charging/dischargeEnabled | R | Discharge enabled flag | 0 / 1 |
| battery/charging/chargeImmediately | R | Charge immediately flag | 0 / 1 |

## Huawei AC charger topics
| Topic | R / W | Description | Value / Unit |
Expand Down
2 changes: 2 additions & 0 deletions docs/MQTT_Topics.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ cmd topics are used to set values. Status topics are updated from values set in
| battery/settings/dischargeCurrentLimitation | R | BMS requested max. discharge current | Ampere (A) |
| battery/stateOfCharge | R | State of Health | % |
| battery/stateOfHealth | R | State of Charge | % |
| battery/dataAge | R | How old the data is | Seconds |
| battery/voltage | R | Actual voltage | Volt (V) |
| battery/current | R | Actual current | Ampere (A) |
| battery/temperature" | R | Actual temperature | °C |
Expand All @@ -141,6 +142,7 @@ cmd topics are used to set values. Status topics are updated from values set in
| battery/alarm/underVoltage | R | Alarm: Low voltage | 0 / 1 |
| battery/alarm/overVoltage | R | Alarm: High voltage | 0 / 1 |
| battery/alarm/bmsInternal | R | Alarm: BMS internal | 0 / 1 |
| battery/alarm/overCurrentCharge | R | | |
| battery/warning/highCurrentDischarge | R | Warning: High discharge current | 0 / 1 |
| battery/warning/lowTemperature | R | Warning: Low temperature | 0 / 1 |
| battery/warning/highTemperature | R | Warning: High temperature | 0 / 1 |
Expand Down
1 change: 1 addition & 0 deletions src/PylontechCanReceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ void PylontechCanReceiverClass::mqtt()
MqttSettings.publish(topic + "/settings/dischargeCurrentLimitation", String(Battery.dischargeCurrentLimitation));
MqttSettings.publish(topic + "/stateOfCharge", String(Battery.stateOfCharge));
MqttSettings.publish(topic + "/stateOfHealth", String(Battery.stateOfHealth));
MqttSettings.publish(topic + "/dataAge", String((millis() - Battery.lastUpdate) / 1000));
MqttSettings.publish(topic + "/voltage", String(Battery.voltage));
MqttSettings.publish(topic + "/current", String(Battery.current));
MqttSettings.publish(topic + "/temperature", String(Battery.temperature));
Expand Down

0 comments on commit e06740f

Please sign in to comment.