No announcement yet.

Starting with this post - MQTTServer and Alexa

  • Filter
  • Time
  • Show
Clear All
new posts

    Starting with this post - MQTTServer and Alexa

    Currently i have node-red running on the same server as HomeSeer 3. Is possible to know when MQTT failed to respond or when Node-red failed?


    It is not clear as to exactly what you are asking. MQTT is a protocol like HTTP, RTSP etc. A protocol is the language and there is no such thing as a failure to respond.

    Node-Red and mcsMQTT are able to use MQTT and each will be a client. If either of these client's go offline as indicated by their failure to respond to the MQTT Broker/Server ping's then the Broker will deliver a message to all clients that are interested indicating that the specific client is no longer responding. This is referred to the Last Will and Testament. In your context Node-Red or mcsMQTT will receive this message if either go offline. If both are offline then the Broker will deliver the message when a client comes online. Events canbe triggered in both Node=Red and mcsMQTT/HS with the Will messages to know when specific MQTT client go online or offline.

    MQTT protocol has what is called Quality Of Service (QOS). Think of it as using USPS. You can send 3rd Class mail and USPS will likely deliver it. This is QOS=0. You can send Priority mail with tracking so you will know that it was delivered (QOS=1). You can send Certified with signature receipt so you know it was received and acknowledged (QOS=2). Each increasing QOS level comes at increasing resource cost so one does not blindly send all mail at the highest QOS. There is no indication provided by the MQTT Broker to a client if a message was delivered or not. It is all managed internally by the Broker to provide the requested QOS. QOS level is selected on a message by message basis, just as USPS level of service is specified.

    In most MQTT communications there is a command and a status response. HS/mcsMQTT will send a command on one Topic to ask Node-Red to control a widget. Node-Red will respond with a status or acknowledge on another Topic. The same occurs in the other direction. Events can be setup in either Node-Red or HS/mcsMQTT to look for the expected status response.


      Thanks Michael, sorry I was not clear. I have node-red alexa remote that announce on alexa various hs events that I created. Node-red is connected with your plug in. Occasionally, node-red or the plug in fails. I would like to figure out when this happens so I can restart node red or the plug in. I was trying to figure if there is a way to know when one of those fails.

      By the way, I read your manual, well made, thanks for that.

      Sent from my SM-G973U1 using Tapatalk


        Note that since HomeSeer now communicates directly with node red you could possibly skip the use of MQTT. Or, if you think one is not working, try something with the direct link. Now, if HomeSeer runs an event which users MQTT but no result is detected, you can try changing something in HomeSeer with a direct communication to node red, meaning without MQTT. If it works, your MQTT Broker may have a problem. If it doesn't work it could be node red.

        Where is your MQTT Broker installed? Is it also on the same computer as HomeSeer?
        Karl S
        HS4Pro on Windows 10
        242 Devices
        56 Z-Wave Nodes
        37 Events
        HSTouch Clients: 3 Android, 1 iOS
        Google Home: 3 Mini units 1 display


          Both Node-red and MCQTT Broker are on the same machine. I'm running HS3 .


            mcsMQTT will collect message history for you if enabled on the General tab. I have mine set at 10 days. This will show you the messages that HS/mcsMQTT sends to Node-Red. HS records the events triggered in the HS log. An event without a message is a failure of HS and mcsMQTT to communicate. You can setup a similar log in Node-Red that records each time a message is received from HS/mcsMQTT. You can go a step further and have Node-Red acknowledge the message with a MQTT message back to HS/mcsMQTT on a different Topic. This will also show up in the mcsMQTT History so you have a record of both send and acknowledge at one place.

            You can automate the process with your event that starts the sequence. Add an action to the event that waits, say 30 seconds, followed by an evaluation if the acknowledge from Node-Red was received and then to clear the value received from Node-Red so that it is ready for the next event initiated by Node-Red.

            I think you have all the tools you need in your detective toolbox.