Rename topic and document MQTT message structure

main
Nick Thomas 2022-10-11 22:36:07 +01:00
parent 32e0bfc5aa
commit d168b045aa
2 changed files with 38 additions and 1 deletions

View File

@ -4,6 +4,38 @@ Scrapes the HTTP endpoint of a Solax X1-Boost G3 with PocketWIFI v3 firmware and
pushes the scraped values to an MQTT server. Other inverter models are available
but I only have access to this one.
## Published MQTT messages
```json
solax2mqtt/<adapter-serial>/SENSOR/inverter {
"inverter": {
"ac_net_voltage_volts": 230.0,
"ac_net_frequency_hz": 50.0,
"ac_out_current_amps": 12.0,
"ac_out_power_watts": 2000.0,
"pv1_voltage_volts": 315.0,
"pv2_voltage_volts": 300.0,
"pv1_current_amps": 7.5,
"pv2_current_amps": 7.4,
"pv1_power_watts": 3000.0,
"pv2_power_watts": 3000.0,
"status": 2,
"runtime_hours": 127,
"temp_external_kelvin": 240,
"temp_internal_kelvin": 250,
"sn": "XB32xxxxxxxxxx",
"nominal_kw": 3,
"type": 4,
"energy_generated_kwh_total": 105.3,
"energy_generated_kwh_today": 5.6,
"adapter_sn": "SXxxxxxxxx",
"adapter_ver": "3.003.02"
}
}
```
(Values made up).
Most of the data for this project came from [`squishykid/solax`](https://github.com/squishykid/solax).
Configuration is currently done by editing the source code and recompiling.
@ -11,6 +43,11 @@ Configuration is currently done by editing the source code and recompiling.
PocketWIFI is dreadfully insecure. Use Modbus-RTU or, at the very least, a
PocketLAN, if you can. I'll be switching as soon as I'm able to.
Another cool project: [`xdubx/Solax-Pocket-USB-reverse-engineering`](https://github.com/xdubx/Solax-Pocket-USB-reverse-engineering).
This is effectively a custom PocketWIFI module built out of an ESP8266. It's
possible I could put one of these together and make it talk MQTT instead of
having this separate daemon running. One for later.
The PocketWIFI squirts MQTTS to their cloud servers, but they don't verify TLS
so it can be trivially intercepted. However, the messages are in a useless (to
me) binary format.

View File

@ -222,7 +222,7 @@ fn gather() -> Result<MQTTData, Error> {
fn publish(mqtt_client: &mqtt::Client, data: MQTTData) -> Option<Error> {
let content = serde_json::to_string(&data).ok()?;
let msg = mqtt::Message::new(
format!("solax/SENSOR/{}", data.inverter.adapter_sn),
format!("solax2mqtt/{}/SENSOR/inverter", data.inverter.adapter_sn),
content,
QOS,
);