Skip to content

6. MQTT topic & message structure

Graham Ross edited this page Nov 4, 2022 · 1 revision

HomeAssistant discovery:

A homeassistant message will be sent for each reading, here is an example for the Voltage.Reading field.

homeassistant/sensor/Rpi_Pack1_PackVoltage/config

{ "device_class": "voltage", "unit_of_measurement": "V", "state_class": "measurement", "name": "PackVoltage", "icon": "mdi:lightning-bolt", "state_topic": "PylonToMQTT/Main/stat/readings/Pack1", "unique_id": "Rpi_Pack1_PackVoltage", "value_template": "{{ value_json.PackVoltage.Reading }}", "availability_topic": "PylonToMQTT/Main/tele/LWT", "pl_avail": "Online", "pl_not_avail": "Offline", "device": { "name": "Pack1", "via_device": "PylonToMQTT", "hw_version": "1B470102010238D", "sw_version": "V1.2.1", "manufacturer": "ClassicDIY", "model": "P16S100A-1B470-1.04", "identifiers": "Pack1_1B470102010238D" } }

Info:

PylonToMQTT/Main/stat/info/Pack1

{ "Version" : "P16S100A-1B470-1.04", "BarCode" : "1B470102010238D" }

Readings:

State:

00: normal.

01: below lower limit.

02: above higher limit.

240: other error.

PylonToMQTT/Main/stat/readings/Pack1

{ "Cells" : { "Cell_1" : { "Reading" : 3.533, "State" : 2 }, "Cell_2" : { "Reading" : 3.43, "State" : 1 }, "Cell_3" : { "Reading" : 3.364, "State" : 2 }, "Cell_4" : { "Reading" : 3.361, "State" : 2 }, "Cell_5" : { "Reading" : 3.409, "State" : 1 }, "Cell_6" : { "Reading" : 3.362, "State" : 1 }, "Cell_7" : { "Reading" : 3.363, "State" : 1 }, "Cell_8" : { "Reading" : 3.364, "State" : 0 }, "Cell_9" : { "Reading" : 3.442, "State" : 0 }, "Cell_10" : { "Reading" : 3.361, "State" : 0 }, "Cell_11" : { "Reading" : 3.362, "State" : 0 }, "Cell_12" : { "Reading" : 3.362, "State" : 0 }, "Cell_13" : { "Reading" : 3.363, "State" : 0 }, "Cell_14" : { "Reading" : 3.362, "State" : 0 }, "Cell_15" : { "Reading" : 3.363, "State" : 0 }, "Cell_16" : { "Reading" : 3.361, "State" : 1 } }, "Temps" : { "CellTemp1_4" : { "Reading" : 9.3, "State" : 2 }, "CellTemp5_8" : { "Reading" : 8.9, "State" : 1 }, "CellTemp9_12" : { "Reading" : 10.3, "State" : 1 }, "CellTemp13_16" : { "Reading" : 8.6, "State" : 1 }, "MOS_T" : { "Reading" : 17.1, "State" : 1 }, "ENV_T" : { "Reading" : 17.6, "State" : 2 } }, "PackCurrent" : { "Reading" : 40.95, "State" : 2 }, "PackVoltage" : { "Reading" : 53.795, "State" : 2 }, "RemainingCapacity" : 79.36, "FullCapacity" : 101.98, "CycleCount" : 11, "SOC" : 77.8, "Power" : 2202.9, "Protect_Status" : { "Charger_OVP" : true, "SCP" : true, "DSG_OCP" : true, "CHG_OCP" : true, "Pack_UVP" : true, "Pack_OVP" : true, "Cell_UVP" : true, "Cell_OVP" : true, "ENV_UTP" : true, "ENV_OTP" : true, "MOS_OTP" : true, "DSG_UTP" : true, "CHG_UTP" : true, "DSG_OTP" : true, "CHG_OTP" : true }, "System_Status" : { "Fully_Charged" : true, "Heater" : true, "AC_in" : true, "Discharge_MOS" : true, "Charge_MOS" : true, "Charge_Limit" : true }, "Fault_Status" : { "Heater_Fault" : false, "CCB_Fault" : false, "Sampling_Fault" : false, "Cell_Fault" : false, "NTC_Fault" : false, "DSG_MOS_Fault" : false, "CHG_MOS_Fault" : false }, "Alarm_Status" : { "DSG_OC" : false, "CHG_OC" : false, "Pack_UV" : false, "Pack_OV" : false, "Cell_UV" : false, "Cell_OV" : false, "SOC_Low" : true, "MOS_OT" : true, "ENV_UT" : true, "ENV_OT" : true, "DSG_UT" : true, "CHG_UT" : true, "DSG_OT" : true, "CHG_OT" : true } }