Closed celsworth closed 1 year ago
So other than a few refinements (setting an icon, refactoring the code a bit) the status field seems to be working.
~The fault/warning is more difficult, as bizarrely the manuals list "00" as being an active fault/warning. Fault 0 is "Internal communication fault 1" and Warning 0 is "Communication failure with battery". So I'm not sure how I'm supposed to tell the difference between no fault/warning (which I'd expect to be 0) and these...~
Ohh they're individual bits. So bit 0 being set is "Communication failure with battery", rather than the value being 0. Which means the planned system of input/60/parsed
doesn't work for fault or warning codes, processing a single register isn't enough to get all possible faults or warnings. Ugh.
So interestingly this means its possible for multiple faults to be present at the same time, not sure how the inverter handles displaying them; maybe just cycles between them. It does make sending it to HA more difficult though as that only expects a single string.
Build upon #189 and #190 and get this working properly.
This will add status/faults/warnings as diagnostic sensors in HA, complete with translated values, as a table of integers isn't very useful.
Note that this will require the config option
mqtt.publish_individual_input
setting totrue
to work.Wasn't really happy with the state of
src/home_assistant.rs
, it has turned into a bit of a mess, so I redesigned it. It's ended up a bit longer with a little more repetition but I think it will scale more easily in future and lends itself to per-entity tweaks much better.