Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect water and energy information #544

Open
kinnkler opened this issue Sep 8, 2024 · 3 comments
Open

Incorrect water and energy information #544

kinnkler opened this issue Sep 8, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@kinnkler
Copy link

kinnkler commented Sep 8, 2024

The problem

I have noticed an error regarding the water and energy data of my dishwasher. The error is not due to the HA integration but to the Miele API. The energy/water data is only displayed during the program and then reset to 0. However, when you start a new program, the Miele API displays the energy and water quantity of the last program in the event stream during the programming phase and also in the first event messages where the program is already running. This can be clearly seen in the following event stream. The first message is after I have entered the program. Then I start the machine and the status is “In Use”, but the old quantity is still displayed. Only with the second message with status “In Use” is it adjusted:

Bildschirmfoto 2024-09-08 um 02 09 12

Since I use the two sensors with a HA-Utlity Meter, I always have incorrect energy quantities.

Bildschirmfoto 2024-09-08 um 01 14 51

I have fixed this temporarily by only displaying the energy/water quantities after 3 messages with “Running”/“In Use” status:

Bildschirmfoto 2024-09-08 um 02 19 03

Should I report this to Miele?

Version of miele integration having the issue?

2024.8.1

Version of Home Assistant Core having the issue?

2024.8.3

Anything in the logs that might be useful for us?

No response

Additional information

No response

@kinnkler kinnkler added the bug Something isn't working label Sep 8, 2024
@astrandb
Copy link
Owner

Thank you for your detailed report. This problem has been identified before but did not get the attention it deserves. It results in more or less meaningless values if you try to create accumulated consumption sensors in HA. There is no safe way to work around the erroneous values. It should really be taken care of at the root.
I suggest that you report this to [email protected] and refer to this issue report. They are well aware that there are a couple of thousands users of this integration 😉.

@PaulBol
Copy link

PaulBol commented Jan 24, 2025

Thanks for the great integration, @astrandb!

I'm also seeing the issue with incorrect consumption values. Apparently, Miele has not updated the API yet.

As I'd still like to get consumption data into HA, I tried to use your workaround, @kinnkler. However, in my first attempt the sensors were "unavailable".

I edited the code trying to make it more tolerant and easier to understand for me. But now constantly 0 gets reported.

diff --git a/sensor.py b/sensor.py
index 5cee5bf..c250ce5 100644
--- a/sensor.py
+++ b/sensor.py
@@ -772,6 +772,7 @@ class MieleSensor(MieleEntity, SensorEntity):
         self._last_elapsed_time_reported = None
         self._last_started_time_reported = None
         self._last_abs_time = {}
+        self.running_state_counter = 0
 
     @property
     def native_value(self):
@@ -860,15 +861,20 @@ class MieleSensor(MieleEntity, SensorEntity):
         if self.entity_description.key in [
             "stateCurrentEnergyConsumption",
             "stateCurrentWaterConsumption",
-        ] and state in [
-            STATE_STATUS_ON,
-            STATE_STATUS_OFF,
-            STATE_STATUS_PROGRAMMED,
-            STATE_STATUS_WAITING_TO_START,
-            STATE_STATUS_IDLE,
-            STATE_STATUS_SERVICE,
         ]:
-            return 0
+            if state in [
+                STATE_STATUS_ON,
+                STATE_STATUS_OFF,
+                STATE_STATUS_PROGRAMMED,
+                STATE_STATUS_WAITING_TO_START,
+                STATE_STATUS_IDLE,
+                STATE_STATUS_SERVICE,
+            ]:
+                self.running_state_counter = 0
+                return 0
+            if state == STATE_STATUS_RUNNING and getattr(self, 'running_state_counter', 3) < 3:
+                self.running_state_counter += 1 
+                return 0
 
         if (
             self.coordinator.data[self._ent].get(self.entity_description.data_tag)

Would anyone be able to suggest what I'm doing wrong?

@PaulBol
Copy link

PaulBol commented Jan 27, 2025

Problem resolved, STATE_STATUS_RUNNING hadn't been imported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants