krahabb / meross_lan

Home Assistant integration for Meross devices
MIT License
416 stars 45 forks source link

MTS200b: Set Point Temperature can only be set after using Meross app #369

Closed bodomenke closed 6 months ago

bodomenke commented 8 months ago

Environment: HA 2024.1.0, 7 x MTS200b 7.0.0 Firmware 7.6.10 Custom Component: v4.5.2

Configuration: I have configured all by setting up my Meross Cloud account. I see, that the integration is connected as a corresponding sensor reports (sensor.mqtt_eu_3_meross_com_443_3164404_mqtt_eu_3_meross_com_443)

Issue Description Steps in chronological order to allow reproducing the issue. Log output of three attempts is listed below.

  1. When I try to choose a new Set Point Temperature (SPT), nothing happens on the MTS200b, while the new SPT is shown in the HA thermostat card.
  2. If I then open the Meross iOS app I do not see the new SPT there as well.
  3. If I change the SPT in the Meross app, it gets immediately updated in the MTS200b and in the HA thermostat card. By this change an error is written into the error log (see below).
  4. If I then go into HA iOS app and change the SPT over there it works seamless and immediately.

Debug log (with comments)

This error originated from a custom integration.

Logger: custom_components.meross_lan Source: custom_components/meross_lan/helpers.py:166 Integration: Meross LAN (documentation, issues)

Home Assistant Core

Remark: Starting HA

2024-01-08 00:36:55.697 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration meross_lan which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2024-01-08 00:37:23.140 WARNING (MainThread) [custom_components.meross_lan] MerossDevice(Smart Thermostat (2307074656388260120148e1e9cf901c)): Mts200Schedule(calendar.smart_thermostat_2307074656388260120148e1e9cf901c_schedule): unexpected device schedule entries count 2024-01-08 00:37:23.167 WARNING (MainThread) [custom_components.meross_lan] MerossDevice(Smart Thermostat (2307079368753560120148e1e9cf947f)): Mts200Schedule(calendar.smart_thermostat_2307079368753560120148e1e9cf947f_schedule): unexpected device schedule entries count 2024-01-08 00:37:23.171 WARNING (MainThread) [custom_components.meross_lan] MerossDevice(Smart Thermostat (2307071418080660120148e1e9cf8fd6)): Mts200Schedule(calendar.smart_thermostat_2307071418080660120148e1e9cf8fd6_schedule): unexpected device schedule entries count

Remark: Setting SPT on climate.gaeste_wc

2024-01-08 11:12:43.323 WARNING (MainThread) [custom_components.meross_lan] MerossDevice(Smart Thermostat (2307078976209760120148e1e9cf92f5)): Mts200Climate(climate.gaeste_wc): handler undefined for payload:({'mode': 1, 'expire': 1704754840, 'channel': 0}) 2024-01-08 11:12:55.410 WARNING (MainThread) [custom_components.meross_lan] MerossDevice(Smart Thermostat (2307078976209760120148e1e9cf92f5)): Mts200Climate(climate.gaeste_wc): handler undefined for payload:({'mode': 1, 'expire': 1704754853, 'channel': 0}) 2024-01-08 11:12:59.411 WARNING (MainThread) [custom_components.meross_lan] MerossDevice(Smart Thermostat (2307078976209760120148e1e9cf92f5)): Mts200Climate(climate.gaeste_wc): handler undefined for payload:({'mode': 1, 'expire': 1704754857, 'channel': 0})

Remark: Setting SPT on climate.kueche

2024-01-08 13:18:32.609 WARNING (MainThread) [custom_components.meross_lan] MerossDevice(Smart Thermostat (2307079368753560120148e1e9cf947f)): Mts200Climate(climate.kueche): handler undefined for payload:({'mode': 1, 'expire': 1704754830, 'channel': 0}) 2024-01-08 13:21:45.909 WARNING (MainThread) [custom_components.meross_lan] MerossDevice(Smart Thermostat (2307079368753560120148e1e9cf947f)): Mts200Climate(climate.kueche): handler undefined for payload:({'mode': 1, 'expire': 1704754842, 'channel': 0})

