bytespider / Meross

Investigating the Meross/Refoss MSS310 Smart Plug and getting these devices to communicate with our private MQTT brokers
113 stars 19 forks source link

Device mss425e won't connect to AP, falls back to pairing mode #73

Closed darthdule closed 11 months ago

darthdule commented 1 year ago

Hi,

I have a mss425e switch. I can read the information with

/meross-info --verbose --include-wifi

The setup command will restart the device twice and is still not connected to the wifi, remaining in paring mode

/meross-setup --gateway 10.10.10.1 --wifi-ssid XXXXX --wifi-pass XXXXX --mqtt mqtts://192.168.XXX.XXX:8883

also tried

/meross-setup --gateway 10.10.10.1 --wifi-ssid XXXXX --wifi-pass XXXXX --mqtt mqtts://192.168.XXX.XXX:8883 --wifi-cipher 6 --wifi-encryption 7 --wifi-channel 6 --verbose

My SSID has space characters, tried to put the ssid in "" or '', but it is not the problem.

Two hours ago I paired it succesfully with the meross paring app, but was giving this way a try with meross LAN, because I did not get the other implementation "meross local broker" to run.

best greetings

bytespider commented 1 year ago

@darthdule, my WIFI SSID also has spaces so I agree it's unlikely that.

Can you try without --wifi-cipher 6 --wifi-encryption 7 --wifi-channel 6

darthdule commented 1 year ago

I did this already when I started, tried those parameters later, even with bssid. Had approx. 25 tries. BUT, it happened exactly one time that my router saw it and assigned an IP for like 1s then it disappeared and the device restarted again. There are always two restarts of the device with ~20s in between.

Is there a way to completely factory reset the meross device? There was one issue here where some wifi commands were passed with meross setup cleaning some internal wifi AP list of the meross device. But this command failed with timeout error when running and resulting in a device reset to pairing mode again.

bytespider commented 1 year ago

I did this already when I started, tried those parameters later, even with bssid.

You did say that, sorry, i read your message quickly.

If you press and hold the button for approx 10s, that puts it in pairing mode which is effectively factory reset.

The device reboots after the Appliance.Config.Wifi command, the second resetting would be the built in failsafe to go back to pairing if it cannot connect.

Which version of the tools are you using? If your device is new enough it may need the latest version which sends the Appliance.Config.WifiX message instead

darthdule commented 1 year ago

I bought the meross device 3 years ago. I guess it is not part of the newer generation device just because of its age, but I don't know...

I installed the tools yesterday, so they are up to date.

I tried to connect to a different router with the same result.

What I don't understand correctly. If the MQTT broker in HA cannot be reached by the device, will it go to failsave, too?

I checked my MQTT config in HA carefully and it seems OK. I use ZigBee2MQTT, so mosquito MQTT is working. But non-SSL port 1883 is used by ZigBee2MQTT, not the 8883 SSL, so it is not 100% proof for working mosquito setup.

bytespider commented 1 year ago

Meross devices that I have come across tend to require SSL. The Home Assistant MQTT broker doesn't allow the username convention Meross use https://github.com/home-assistant/addons/pull/2259 and they disabled anonymous login https://github.com/home-assistant/addons/issues/2623

I would strongly advise not using the HA Mosquitto addon. I have been using https://github.com/hassio-addons/addon-emqx which I've had no problem with. No idea why they decided to make a whole new addon rather than accept the community fixes.

Going back to pairing mode (Green and Yellow alternating) only usually happens if it can't connect to the WIFI the first time, but that may depend on the firmware. Green flashing usually indicates it's connected to WIFI but can not get the MQTT messages it requires to finish setup.

darthdule commented 1 year ago

Hi, thanks for your answer. I will look into emqx tomorrow. I fear that I will break something else, like Zigbee2MQTT. I am not sure if it is worth the effort. I cant find the link right now, but I swear I read somewhere that my device is working, but dont know the mqtt setup.

bytespider commented 1 year ago

I also have it set up for Zigbee2MQTT. I used this guide to let me know what areas needed to be reconfigured after installing EMQX. https://smarthomescene.com/guides/setting-up-emqx-mqtt-broker-in-home-assistant/

darthdule commented 1 year ago

Thanks for the link, I took a quick look and if my headache goes away in the evening, I will try setting it up :-)

bytespider commented 1 year ago

I dont think it's mentioned in the article, but make sure you stop and disable the mosquito add-on before your start.

darthdule commented 1 year ago

Thank for the info, but I got stuck at the first step, basically. The EMQX home assitant Add-On is only available for x86 platforms and not ARM, hence no RPI support :(

Edit: Ignore the last sentence. I just realised my RPI4 which is running for ~3 years is armv71, which is 32-bit. There is ARM based EMQX, so I guess that the HA addon will work on armv8 and above. OK that's a good reason to setup a new system on the RPI4.

What does it mean for this issue? I will setup EMQX after I migrated to a new system, which will take some time. Then we will know what is the issue with the device.

bytespider commented 1 year ago

I'm confused as I have it on my RPI 4 using the HA EMQX addon RPI 4 is aarch64 which the HA addon supports.

darthdule commented 1 year ago

I am running debian Buster 32-bit with HA supervised, but EMQX ARM builds are 64-bit.

This raises my motivation to set up a new system. I would like to go with some Hypervisor like proxmox and run HA OS as VM, but RPI is too weak, so I may switch to some NUC.

bytespider commented 1 year ago

Gotcha, I assumed you were using HA OS.

Since you're running your own OS you could set up your own Mosquitto broker and test the devices against that, and either migrate HA to use that broker. Instructions to set up can be found here, though I'm not sure how relevant they are as there have been new versions of Mosquitto https://github.com/bytespider/Meross/wiki/MQTT

Lenovo M900's go for pretty cheap on EBay. I've been meaning to move HA over to it but I need a proper full day with no family to complain XYZ isn't working.

While this article refers to x86, you may be able to use it as reference https://wiki.debian.org/Migrate32To64Bit.

darthdule commented 1 year ago

Thanks for all the useful links, but I just ordered a Beelink s12 pro with n100 CPU like a minute ago :-) Performance is really comparable with the old 6500T for example which I found in a lot of those M900s, but has 16GB RAM and 500GB SSD. While searching for reviews for the mini PC came across a lot of posts where people are using it with the exact same setup I am planning You can even replace the Wifi card with a Google coral m.2. Since I will connect to Ethernet and have a separate BT Antenna Dongle, it is great 👍

So I will just move on and use HA OS in a VM on the NUC. With a little bit of luck I can try EMQX this WE.

bytespider commented 11 months ago

@darthdule if you have any new information please feel free to reopen this issue.

darthdule commented 11 months ago

Will get back, soon. I recreated my whole server with a new Intel NUC and proxmox. Running EMQX, since a few days...