Skip to content

MerossInformation

shodge12 edited this page May 27, 2019 · 10 revisions

How the Meross Devices work...

High Level Overview


When first powered up (or when caused to re-set manually), the Meross devices are in pairing mode. When in this mode, the Meross device becomes a WiFi AP with a address of 10.10.10.1. After joining the device is expecting initialization of the following parameters:

MQTT Server

Security Key

Local WiFi SSID

Local WiFi Password

These items are set via typical http Post methods to the device.


Assuming the device successfully connects to the local WiFi AND then connects to the local MQTT server, the device will be available to talk MQTT messages.

You talk to the devices on the topic: /appliance/(unique device number)/subscribe

The device posts information and status to: /appliance/(unique device number)/publish

The flow of communication is a MQTT message to the device and a acknowledgement, followed by a status post. Here is a example flow:

/appliance/1712281825467829030134298f151c4a/subscribe

{
    "header":{
	  "from": "/appliance/HaPi/MeRossDriver",
	  "messageId": "c6f84153be3df5a265d3d46c6b5425bc",
	  "method": "SET",
	  "namespace": "Appliance.Control.ToggleX",
	  "payloadVersion": 1,
	  "sign": "e023823e71876a7e74b53ccf787b5b69",
	  "timestamp": 1558365723
            },
    "payload":{
	     "togglex":{
		      "channel": 1,
		      "onoff": 1
		      }
	     }
}

/appliance/HaPi/MeRossDriver

{
    "header":{
            "messageId":"ead205bb7eb3f3f1e5531ae34156851a",
            "namespace":"Appliance.Control.ToggleX",
            "method":"SETACK",
            "payloadVersion":1,
            "from":"/appliance/1712281825467829030134298f151c4a/publish",
            "timestamp":1558923636,
            "timestampMs":929,
            "sign":"2a624a3817f0dc34d8077fad4e876748"
            },
    "payload":{}
}

/appliance/1712281825467829030134298f151c4a/publish

{
    "header":{
            "messageId":"7bd9e5894677a4dc16a1ecc29b1c0a90",
            "namespace":"Appliance.Control.ToggleX",
            "method":"PUSH",
            "payloadVersion":1,
            "from":"/appliance/1712281825467829030134298f151c4a/publish",
            "timestamp":1558923636,
            "timestampMs":979,
            "sign":"9cbee69dd3b6ce34e9098374d46b175f"
            },
    "payload":{
            "togglex":{
                    "channel":1,
                    "onoff":1,
                    "lmTime":1558923636
                    }
            }
}

The connection requirements...

The Meross devices require a SSL connection to the MQTT server. Using Mosquitto the following .conf file sets the Mosquitto broker to use TLS and non TLS for use of Meross devices and other non-TSL devices....

# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example

pid_file /var/run/mosquitto.pid
bind_address 192.192.XXX.XXX
per_listener_settings true

port 1883
persistence true
persistence_location /var/lib/mosquitto/
allow_anonymous false
password_file /etc/mosquitto/p1.txt
#log_type debug
connection_messages true

log_dest file /var/log/mosquitto/mosquitto.log

include_dir /etc/mosquitto/conf.d

listener 2001
#log_type debug
cafile /etc/mosquitto/certs/m2mqtt_ca.crt
certfile /etc/mosquitto/certs/m2mqtt_srv.crt
keyfile /etc/mosquitto/certs/m2mqtt_srv.key
require_certificate false
allow_anonymous true
tls_version tlsv1.1

There are plenty of web based tutorials on how to create CA and Server Certificates....

Once you have proper certificates loaded, you can test communication with

mosquitto_sub -h 192.168.XXX.XXX -p 2001 -t "/#" --cafile /etc/mosquitto/certs/m2mqtt_ca.crt --tls-version tlsv1.1

If this does not error, it should show any communication from the Meross device.... If you get a error - the certs are likely your problem and these need to be corrected before the device will communicate properly through Mosquitto and this code...

Clone this wiki locally