Meross devices (power plus, strips, etc.) are great but they use the Meross MQTT cloud. The cloud is fine but it has its limitations and it is not under your control.
Some great people managed to configure Meross devices so that they connect to a local MQTT broker. Yay! These heroes are:
Once you have your device connected to the local MQTT you end up with some quite cryptic topics and associated messages. This is the reason I wrote https://github.com/wsw70/meross-local-mqtt
The intent is to use pyscript (thanks a lot to @craigbarratt for his wonderful work (https://github.com/custom-components/pyscript)) to configure and manage these devices. It is intended to work as a set&forget - the only thing you need is to add to your configuration.yaml a new device.
Please see the README for the details and let me know if you find it useful, what to improve etc. Thanks!
Hi
I have 8 meross switches for lights. (mss510h and mss520h). Will they work with local mqtt?
Suddenly today all my Meross devices become unavailble (with meross integration) and I don’t know how to fix this
I do not know but I would just try if I were you (I have only power switches (relays)). There is no reason it does not work, and if it does not @bytepider is absolutely great helping to understand why.
There are no risks: if you cannot connect then you just re-pair it with the Meross utility.
Hi, I have difficulty to understand where and how I could configure the following. Can you elaborate please?
I already have mqtt installed and working for another integration but although I read the files I still not sure for all the steps I should follow in order to implement this.
Set up the Certificates
Make sure that your CA Root uses a different Common Name to your server and the common name for the server is the server IP address
##Create the Certificate Authority
openssl genrsa -des3 -out ca.key 2048
openssl req -new -x509 -days 1826 -key ca.key -out ca.crt
##Create the certificate signing request. It's important when asked for the FQDN in these next step to use the IP or domain name of the machine your MQTT instance is on.
openssl genrsa -out server.key 2048
openssl req -new -out server.csr -key server.key
##Create the final certificate
openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 360
The good thing with this is it also lets me see the power and energy from MSS310’s and so hopefully i can then make another sensor of either of those with a template like i do with my wemo insight, not got it working yet.
In order to have your MQTT broker manage encrypted traffic, it needs to have a set of certificates in place. This is very similar to a web server setup.
I use mosquitto and this is my config for the TLS section
listener 8883
socket_domain ipv4
tls_version tlsv1.1
allow_anonymous true
cafile /mosquitto/config/cert/ca/ca.crt
# Path to the PEM encoded server certificate.
certfile /mosquitto/config/cert/broker/broker.crt
# Path to the PEM encoded keyfile.
keyfile /mosquitto/config/cert/broker/broker.key
require_certificate false
You create these files according to the steps you described
What I wrote is quite artisanal but allowed me to understand the kind of messages the Meross devices send - but if there is something more integrated I will contribute there.
Thanks for pointing it out!
EDIT: this is an excellent implementation! Thanks!
Thank you all but I am not able to perform all the steps required to make it work. The worst is that my meross devices are not working anymore and I don’t know why.
I have the HA Mqtt addon, but I am not familiar with all the requirements needed to be done. I am reading the papers but most of them make no sense to me.
It’s a Meross MSS310 on the plug socket so i do have feedback of sorts i.e. the power usage. Now that template is working you could throw that into a blueprint or nodered
I have HA running in a docker, and the MQTT broker (mosquitto) running separately in another docker. This allows me for more control and reuse of the MQTT broker for other stuff (I use it as a bus for some other software I wrote).
Unfortunately I have no idea how hassio works (including its own MQTT broekr), I never used it.
Yeah i have a second MQTT broker running nativity on another pi and bridging to Hassio’s addon it was the only way i could do it. The link in my previous post explains how i did that.
@Dizzyikea Out of curiosity - is there a particular reason why you run hassio as opposed to having a native HA installation on the pi? (or running it in a docker)
It used to run on a old rpi b and that seemed to have the least overhead for such a slow device. I could then easily take a snapshot and do dev stuff on a VM on my main PC as Rpi B took about 20 minutes to reboot. It’s on a rpi 4b now so as much as that is not an issue now i just stuck to what i knew.