celsworth / lxp-bridge

A bridge to MQTT/InfluxDB/Postgres for communications with LuxPower inverters
MIT License
10 stars 14 forks source link

Experiment: add cmd/read/input/X and publishing of raw input registers #111

Closed celsworth closed 1 year ago

celsworth commented 1 year ago

There's a bit of a disconnect between inputs and holdings at the moment; holdings are far more "raw" and you read/write them unprocessed, specifying the exact register. In comparison inputs are processed into more "human friendly" values and batched out as part of inputs/1 inputs/2 and inputs/3 messages, which is mostly an early design decision from when I only really cared about getting the power data into MQTT and had little knowledge of how the registers were laid out.

This PR adds more direct raw access to input registers, so now you can do lxp/cmd/all/read/input/10 to get the instant battery charge power and get the raw register result in MQTT.

This also means that sending lxp/cmd/all/read/input/0 with a payload of 40 is identical to sending lxp/cmd/all/read/inputs/1, so the new topic could eventually supercede the old one.

The processed JSON datadumps are still sent out when the appropriate packets are received (registers 0-39, 40-79, and 80-119 - or on newer inverters, 0-127).

Few considerations with this:

Ultimately it's probably not that useful to read a single input register anyway when you can read 40 at a time, but I think having this in for completeness is a good idea.