albertogeniola / meross-homeassistant

Custom component that leverages the Meross IoT library to integrate with Homeassistant
MIT License
719 stars 82 forks source link

MSG100 becomes unavailable even when it's still togglable on the Meross app #225

Closed joelzhl closed 2 years ago

joelzhl commented 3 years ago

Describe the bug MSG100 becomes unavailable on Home Assistant even when it's can still be open and closed on the Meross app. Using the open and close button on the Meross app will shortly make the MSG100 available again on Home Assistant, but it will eventually become unavailable after a while.

The MSG100 is connect to the a Unifi AP with 70-99% Wi-Fi experience. The Meross app shows between 55%-75% Wi-Fi signal.

Your environment HomeAssistant version: core-2021.4.4 / OS - 5.10 Hassio Version (if applicable): -- PLEASE SPECIFY -- Hardware environment: Hyper-V

Logs taken when the issue happened

--- PASTE LOGS HERE ---
2021-04-29 19:01:05 WARNING (MainThread) [meross_iot.manager] Received a push notification (Namespace.GARAGE_DOOR_STATE, raw_data: {"state": [{"open": 0, "lmTime": 0, "channel": 0}], "reason": {"bootup": {"timestamp": 1619748064}}}) for device(s) (1909187718487890801948e1e95204a5) that are not available in the local registry. Trigger a discovery to intercept those events.
2021-04-29 19:01:05 WARNING (MainThread) [meross_iot.manager] Received a push notification for a device that is not available in the local registry. You may need to trigger a discovery to catch those updates. Device-UUID: 1909187718487890801948e1e95204a5
2021-04-29 19:01:05 WARNING (MainThread) [meross_iot.manager] Uncaught push notification Namespace.GARAGE_DOOR_STATE. Raw data: {"state": [{"open": 0, "lmTime": 0, "channel": 0}], "reason": {"bootup": {"timestamp": 1619748064}}}
2021-04-29 19:01:05 WARNING (MainThread) [meross_iot.manager] Received a push notification (Namespace.CONTROL_BIND, raw_data: {"bind": {"time": {"timezone": "America/Los_Angeles", "timestamp": 1619748064, "timeRule": [[1615716000, -25200, 1], [1636275600, -28800, 0], [1647165600, -25200, 1], [1667725200, -28800, 0], [1678615200, -25200, 1], [1699174800, -28800, 0], [1710064800, -25200, 1], [1730624400, -28800, 0], [1741514400, -25200, 1], [1762074000, -28800, 0], [1772964000, -25200, 1], [1793523600, -28800, 0], [1805018400, -25200, 1], [1825578000, -28800, 0], [1836468000, -25200, 1], [1857027600, -28800, 0], [1867917600, -25200, 1], [1888477200, -28800, 0], [1899367200, -25200, 1], [1919926800, -28800, 0]]}, "hardware": {"version": "3.5.0", "uuid": "1909187718487890801948e1e95204a5", "type": "msg100", "subType": "us", "macAddress": "48:e1:e9:52:04:a5", "chipType": "mt7682"}, "firmware": {"wifiMac": "f6:92:bf:9f:aa:f5", "version": "3.1.15", "userId": 659227, "server": "mqtt-us.meross.com", "port": 443, "innerIp": "192.168.1.80", "compileTime": "2020/04/15 17:12:08 GMT +08:00"}, "bindTime": 1619748064}}) for device(s) (1909187718487890801948e1e95204a5) that are not available in the local registry. Trigger a discovery to intercept those events.
2021-04-29 19:01:05 WARNING (MainThread) [meross_iot.manager] Received a push notification for a device that is not available in the local registry. You may need to trigger a discovery to catch those updates. Device-UUID: 1909187718487890801948e1e95204a5
2021-04-29 19:01:05 WARNING (MainThread) [meross_iot.manager] Received a push notification (Namespace.SYSTEM_ONLINE, raw_data: {"online": {"status": "1"}}) for device(s) (1909187718487890801948e1e95204a5) that are not available in the local registry. Trigger a discovery to intercept those events.
2021-04-29 19:01:05 WARNING (MainThread) [meross_iot.manager] Received a push notification for a device that is not available in the local registry. You may need to trigger a discovery to catch those updates. Device-UUID: 1909187718487890801948e1e95204a5
2021-04-29 19:01:06 WARNING (MainThread) [meross_iot.manager] Device Smart Garage Door Opener (#BASE:1909187718487890801948e1e95204a5) has been already added to the registry.
2021-04-29 19:01:07 WARNING (MainThread) [meross_iot.manager] Uncaught push notification Namespace.CONTROL_BIND. Raw data: {"bind": {"time": {"timezone": "America/Los_Angeles", "timestamp": 1619748064, "timeRule": [[1615716000, -25200, 1], [1636275600, -28800, 0], [1647165600, -25200, 1], [1667725200, -28800, 0], [1678615200, -25200, 1], [1699174800, -28800, 0], [1710064800, -25200, 1], [1730624400, -28800, 0], [1741514400, -25200, 1], [1762074000, -28800, 0], [1772964000, -25200, 1], [1793523600, -28800, 0], [1805018400, -25200, 1], [1825578000, -28800, 0], [1836468000, -25200, 1], [1857027600, -28800, 0], [1867917600, -25200, 1], [1888477200, -28800, 0], [1899367200, -25200, 1], [1919926800, -28800, 0]]}, "hardware": {"version": "3.5.0", "uuid": "1909187718487890801948e1e95204a5", "type": "msg100", "subType": "us", "macAddress": "48:e1:e9:52:04:a5", "chipType": "mt7682"}, "firmware": {"wifiMac": "f6:92:bf:9f:aa:f5", "version": "3.1.15", "userId": 659227, "server": "mqtt-us.meross.com", "port": 443, "innerIp": "192.168.1.80", "compileTime": "2020/04/15 17:12:08 GMT +08:00"}, "bindTime": 1619748064}}
2021-04-29 19:01:07 WARNING (MainThread) [meross_iot.manager] Uncaught push notification Namespace.SYSTEM_ONLINE. Raw data: {"online": {"status": "1"}}
2021-04-29 19:09:06 WARNING (MainThread) [custom_components.meross_cloud.cover] Device Smart Garage Door Opener (msg100) - Main channel reported online event.
2021-04-29 19:37:58 WARNING (MainThread) [custom_components.meross_cloud.cover] Device Smart Garage Door Opener (msg100) - Main channel reported online event.
2021-04-29 20:16:42 WARNING (MainThread) [custom_components.meross_cloud.cover] Device Smart Garage Door Opener (msg100) - Main channel reported online event.
2021-04-29 20:16:43 WARNING (MainThread) [custom_components.meross_cloud.cover] Device Smart Garage Door Opener (msg100) - Main channel reported online event.

msg100

wilkie1020 commented 3 years ago

The developer can correct me if I am wrong, but I recall reading it is not polled, but event based. I.e. when the door opens, it sends door was opened status, then times out.

Sorry, confirmed:

"No polling: the library is event-based. It saves bandwidth and makes the UI much more reactive."

You can manually poll if you want via some automation or node red I imagine.

joelzhl commented 3 years ago

You can manually poll if you want via some automation or node red I imagine.

I setup a periodic poll with node red once every 10 mins. After roughly around 10 hours, the state changes to unavailable. Polling it does not seem to refresh the state. The garage opener looks like it's still connected to the WiFi with around 60-70% signal as reported by the Meross app.

I then restarted the HA core and the garage opener immediately show up as closed instead of unavailable.

I'll keep the node red polling going to see if it's just a one off thing or something else. I remember this working perfectly before the 1.0 release even when the WiFi signal was much weaker at around 30%.

tarheelz commented 3 years ago

I remember this working perfectly before the 1.0 release even when the WiFi signal was much weaker at around 30%.

Confirming this observation. Prior to 1.0, this was a more reliable integration. While I have tried each of the 1.X versions, the lack of reliability forced me to to return to the earlier approach. I'm stuck now with the latest version as the per-1.0 versions are no longer available via HACS.

joelzhl commented 3 years ago

Just a little update and observation. I've keep the 10 mins node red poll running but the msg-100 still becomes unavailable after 1-2 days.

Interestingly though, two online event were logged at the same time that the device became unavailable. Maybe it's not handling the online events correctly.

Core Log

2021-05-02 19:53:45 WARNING (MainThread) [custom_components.meross_cloud.cover] Device Smart Garage Door Opener (msg100) - Main channel reported online event.
2021-05-02 19:53:51 WARNING (MainThread) [custom_components.meross_cloud.cover] Device Smart Garage Door Opener (msg100) - Main channel reported online event.

MSG-100 History

May 2, 2021
Became unavailable
7:53:52 PM - 14 hours ago
Was closed
7:53:51 PM - 14 hours ago
Became unavailable
7:53:45 PM - 14 hours ago
CTJohnK commented 3 years ago

I've noticed this with one of my 16 Meross smart plugs. I've reset it a couple of times, just this one unit is problematic. I reached out to Meross and they supplied the usual response. I then noticed the plug turning off and on at random times.

Waiting to hear from Meross about this issue.

I also picked up the Meross dual smart plug that is HomeKit compatible. I installed them using the HomeKit Controller. These also do not accurately show the status.

So it may not be the integration.

tarheelz commented 3 years ago

As a workaround inspired by @joelzhl , here is the super-simple Node Red flow I'm using. Works just fine to make this tolerable until the integration grows more reliable. This is a State node, so no periodic polling is involved. Once the state changes to "unavailable" for 10 minutes (or whatever you want to use), Home Assistant restarts. My garage then reappears. I'm having this happen about once every 36-48 hours.

[{"id":"fa0c1f25.69dcb","type":"tab","label":"Meross Restart Flow","disabled":false,"info":""},{"id":"43c4db7d.6ae584","type":"api-call-service","z":"fa0c1f25.69dcb","name":"Restart HASS","server":"e24c1b04.29ae78","version":1,"debugenabled":false,"service_domain":"homeassistant","service":"restart","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":420,"y":200,"wires":[[]]},{"id":"434f6eb3.2f12d","type":"server-state-changed","z":"fa0c1f25.69dcb","name":"Garage Goes Offline","server":"e24c1b04.29ae78","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"cover.garage_door","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"unavailable","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"10","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":170,"y":200,"wires":[["43c4db7d.6ae584"],[]]},{"id":"e24c1b04.29ae78","type":"server","name":"Home Assistant","addon":true}]

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

albertogeniola commented 3 years ago

Hi guys, any chance this gets better with v1.1.4? Unfortunately I don't have access to any MSG100 device at the moment, so I cannot reproduce the issue.

scannifn commented 3 years ago

Hi @albertogeniola I'msorry to tell you that at the end.... after waiting a lot of time... I decided to switch from this integration to another one. This custom component was made by another brains like you and compatriot like you and me (W Italia): https://github.com/krahabb/meross_lan We talked a lot together to optimize it. I also know that more or less you know each other because he has taken a lot of ideas from your projects. Today I can say that it works really well! Thanks also to you for what you have done and what you are doing. Ciao Alberto!!!

rhasselbaum commented 3 years ago

I reported this in #216 and will check to see if I can reproduce it in the latest version.

rhasselbaum commented 3 years ago

New version has been running for 4+ days now with no problem. I think this might be fixed. :smiley:

rhasselbaum commented 3 years ago

Sadly, I spoke too soon. This is still an issue.

albertogeniola commented 3 years ago

HI @rhasselbaum : can you provide some logs? What about the other entities? Are they available?

rhasselbaum commented 3 years ago

I will pull logs the next time it happens. I attached logs to issue #216 but those are from a few months ago.

I only have two garage door cover entities so I'm unable to see any others, but the garage door covers become "unavailable" independently at different times, if that's what you mean.

rhasselbaum commented 2 years ago

meoss_west_garage_door_becomes_unavailable.log

Here is a log that shows 1 of 2 garage doors (entity ID cover.west_garage_door_msg100_main_channel) becoming unavailable. According to history graph, it happened at 10:37:11 local time.

If I manually open or close the door, it suddenly comes back online in HA so I don't believe it is a wifi issue.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.