No announcement yet.

HS4 and Meross using Node-RED (Plugs and Garage Door Opener) - Local control

  • Filter
  • Time
  • Show
Clear All
new posts

    HS4 and Meross using Node-RED (Plugs and Garage Door Opener) - Local control

    I recently got the Meross MSG100 garage door opener working with HS4 and Node-RED- full Local control, no cloud.

    This also works for Meross plugs

    I created a fork of . The owner dehsgr has now merged my changes in so they will be part of the node red flow library soon ( If not you can manually update files from github

    There are a few different projects related to node-red and Meross. Great work from all of them

    Meross can be connected to HS4 in 5 different ways
    1) If the Meross device supports it, you can use TUYA/Tasmota plugin
    **Garage door doesn't support this

    2) using smartthings and link to hs4. Does not require a smartthings hub. I did this for a bit. I also unplugged my smartthings hub and unlinked it from account

    3) Using full MQTT.
    This requires faking the Meross MQTT server with your own (examples use Mosquito)
    Instructions to do it this way can be found here

    4) Simulating the app MQTT api calls made by the Meross app and sending/receiving them via Meross cloud
    Instructions to do it this way can be found here

    5) Simulating the app MQTT api calls locally (only needs internet for initial setup)

    The instructions will focus on #5 Simulating the app MQTT api calls locally

    I wanted to still be able to use a pin number when asking google to open the garage door. This allows the Meross app to continue to work, and Meross<->google link, but also local control through HS4 Node-RED


    1) install hs4 node red
    2) install
    **Note if garage door change aren't there yet, copy manually from github
    You want version >= 1.1.0

    3) use the meross-iot project to inspect the api calls made from Android/iOS
    4) using meross_sniffer you will need to determine the following values sent from the app.
    1. change your Meross password to something temporary
    2. install python3 (if you don't have it already)
    3. install pip run: sudo apt install python3-pip
    4. install meross-iot run: pip install meross-iot --upgrade OR run: pip install meross_iot==
    5. go to the path mentioned in the message "WARNING: The scripts meross_api_cli and meross_sniffer are installed in 'XXXXXXXX' which is not on PATH.
    6. run: python3 meross_sniffer
    7. login with meross_sniffer using your temporary Meross credentials
    8. Open the Meross app on Android/iOS
    9. Press some buttons in the app. ON or OFF, open or close
    10. In meross_sniffer you with see the JSON payloads
    11. Grab the following values from the JSON payloads
    - messageId
    - token (sign)
    - timestamp

    5) create a Meross node (plug or garage) in node-red and add the configurations from step 4(8)

    6) inject the Meross node with msg.payload =
    - true for ON or Open
    - false for OFF or Close
    - non-boolean payload returns state

    7) test it out

    8) change your Meross password back

    Click image for larger version  Name:	merossHS4NodeRed.png Views:	0 Size:	36.5 KB ID:	1453835

    [{"id":"2217c56c.71908a","type":"tab","label":"Flow 4","disabled":false,"info":""},{"id":"906541a5.1ef6","type":"inject","z":"2217c56c.71908a","name":"Close","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":430,"y":60,"wires":[["65270999.550b88"]]},{"id":"cda4f8ff.dea558","type":"debug","z":"2217c56c.71908a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":910,"y":160,"wires":[]},{"id":"440fe234.58db8c","type":"inject","z":"2217c56c.71908a","name":"Open","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":410,"y":280,"wires":[["bf06a588.a50178"]]},{"id":"f63a30ff.2ca3b","type":"inject","z":"2217c56c.71908a","name":"Get State","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"'state'","payloadType":"str","x":640,"y":60,"wires":[["90d52c46.307a2"]]},{"id":"90d52c46.307a2","type":"smartgarage-control","z":"2217c56c.71908a","confignode":"27eb8008.a260e","name":"Meross Garage Door","ip":"192.168.1.XXX","x":700,"y":160,"wires":[["cda4f8ff.dea558"]]},{"id":"2d28b913.419606","type":"hs-device","z":"2217c56c.71908a","name":"HS4 Virtual Device","device":0,"server":"","feature":0,"reportonstartup":false,"x":130,"y":80,"wires":[["8629368a.0e3738"]]},{"id":"8629368a.0e3738","type":"switch","z":"2217c56c.71908a","name":"","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"100","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":210,"y":160,"wires":[["65270999.550b88"],["bf06a588.a50178"]]},{"id":"65270999.550b88","type":"change","z":"2217c56c.71908a","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":140,"wires":[["90d52c46.307a2"]]},{"id":"bf06a588.a50178","type":"change","z":"2217c56c.71908a","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":200,"wires":[["90d52c46.307a2"]]},{"id":"27eb8008.a260e","type":"meross-config","name":"Meross","timestamp":"","token":"","messageid":""}]

    Thanks dev120v for doing this write-up. I've ordered a few plugs and hope to get it working over the weekend. I have a couple of Z-Wave problem spots and hope to use WiFi plugs instead.
    "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)


      no problem. Just be aware the way I did it (option 4) doesn't have auto update status. So if you turn it on with the meross app, node red/hs4 wont know right away. I use it for meross garage door, but I also have a zwave tilt sensor on the door that I get status update

      option 1 to 3 give u status update


        Thanks for the tip on status. For things like this I normally define a virtual device and then use homebridge/homekit to control it.
        "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)


          I would setup a timer to update status if needed. You can probably just set it to 10 min or even more and also update at nodered boot

          I am not sure how the plugs behave after power outage etc.

          Let me know the model number of the ones you got after testing so we can update docs. Meross seems to have a fairly standard api for plugs


            dev120v - I can't seem to get the meross_sniffer to work. I can log into the Meross app with the credentials OK and I can control the MSS110, but when I try to connect using the meross_sniffer I get the following error: An error occurred while retrieving Meross devices.

            From looking at the Python code, it seems like a pretty generic error. Any ideas?

            "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)


              did you run this before...

              pip install meross-iot --upgrade

              the sniffer references that project


                Yes, the sniffer is actually part of the repo, so it's installed. What version of the meross-iot library are you using? I installed the latest which is

                "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)


                  I dont have it installed now, but I just used that command

                  maybe copy the from github and specifically run that one


                    I am using the repo version, not the one from pypi. I created a venv, cloned the repo, did "pip install -r requirements.txt", and finally "pip install .". What OS did you run this on? I'm running on MacOS 10.14.6. I also tried running the example code from the library and I get SSL certificate errors.
                    "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)


                      I used a linux usb key, you should be able to do the same thing if MacOS is the issue?
                      or do it in a VM

                      I specifically used kali linux, but it shouldnt matter.

                      I will go thru the steps again tonight. You can also use wireshark or charles proxy or ssl app to intercept the json, but those were more difficult.

                      the meross-cloud nodered flow would also give all that info I think.


                        I fixed the instructions. I had the command as python, should be python3. You should not need to manually copy any files from github