-
Notifications
You must be signed in to change notification settings - Fork 2
Setup
Setting up the Node-Red flow to function in your environment is a multi-step process.
Before the flow will operate with the Meross devices, the MQTT broker must be configured for TLS. My experience is based on Mosquitto as it existed on ver 1.5.8. In this version multiple ports with different security models are possible. As posted here is a copy of my Mosquitto.config file:
# 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
This sets up Mosquitto to use tls1.1 on port 2001 AND non tls traffic on port 1883. Port 1883 uses a password file for authentication and port 2001 uses no authentication other than the tls protocol to function. Certificates for the server and must be correct. Once configured properly, from the MQTT machine the command:
mosquitto_sub -h 192.168.XXX.XXX -p 2001 -t "/#" --cafile /etc/mosquitto/certs/m2mqtt_ca.crt --tls-version tlsv1.1
should run without error. Note - correct for your IP, port and path for your CA certificate. Note simply running without error here is the goal. Don't expect to see Meross traffic - yet...
To set up the flow to function properly, you must be aware of the setup process for the Meross device. Obviously the device works on wireless. On initialization, the Meross device becomes a wireless AP. The host pc must connect to this AP to begin the process. The SSID is typically Meross_xxxx. The device will supply the host an IP - typically 10.10.10.2 and it will exist at 10.10.10.1. This Meross connection will last through the configuration process. My target was a Raspberry Pi which had its Ethernet connection connected to my local area net (it contains my MQTT broker) and I used the Pi's wireless connection to connect to the Meross AP during config. You do not have to use this connectivity. It is possible to only use a wireless connection and move back and forth between the Meross AP and your local network AP.
It is assumed you know how to cut and paste the flow into your Node-Red environment. To specifically set up the flow, two steps are required:
-
The MQTT in and out modules must be locally configured to you local broker. MQTT IP, Port, User ID, and Password to get a connection which works to your local broker. If you want to use tls secure connection, then the certificates are also required. Note my configuration allows both tls and non tls at different broker ports. If you are connected to the MQTT brokers network, and you have added your credentials - the Node-Red green dot will appear on working MQTT nodes. There are 4 MQTT nodes in the flow - two inputs on the left and two outputs on the right. Do not change the topics in the MQTT nodes...
-
Configuration of the flow parameters is done through the 'Meross System Parameters...' node. Note: These parameters aree used during the pairing of the Meross node. Open this up to expose the following configuration parameters:
- Wireless_SSID - This is the SSID of your local wireless network. This is used during the pairing of the Meross node.
- Wireless_Network_Password - This is the password for your local wireless network.
- key - This is a unique to your network private key between you and your Meross devices. Note - this same key will be used for all your Meross devices. You may set this to something simple such as 1.
- MQTT_Address - This is the IP of the local MQTT broker.
- MQTT_Port - The port number for the MQTT broker.
- MQTT_Server_From - This field is used as the 'from' field when sending commands to the Meross Devices. If you want to follow my lead you can use something like '/appliance/(your Node-Red machine name - i.e.Pi)/MeRossDriver'
Once you have this all configured, the MQTT set up, your ready to configure your device.