Remark: Setting SPT on climate.gaeste_wc

2024-01-08 13:37:38.713 WARNING (MainThread) [custom_components.meross_lan] MerossDevice(Smart Thermostat (2307078976209760120148e1e9cf92f5)): Mts200Climate(climate.gaeste_wc): handler undefined for payload:({'mode': 1, 'expire': 1704754836, 'channel': 0}) 2024-01-08 13:37:48.712 WARNING (MainThread) [custom_components.meross_lan] MerossDevice(Smart Thermostat (2307078976209760120148e1e9cf92f5)): Mts200Climate(climate.gaeste_wc): handler undefined for payload:({'mode': 1, 'expire': 1704754846, 'channel': 0})

krahabb commented 8 months ago

Hello @bodomenke, I'm not sure the logged WARNING is related but for sure there's a kind of new message issued by the device that meross_lan is unable to decode. The standard log (sadly) is not detailed enough to get all the needed informations about this new message so, if you will, I would need a diagnostic trace from the device.

The diagnostic would also help in diagnosing the initial WARNINGS ('unexpected device schedule entries count') since that's another indication of something well...unexpected.

Anyway these logs are likely not related to the issue (they're not strictly errors in device communication) so we're left with a question here.

This could also be investigated with the diagnostic. In order to try gather relevant informations please setup the diagnostic this way so that it could register all the messages exchanged while experiencing the 'SPT issue':

bodomenke commented 8 months ago

Many thanks, @krahabb, for your swift response. I did as you said, I …

Hope you can make any sense out of this… ;-)

Best, Bodo

config_entry-meross_lan-282d13aa66ac913fe913b836ecf5979e.json.txt.json

krahabb commented 8 months ago

Working on it, the trace is ok but at the moment I still haven't figured out the real issue. I hope to deliver a patch by the end of this week

bodomenke commented 8 months ago

No reason to rush - at least not for me. 😉 The thermostats are still fully functional, either via native app or physically. Good luck in investigating the issue.

krahabb commented 8 months ago

Hello @bodomenke, With your traces (and the warnings in it) I guess the issue lies in some kind of 'locking behavior' of the device since when you issue the SPT request, the device responds acknowledging that, but also with an unknown (at the moment) message which I'm interpreting as the device is 'kinf of locked' (the message namely is the 'Appliance.Control.Thermostat.HoldAction' and is the one responsible for the log warning stating that : ' handler undefined for payload:({'mode': 1, 'expire': 1704754840, 'channel': 0})'

Now, implementing the handler is not that difficult but the meaning of this stuff is a bit obscure. Your traces are the first reporting this message and I've checked the 'expire' field was set around midnight the evening when you grabbed the trace. At the moment I'm interpreting this as if the device is somewhat locked up until midnight, so the temperature you set through HA is not being applied.

It could be that the Meross app instead, even if the thermostat has this 'locking' is able to overcome it (maybe it disables the lock automatically when you use the app?)

Or maybe I'm completely out of tune and I didn't really get it

Help ;)

bodomenke commented 8 months ago

Hi @krahabb, In the very moment I was trying to set the SPT via HA the thermostat was set to automatic and the SPT defined by the time plan until midnight. Could it be, that auto-mode with the time plan is some kind of locking? Could it be that the thermostat needs first to be switched to manual before altering the SPT?

Best, Bodo

krahabb commented 8 months ago

Yeah...I remember the 'old' mts100 exiting 'auto mode' by themselves as far as a new SPT was sent. But likely the mts200 has a different behavior and needs to be explicitly set to manual. Tha app is likely automatically sending this 'switch mode' before issuing an SPT

bodomenke commented 8 months ago

I could try to validate this assumption by setting the thermostat physically to manual-mode and then try HA with your integration to see how it behaves…

Will do this later and report…

bodomenke commented 8 months ago

I have validated our assumption:

Success!

Tested this with two thermostats, but I believe the test sample is large enough. 😊