Announcement

Collapse
No announcement yet.

Node Red intermittently disconnects from homeseer 4

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Node Red intermittently disconnects from homeseer 4

    I have node red installed via npm on windows 10. I use task scheduler to start it after an automatic windows login. I'm currently using HS 4.1.4.0 on the same Win 10 machine.

    I have one flow that monitors an HS device to post TTS to alexa. The HS device shows yellow with a full list of HS devices and the alexa end shows green/ready. But no action occurs when the monitored HS device changes.

    HS shows a log error "Posting to webhook failed: Unable to connect to the remote server"

    To resolve this I can try restarting the flow which worked once. Twice I've had to go to task scheduler and end the task, then rerun it. Last failure before today was 5 days ago.

    This item is not mission critical but surprisingly it has relatively high WAF


    Any suggestions or thoughts?
    HS4 Pro on Shuttle NC10U, Win10; Z-NET
    Number of Devices: 1005
    Number of Events: 293

    Plug-Ins: BLLock, DirecTv, EasyTrigger, Honeywell WiFi Thermostat, Marquis monoprice Amp, MeiHarmonyHub, PHLocation2, Pushover 3P, UltraM1G3, rnbWeather, Worx Landroid, Z-Wave

    External applications: Homebridge-homeseer, Geofency, EgiGeoZone.

    #2
    jmaddox
    This item is not mission critical but surprisingly it has relatively high WAF
    That is what I picked out. Do yourself a favor and separate Node-RED and MQTT from Windows and put them on a Raspberry PI 3 or 4. A small price to pay but gain peace of mind.
    The only servers I have seen thus far running together on the same box are those running in Docker containers. Some may discourage you about that too but remember that if you continually save your work you can spin up a Docker container in minutes! (The only stuff they consume is RAM if you have many of them running) Even the HomeSeer container runs really smooth


    Eman.
    TinkerLand : Life's Choices,"No One Size Fits All"

    Comment


      #3
      I have the exact same problem on the same platform. Man, I really hoped that I had a stable TTS system with node red. Have a Raspberry PI running on my gate controller, I suppose I can try node red on it. Nothing is ever simple is it?

      Comment


        #4
        I plan to watch if this occurs on the same frequency; perhaps the fix would be a simple as restarting Node Red on a set schedule. I also have Jon00's log monitor installed. I may use that to send a push notification when HS shows an error connecting to Node Red
        HS4 Pro on Shuttle NC10U, Win10; Z-NET
        Number of Devices: 1005
        Number of Events: 293

        Plug-Ins: BLLock, DirecTv, EasyTrigger, Honeywell WiFi Thermostat, Marquis monoprice Amp, MeiHarmonyHub, PHLocation2, Pushover 3P, UltraM1G3, rnbWeather, Worx Landroid, Z-Wave

        External applications: Homebridge-homeseer, Geofency, EgiGeoZone.

        Comment


          #5
          Just for giggles, I installed Node-Red on my RaspberryPi that is running my gate controller. Thanks for the suggestion Eman. This PI sits idle most of the time so I thought what the heck... Anyway its been running for a couple of days now and has been rock solid. I had intended to do as you did and monitor it and restart when necessary. I may just leave it as is.

          Comment


            #6
            While you troubleshoot, you can try restarting your flows at a regular intervals in the interim. A POST request to flows will do. You can use an inject node and select inject once, then select the interval in hours to fire it. I use a node called cronplus to manage the schedule but inject will do.

            1) Inject node with set interval > 2) stick the message headers in a function node behind the inject > 3) Set an http request node behind that - change it to POST and set URL: http://localhost:1880/flows (or whatever IP/port, just put /flows at the end). It will inject the headers and restart the flows on your schedule. Optionally, set a node at the end to send you a text, email, etc to notify you that the flows were restarted. I always put a debug node on the tail end of everything to boot.


            Code:
            msg.headers = {};
            msg.headers['Cache-Control'] = 'no-cache';
            msg.headers['Content-Length'] = '0';
            msg.headers['Content-Type'] = 'application/json';
            msg.headers['Node-RED-Deployment-Type'] = 'full';
            return msg;
            You can eliminate or adjust headers as needed, but those work for me. For more info on "Node-RED-Deployment-Type" header see: https://nodered.org/docs/api/admin/methods/post/flows/
            See also: https://cookbook.nodered.org/http/set-request-header

            You may even find that the trouble isn't with the service, but rather a websocket error, problem with a flow, or the like.

            Comment


              #7
              Great information. Thanks for sharing.

              Comment


                #8
                Originally posted by pcburcham View Post
                While you troubleshoot, you can try restarting your flows at a regular intervals in the interim. A POST request to flows will do. You can use an inject node and select inject once, then select the interval in hours to fire it. I use a node called cronplus to manage the schedule but inject will do.
                As soon as I posted that my RaspberryPi was rock solid, I noticed a few hiccups and decided to use your method of restarting the flows periodical. I have it set to restart the flows every hour on the half hour. It APPEARS to be working but would like some sort of feedback that says something like "the flows restarted". I am a Node-Red Noob. How can I do that?
                Thanks.

                Comment


                  #9
                  You could set up a HomeSeer Virtual Device with a last restarted time, or you could use an MQTT topic. Where do you want this notification to go? I would be looking at an event in HomeSeer. Once Node Red stops reporting, asking it to say it has stopped has been equated to taking your own pulse to see if you are alive, and calling emergency services when you are not. Maybe create a flow which reads an MQTT payload and reports back a new one. If you do not get the new topic back after x seconds, report an issue? Just set the MQTT QoS to 0 so it is only read when sent and not on fresh bootups. Basically you have to ask it if it is there and assume not is you get no answer. Maybe make the MQTT payload: NodeRed\Bueller
                  Karl S
                  HS4Pro on Windows 10
                  1070 Devices
                  56 Z-Wave Nodes
                  104 Events
                  HSTouch Clients: 3 Android, 1 iOS
                  Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

                  Comment


                    #10
                    Originally posted by ksum View Post
                    taking your own pulse to see if you are alive, and calling emergency services when you are not.
                    If you figure out how to manage that one ksum you be darn sure to let me know

                    I didn't put that much thought into it. I use a node called node-red-node-email: https://flows.nodered.org/node/node-red-node-email
                    Page has instructions for configuration, including a link to assist Gmail users with app specific passwords. I use an app password with Gmail account configured with it and it works great. If you specify msg.topic it will serve as your email subject and msg.payload your email contents. You can set these in a change node and place it in your flow followed by the email send node.

                    Click image for larger version

