Skip to content

Implementation Code Walk

shodge12 edited this page Jun 3, 2019 · 9 revisions

Overview

The code walk is broken up across 6 major sections:

  1. Initialization ([Top most row of nodes])
  2. Meross Configuration (Auto Config...)
  3. Meross Send Command (Local Meross / MQTT Testbench)
  4. Status Driver (This is the Homeseer Driver Status Interface...)
  5. Homeseer Command Interface (Homeseer Interface)
  6. Debug (Debug Routines)

1. Initialization The initialization routine starts by firing a packet each time Node-Red starts OR the flow is saved by a 'Deploy'. This causes the following system parameters to be saved as flow variables:

MQTT_Address
MQTT_Port
key
Wireless_SSID
Wireless_Network_Password
MQTT_Server_From

The Wireless_SSID and Wireless_Network_Password are obsecured via hash before transmitted to the Meross device. The last nodes try and read a file saved version of the ids array. On each modification of the array, a copy of the ids array is saved as a local file to handle power interruptions.

2. Meross Configuration

The Meross Configuration section starts with the 'Auto Config...' node and proceeds down the page to the 'Hardware Information must be requested prior to config... (if desired)' node. The configuration has a automatic mode which is used normally. It is set up to ping 10.10.10.1 at a interval of every two minutes. The following node determines success of the ping. If the ping was successful, it is assumed we are in Meross 'Pairing Mode'. The pairing mode may be forced by using the input mode 'Manual Trigger Config'. The 'Rate Limit' node keeps from re-entering 'Pairing Mode' while it has started. Configuration is accomplished by posting 2 messages via http to the Meross device. Those two messages move the initialization parameters to the device. After successful reception of the posts, the Meross device reboots, attempts to connect to the local Wifi, and finally logs into the local MQTT server. Note you can enable the two debug nodes ('HTTP Response' and 'WiFi ACK') to monitor the Meross responses to the config mode transmissions.

3. Meross Send Command

4. Status Driver

5. Homeseer Command Interface

6. Debug

Clone this wiki locally