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

Mill devices do not report the correct temperature #103618

Closed
gejr opened this issue Nov 7, 2023 · 23 comments · Fixed by #106464
Closed

Mill devices do not report the correct temperature #103618

gejr opened this issue Nov 7, 2023 · 23 comments · Fixed by #106464
Assignees

Comments

@gejr
Copy link

gejr commented Nov 7, 2023

The problem

I have 8 different Mill devices. Five gen2 panel heaters, two gen2 convection heaters and one gen3 socket. They all work fine, but their reported temperature is always wrong, so I can not really know if they are on or not without checking the app or physically going up to them and look at their display.

They are all set to "Control device individually" in the app. If I call climate.set_temperature with e.g. a temperature payload of 22 on one of them, the attribute temperature will show 22 for a few seconds then go back to some random (?) value (usually 5 in my case). Maybe it goes to 5 because the min_temp attribute is 5? The hvac_action also goes from "heating" to "idle" at the same time, even though the heater is clearly on. This affects both the gen3 and gen2 devices.

If I look at the display it will still show 22 and the heater will work fine, and the app shows that the temperature is currently 22. But in Home Assistant it will show as 5.

Not a huge issue, but slightly annoying. Is this some limitation of the current Mill API, or is there a bug in the integration? Or am I simply doing something wrong?

Please let me know if I should provide any sort of logs or diagnostics if you want to help me solve this issue.

What version of Home Assistant Core has the issue?

core-2023.11.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Mill

Link to integration documentation on our website

https://www.home-assistant.io/integrations/mill/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Nov 7, 2023

Hey there @Danielhiversen, mind taking a look at this issue as it has been labeled with an integration (mill) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of mill can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign mill Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


mill documentation
mill source
(message by IssueLinks)

@olem10
Copy link

olem10 commented Nov 11, 2023

I have a similar problem with a mill convection heater gen 3. The target temperature value resets to an old (random?) value after 20-30s. The heater target temperature is however not reset, so the problem only seems to affect the UI widget in homeassistant.

@oskarax
Copy link

oskarax commented Nov 11, 2023

i also have the exact same issues as above

@bjorkert
Copy link

bjorkert commented Nov 11, 2023

Same issue here. The app, local api and tibber reports the correct target temperature, but HA jumps back to an old value after a few seconds. However, after about 10-15 minutes, the correct target temperature is displayed again. Cache issue? But now after some time it jumped back to the old value again... very strange.

@SanderKo85
Copy link

SanderKo85 commented Nov 13, 2023

Same issue here. Let me know if I have to provide any log files.
[edit] Added log file while setting temperatures and wait so see the temperature output/reading switching back and forth.
home-assistant_mill_2023-11-13T21-05-06.729Z.log

@Danielhiversen
Copy link
Member

@SanderKo85 Is the temperature response from Mill that you see in the logs correct?

@gejr
Copy link
Author

gejr commented Nov 14, 2023

I just pulled
this out of the logs. It shows up right when the temperature attribute changes.

Nothing happens to the heater, it stays at the temperature I told it to. Looks to me like some sort of statistics coming in? A payload of statistics should not change the value of the temperature attribute, right?

Edit: Probably not relevant, but the request causing the former response is this:
DEBUG (MainThread) [mill] Request devices/5c72d3c5-e489-43cd-8d29-796bf51829b1/statistics {'period': 'monthly', 'year': 2023, 'month': 1, 'day': 1}

@SanderKo85
Copy link

SanderKo85 commented Nov 14, 2023

Hi @Danielhiversen, it looks like it does not.

  1. enabled heating from Off to On
  2. changed manual temperature to 19.0c
    <waited 8 sec>
  3. changed manual temperature to 20.0c
  4. after about 30 seconds, the climate control card reverts to 19.5c

