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

MS600 light sensor unavailable #517

Open
Lestat78 opened this issue Dec 18, 2024 · 8 comments
Open

MS600 light sensor unavailable #517

Lestat78 opened this issue Dec 18, 2024 · 8 comments
Labels
bug Something isn't working todo This item needs processing

Comments

@Lestat78
Copy link

Lestat78 commented Dec 18, 2024

Occasionally, the light sensor from MS600 devices is reported as "unavailable". When this happens, the diagnostic JSON does not, in fact, contain any reference to "light".
I suspect this happens if a device does not register any luminance change for an extended period of time (like if placed inside a dark place with no windows like a garage or storeroom), so it stops sending values for the sensor until there is a significant change and in fact I've noticed this happening more frequently with a sensor I have in the garage. I will monitor this behaviour to better understand why this happens.
BTW, when this happens the Meross app reports 0lux as usual and the other sensors in HA work correctly.
While not critical, this causes issues with automations that rely on both presence detection and light level (for example, to turn on the light if there is presence and light level below a certain threshold), as these will not trigger if the light sensor is unavailable (I guess this could probably be worked around with a template sensor that returns 0 if the status is unavailable).
If my assumption above is correct, may I suggest implementing a persistence of the last available value for this sensor (or simply, return 0), instead of reporting it as unavailable?

Thank you!

UPDATE1:
Yesterday night for whatever reason the garage sensor did not update at all in HA and got stuck on "presence detected". BTW, the device was working correctly and the Meross app notified me of "absence" when I left. This morning I manually turned off the light and reloaded the device in HA. After a short while, the sensor got updated with the latest values (so, correctly reporting absence), but the light sensor was "unavailable". I turned on the light and the value got then updated in HA. It seems that my assumption about the sensor not reporting the light status if there are no changes for a while may be correct.

@Lestat78
Copy link
Author

Upon further testing, it seems that this update issue is applicable to all MS600 sensors and not only the light sensor.
Yesterday evening I had to thinker with my WiFi for a while and, as a result, all sensors of all MS600 devices started reporting "unavailable". The situation normalised as they started recording new values around the house, but the Garage device was left on unavailable, since nothing happened there (everything was fine in the Meross app). This only applied to the sensors, the configuration parameters were still available.
I left it untouched until a earlier, when I decided to remotely turn on the light. Sure enough, the light sensor got updated while all other sensors remained unavailable.
I then decided to download the diagnostic and this caused all sensors to update.
Another "issue" I encountered with the integration is that the "presence distance" sensor does not reset its value when there is no presence, meaning that if the last recorded presence distance value is of 3 meters, it will stay "stuck" on that value until there is a new presence detection. I thought this was normal behaviour but now I realise it's part of the same issue I am reporting with the light sensor.
To test this, I downloaded the diagnostic from another device (presence = 1, presence distance = 2,94) and, sure enough, the presence distance got updated to 0, so it seems that either the reporting behaviour for the MS600 is different from other Meross devices or maybe there was a firmware update that changed things around.
I don't know how relevant this might be, but I've noticed in the diagnostic for all devices I get those errors (I replaced the IP with Xs, it did report the correct IP for the device):

[ "2024/12/21 - 16:27:05", "", "auto", "LOG", "debug", "HTTP ERROR GET Appliance.System.Debug (messageId:b248ba2c034249169e802666a20722f3 ConnectionTimeoutError:Connection timeout to host http://XX.XX.XX.XXX/config)" ], [ "2024/12/21 - 16:27:05", "TX", "http", "GET", "Appliance.System.Runtime", { "runtime": {} } ], [ "2024/12/21 - 16:27:13", "", "auto", "LOG", "debug", "HTTP ERROR GET Appliance.System.Runtime (messageId:29714e84df2247b5a9b8e956e0a27fda ClientConnectorError:Cannot connect to host XX.XX.XX.XXX:80 ssl:default [Connect call failed ('XX.XX.XX.XXX', 80)])" ]

@krahabb
Copy link
Owner

krahabb commented Dec 22, 2024

Hello @Lestat78,
It looks like your device in meross_lan gets updated only by 'pushes' through cloud mqtt from the device. Correct me if I'm wrong but I'm 'guessing' your configuration in meross_lan integration page is as follows:

  • you have a configuration entry for each ms600 device
  • you also have a configuration entry for your Meross cloud account

By the look of your debug log the device is not locally reachable (over http) and that might be because either the ip address/hostname is wrong or because the device key is wrong (when the device key is wrong devices used to reply with an error but I have the feeling that this has changed lately and they now refuse to reply)

If you have a diagnostic (or can grab a new one) pls submit it so I can better check.
Another reason for failure might be, as you've suggested, that this device doesn't behave the same as other Meross ones so that the querying/polling strategy in place is not suitable for it.

Another small experiment could be carried on by configuring the device entry in meross_lan to only use HTTP protocol. This way you'll surely loose 'instant' pushed updates coming through cloud MQTT but we can better check if the local polling queries work. This is needed because, as an optimization, meross_lan doesn't perform full state queries (over HTTP) when it detects updates can come through MQTT. Instead, when MQTT is unavailable, it will always perform these 'full state queries' through HTTP at every 'polling cycle'.

Also, when you configure 'HTTP only' for the device entry, the code will accept the config change only if the HTTP connection works so that we can also check that.

@krahabb krahabb added bug Something isn't working todo This item needs processing labels Dec 22, 2024
@Lestat78
Copy link
Author

Hi @krahabb,
you are correct regarding my configuration having both the individual devices and the Meross cloud account.
Regarding the network, each of my IOT devices have a static IP assigned by my router through the mac address and I can correctly ping all devices, so it should not be purely a network issue, but I guess the device key may be wrong. How can I check this?
Currently, all devices have the connection protocol set to "auto"; one of the first things I've noticed when setting the MS600 up in HA was that, if I set the protocol to HTTP the device would stop working and start a reboot loop until I switched back to auto. Given that support for the MS600 was experimental, I did not give much thought to it at the time.
I am attaching a new diagnostic, I have removed a couple of info such as IP and mac address but everything else is there. Let me know if I can run some other tests.
2024-12-22_meross_lan-Presenza Lavanderia_upload.json

@krahabb
Copy link
Owner

krahabb commented Dec 22, 2024

Well, the HTTP connection is ok so everything is working as expected.
What's not expected is the 'query' format. The diagnostic shows an error when the device is asked for state so I have to come up with a different query format...

@Lestat78
Copy link
Author

Thank you, let me know if there anything I can do to help.

@docmm-76
Copy link

Hi, I have the same problem with this sensor. HTTP only does not work and when on Auto the changes have a high latency, maybe because of the "cloud only" push.

@krahabb
Copy link
Owner

krahabb commented Jan 16, 2025

Hello,
Trying to keeping alive this thread since it surely reveals a bug in meross_lan query format but at th emoment I'm not able to focus too much on this.
Moreover, since I don't have any of these, I cannot really experiment on these and I'd need some volunteers tinkering with their own and trying to experiment different query formats by using meross_lan.request action UI (from the HA developer console).

@Lestat78
Copy link
Author

Hi @krahabb ,
as long as the tests will not impact any other Meross devices or funcionality of the meross_lan integration, I may be able to help and can dedicate one of my MS600 to testing; let me know what I should do and will provide a response asap. Thank you :)

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

No branches or pull requests

3 participants