Name:	2020-09-21_15-03-35.png
Views:	307
Size:	19.5 KB
ID:	1420881Click image for larger version

Name:	2020-09-21_15-07-45.png
Views:	231
Size:	6.4 KB
ID:	1420882​​​

                    If I don't get an email I start looking for issues. ksum has gotten me to thinking about more comprehensive ways of reporting and if I dig into that I'll amend it here.

                    Comment


                      #11
                      See, pcburcham I would be sending those emails to a folder that I then end up ignoring. I need something to tell me it needs my attention, not that it doesn't. So I would have HomeSeer contact Node Red. Then look for some way to know that Node Red replied back. Many ways to do this. Have an Event fire in HomeSeer which sets virtual device called Node Red Checker to a status of "Bueller" then set a timer. If it is still "Bueller" after 10 seconds, or whatever experimentation suggests is reasonable, send an email with the subject "Node Red stole the Ferrari." On the Node Red side a flow would watch for the device's status to change. If it changes the flow would change it back to "Present" and then no email would be sent. Frankly, if I had this issue I would look at having HomeSeer reboot the Raspberry Pi that I have running Node Red, which should correct the issue. But I have yet to have a problem with the RPi and Node Red. If a reboot didn't help, then I would send the email. That, however, would probably mean the SD Card was corrupt. (I need to get a USB Drive working on that thing to keep this from happening. But I digress...)

                      I use HomeSeer to send email and use a Gmail account specific for the house. So I get emails when the robot vac needs the bin emptied, and also one when someone has emptied it so we don't double our efforts. Other emails occur for other items as well. Also use Jon00's plugins to send me an email when HomeSeer or a plugin has an available update.
                      Karl S
                      HS4Pro on Windows 10
                      1070 Devices
                      56 Z-Wave Nodes
                      104 Events
                      HSTouch Clients: 3 Android, 1 iOS
                      Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

                      Comment


                        #12
                        Originally posted by ksum View Post
                        I need something to tell me it needs my attention, not that it doesn't.
                        That's a fair point. I like the the idea of a virtual device and communicating the status in HS. May start out and let mcsMQTT create that device and act on its state.

                        Comment


                          #13
                          I first started to suggest using MQTT but then realized that you would need some way to know if a message came in as well. I am not strong with mcsMQTT received topics outside of setting HomeSeer devices. If you can act on an incoming topic a set amount of time after sending a topic, then go that route and don't use a virtual device. If you need to create a virtual device anyway, then use a status change and use 2 systems instead of 3. I would add more nodes to a flow in order to use fewer system. But that is how I think. Fewer links in the chain is less prone to something going wrong.

                          If you do use MQTT I would not set the QoS to any retained value.
                          Karl S
                          HS4Pro on Windows 10
                          1070 Devices
                          56 Z-Wave Nodes
                          104 Events
                          HSTouch Clients: 3 Android, 1 iOS
                          Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

                          Comment


                            #14
                            As I said, I am a Node-Red noob. I have some reading to do. Unfortunately, the folks I work for expect me to WORK for them to get paid. I will have to get to this when I can. Thanks for all of the food for thought.

                            Comment


                              #15
                              Originally posted by Marty_B View Post
                              Unfortunately, the folks I work for expect me to WORK for them to get paid.
                              Good lord man! We need to find you a new place of employment ASAP!

                              Comment

                              Working...
                              X