I request 19.0c, but I see 19.5c in the log? (don't know if I am looking in the right places)
I also added a new and filtered log file.

The request is:
2023-11-14 22:19:00.021 DEBUG (MainThread) [mill] Request devices/947cde01-7389-4903-bce9-a74e3f0b3931/settings {'deviceType': 'Heaters', 'enabled': True, 'settings': {'operation_mode': 'control_individually', 'temperature_normal': 19.0}}

And the result is:
2023-11-14 22:19:00.171 DEBUG (MainThread) [mill] Result {"settings":{"timezone":"CET-1CEST,M3.5.0,M10.5.0/3","lock_status":"no_lock","open_window":{"drop_temperature_threshold":5,"drop_time_range":900,"increase_temperature_threshold":3,"increase_time_range":900,"max_time":3600,"enabled":true,"activated":false},"operation_mode":"control_individually","temperature_in_independent_mode":19.5,"weekly_program":{"timers":[{"value_type":"sleep","timestamp":0},{"value_type":"comfort","timestamp":390},{"value_type":"away","timestamp":480},{"value_type":"comfort","timestamp":960},{"value_type":"sleep","timestamp":1320},{"value_type":"sleep","timestamp":1440},{"value_type":"comfort","timestamp":1830},{"value_type":"away","timestamp":1920},{"value_type":"comfort","timestamp":2400},{"value_type":"sleep","timestamp":2760},{"value_type":"sleep","timestamp":2880},{"value_type":"comfort","timestamp":3270},{"value_type":"away","timestamp":3360},{"value_type":"comfort","timestamp":3840},{"value_type":"sleep","timestamp":4200},{"value_type":"sleep","timestamp":4320},{"value_type":"comfort","timestamp":4710},{"value_type":"away","timestamp":4800},{"value_type":"comfort","timestamp":5280},{"value_type":"sleep","timestamp":5640},{"value_type":"sleep","timestamp":5760},{"value_type":"comfort","timestamp":6150},{"value_type":"away","timestamp":6240},{"value_type":"comfort","timestamp":6720},{"value_type":"sleep","timestamp":7080},{"value_type":"sleep","timestamp":7200},{"value_type":"comfort","timestamp":7740},{"value_type":"sleep","timestamp":8580},{"value_type":"sleep","timestamp":8640},{"value_type":"comfort","timestamp":9180},{"value_type":"sleep","timestamp":10020}]},"vacation_mode":{"start_timestamp":0,"end_timestamp":0,"advanced":false},"non_repeatable_timers":{"timers":[]},"predictive_heating_type":"off","temperature_normal":19,"temperature_comfort":19.5,"temperature_sleep":17,"temperature_away":15,"temperature_vacation":10,"regulator_type":"pid","hysteresis":{"lower":0.5,"upper":0.5},"display_unit":"celsius","override_weekly_program":{"value_type":"away","ends_at":4099680000},"limited_heating_power":100,"pid_parameters":{"kp":70,"ki":0,"kd":4500,"kd_filter_N":60,"windup_limit":95},"max_heater_power":1200,"temperature_last_set":19.5,"temperature_calibration_offset":-0.7},"deviceType":"Heaters","enabled":true}

home-assistant_mill_2023-11-14T21-21-25.025Z.log

Thank you for checking this out!

@oskarax
Copy link

oskarax commented Dec 3, 2023

Any news on this?

@Danielhiversen
Copy link
Member

I am not able to reproduce it, so not sure how to fix it.

@pjoomen
Copy link

pjoomen commented Dec 23, 2023

Could this be related to Enable polling for updates? I have been experiencing the same issue and it has been driving me nuts while trying to integrate the Mill Gen 2 heaters into Node Red. I have now turned off this settings and my initial observations seem to indicate it works around this issue.

@gejr
Copy link
Author

gejr commented Dec 23, 2023

Could this be related to Enable polling for updates? I have been experiencing the same issue and it has been driving me nuts while trying to integrate the Mill Gen 2 heaters into Node Red. I have now turned off this settings and my initial observations seem to indicate it works around this issue.

That indeed fixes the issue at my end! Very happy to finally have a way of seeing which heater is actually on. Now, why would I want the enable polling for updates setting on? I'm assume just turning it off will lead to some sort of negative implications?

@oskarax
Copy link

oskarax commented Dec 23, 2023 via email

@gejr
Copy link
Author

gejr commented Dec 23, 2023

Where do you turn this setting off?

Under devices and services -> Mill -> three little dots under "integration entries" -> system options

@pjoomen
Copy link

pjoomen commented Dec 23, 2023

Now, why would I want the enable polling for updates setting on? I'm assume just turning it off will lead to some sort of negative implications?

I have been wondering about this as well. My guess is it might effect:

  • changing temperature on-device might go unnoticed
  • usage statistics might be effected

But this is pure speculation.

@pjoomen
Copy link

pjoomen commented Dec 24, 2023

  • usage statistics might be effected

This is definitely an issue now 😞

@gejr
Copy link
Author

gejr commented Dec 24, 2023

Also when I set this Mill socket (gen 3) to "off" manually, it seems to go back to "heat" every full hour automatically. Not sure if it actually turns on physically, but it's still not great.

Screenshot_20231224_102850_Home Assistant~3

@pjoomen
Copy link

pjoomen commented Dec 25, 2023

This seems to be a caching issue, ie. cached_request is returning stale data for lastMetrics.

@Danielhiversen
Copy link
Member

@pjoomen Do you see anything wrong in the code?

@pjoomen
Copy link

pjoomen commented Dec 26, 2023

@Danielhiversen Nope. It seems like the API from Mill is eventual consistent and that the request that retrieves the new state for the heater that got its temperature adjusted is retrieving stale data from Mill's API, ie. that the request could benefit from a sleep before calling async_request_refresh

@pjoomen
Copy link

pjoomen commented Dec 26, 2023

Solution might be to use deviceSettings.desired, instead of lastMetrics

@pjoomen
Copy link

pjoomen commented Dec 26, 2023

diff --git a/mill/__init__.py b/mill/__init__.py
index c7567b8..4ba7965 100644
--- a/mill/__init__.py
+++ b/mill/__init__.py
@@ -507,11 +507,12 @@ class Heater(MillDevice):
         """Post init."""
         if self.data:
             last_metrics = self.data.get("lastMetrics", {})
+            device_settings_desired = self.data.get("deviceSettings", {}).get("desired", {})
             if last_metrics is not None:
                 self.current_temp = last_metrics.get("temperatureAmbient")
                 self.is_heating = last_metrics.get("heaterFlag", 0) > 0
                 self.power_status = last_metrics.get("powerStatus", 0) > 0
-                self.set_temp = last_metrics.get("temperature")
+                self.set_temp = device_settings_desired.get("temperature_normal", last_metrics.get("temperature"))
                 self.open_window = WINDOW_STATES.get(
                     last_metrics.get("openWindowsStatus")
                 )

pjoomen added a commit to pjoomen/pymill that referenced this issue Dec 26, 2023
Use `deviceSettings.desired.temperature_normal`, since the Mill API has a
delay when updating `lastMetrics` after a change is requested.

Signed-off-by: Pip Oomen <pepijn@redpill-linpro.com>
@pjoomen
Copy link

pjoomen commented Dec 26, 2023

Danielhiversen/pymill#84

@github-actions github-actions bot locked and limited conversation to collaborators Jan 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants