LordMike / MBW.BlueRiiot2MQTT

Utility to map between Blue Riiots pool API, and Home Assistant MQTT
47 stars 2 forks source link

Inconsistent status #91

Open digidolphin opened 10 months ago

digidolphin commented 10 months ago

I have noticed that the statuses reported are inconsistent between what is in the attribute of the measurement and what is the status in the separate status entity. Specifically the "Status" attribute in the measurement/value entity is wrong.

Example: I have an entity called "sensor.swim_spa_ORP". It has a state of 640. The "Status" attribute of this sensor says "bad". But the entity called "sensor.swim_spa_ORP_status" has the state "warning" (which is correct). I can see that both entities have the same min/max values defined in their respective attributes. The same problem exists for Ph, and maybe some of the others.

LordMike commented 9 months ago

Hmm, that's weird.

LordMike commented 9 months ago

Is it always inconsistent?

LordMike commented 9 months ago

I am not at all sure why it would be - maybe you're looking at something that's updated and something that's not?

As I read the code - it does run in two different code paths (one for status entity, and one for the attribute), but they both do the same on the same data. So it should come to the same conclusions.

digidolphin commented 9 months ago

I am not at all sure why it would be - maybe you're looking at something that's updated and something that's not?

As I read the code - it does run in two different code paths (one for status entity, and one for the attribute), but they both do the same on the same data. So it should come to the same conclusions.

Well - I can only relay what the state and attributes say. I cannot explain why one entity would update and another one wouldn't as they are part of the same integraiton. I am having a bit of connectivity issues here at the moment, so cannot check right now, but I am fairly certain that I restart Home assistant they will be consistent, but over time they will start to differ.

LordMike commented 9 months ago

Hmm - the reason I asked is that it is sent as two updates through MQTT - perhaps one message was lost... :

It's not impossible - only implausible. It would be fixed on the next update, if it was a lost message.

digidolphin commented 9 months ago

Got it - I understand why it is implausible. But I notice that the inconsistencies persists for long periods of time, so it cannot be just one message getting lost. My guess would be that attributes are not updating as they should, but it is just a guess.

LordMike commented 9 months ago

Well - its a good one.. :)

You can verify this with the Timestamp attribute on both entities. It should be the same if it's the same measurement.

digidolphin commented 9 months ago

You can verify this with the Timestamp attribute on both entities. It should be the same if it's the same measurement.

I checked it out, and it is clear that the attributes are not updating. I have timestamps that are almost a month old (Oct 25). But the thing is that the states are correct - it is only the attributes that are not updating. Hope that helps.

LordMike commented 9 months ago

It does. So the code “works” – but for some reason the attributes list is not sent (it would be received if it was). State and Attributes are sent separately.

It could be an issue in my MQTT library – the value is only sent if it is changed. It can be bypassed by setting the environment variable BlueRiiot__ReportUnchangedValues to true.

You can try setting this and see if it "drifts" within some timeframe.. days or weeks. If it doesn't, that just confirms the above.

digidolphin commented 9 months ago

I looked in the configuration, and that environment variable was already set to true. (or almost - in the section BlueRiiot, it says: "ReportUnchangedValues: true")

digidolphin commented 5 months ago

I looked in the configuration, and that environment variable was already set to true. (or almost - in the section BlueRiiot, it says: "ReportUnchangedValues: true")

Any news on this issue?