celsworth / lxp-bridge

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

Re-add artificial p_grid and p_battery keys #254

Closed celsworth closed 7 months ago

celsworth commented 7 months ago

Also convert RegisterParser to return Err if any expected registers are missing.

This could be improved in future to just return the ones we can work out instead of bailing completely but it's a pretty special edge case so unlikely to be a problem.

The issue is if you pass in a non-standard set of Input registers. Standard would be 0-39, or 40-79 etc.

Non-standard would be 0-7. When this parser sees 7, it will try and calculate p_pv by summing 7 + 8 + 9, but since 8 and 9 aren't present, it can't, so will Err out.

Adding these artificial keys exposes this problem a little more but it was kind of already present with things like e_pv_all which are spread across two registers (40 and 41) anyway, so its not really much worse.