Node Red Modules

node-red-nodesAll now published – though I now use a function for thermostatic functions so for me the last one is a bit redundant – but big-timer is my all time favourite I’m using all over the place and I use esplogin to watch out for units logging in – like this...

typicalI’ve even put them in their own column so you know which ones to avoid Smile

So assuming you know how to grab Node-Red nodes and are familiar with them – go to your .node-red directory. 

In my case it is /root/.node-red  and enter “npm install node-red-contrib-xxxxx” where xxxx is the name of the node – and that pretty much does it – the good thing about grabbing nodes this way, if the author does an update – you just do that again and you get the latest version.

I’ve not yet put most of these in repositories but then once you have them – you have the source code anyway… if you don’t want them sitting in their own “scargill” section – go (carefully) into the .js file, find “scargill-input” and change it to… well, “advanced-input” or similar – restart Node-Red and Bob’s your uncle.

We need a lot more people writing nodes – so many possibilities…

Facebooktwittergoogle_pluspinterestlinkedin

26 thoughts on “Node Red Modules

  1. Pete

    Outstanding work!.

    I think that you may be missing a trick watching for ESPs dropping off the network. MQTT supports Last Will & Testament that will notify you via a MQTT topic.
    In your code,
    1) setup the MQTT topic for LWT (eg: "esp1234/lwt") - make sure that use set the Retain flag to True and the data will be something like "offline"
    2) On start, publish a message to the lwt topic (eg: "esp1234/lwt") such as "online". Again - make sure that use set the Retain flag to True

    At anytime, a different client can subscribe to the lwt and see the status of that ESP.
    MQTT will publish the "offline" message to the lwt topic if it misses several? heartbeats. Obviously NodeRed can pick this up.....

    Tony

    1. Hmm, that is wary of further thought. I know of LWT but never really thought of using it. Of course what one does after discovering a unit has gone offline is another matter.

      For the ESPs - what works for me is that I have them regularly look for the heartbeat and respond. I don't do much with that now, after a while I used to restart - but that really is not the answer. So, today they look to see if they still have an IP address and if not (that could be after powerup - or it could be in the event of a failure) - they attempt to connect to the router - and then to subscribe or re-subscribe to the topics. This appears to work perfectly. I have a test unit on the bench - and it hasn't been turned off for some time - through horrendous WIFI failures, mains power failures etc, eventually it gets back online. At one point I thought it might be the little ESPs might be part of the WIFI problem but after turning them all off and still having the same issue, I'm now confident they are blameless - and utterly reliable - so much so that I've removed the reset last resort as it simply isn't needed.

  2. Hi Pete,

    I have installed a few of your nodes but when I start node-red they are nowhere to be seen, would you have any ideas please...

    Thanks
    Stuart

    1. I use the Raspberry Pi as root - so my .node-red is at /root/.node-red - where yours is will be depending on how you log in and how you installed node-red.

      I think my instructions suggest that what I did was to go into the .node-red directory and then install - in which case the nodes should end up in /root/.node-red/node-modules/node-red-contrib-XXXX where XXXX is the name of the node- for example node-red-contrib-bigtimer.

      If they are not there - then they may not show up. You can simply move them from wherever they are.

      Does that help? Of course after any change like that you'll have to restart node-red - and again that depends on how you installed node-red - if you used my script - then it's simply:

      pm2 restart node-red

      1. Hi Pete,

        I have the modules in the same directory as the other modules but when I launch node-red the extra modules are missing ?

        Thanks
        Stuart

  3. Hi,
    I have just deleted everything node-red, I have node-js installed, and I am running windows 7, what would be the best way to install node-red Pete because if I remember rightly when I first installed it some time ago I got lots of errors.

    Thanks
    Stuart

    1. Hi there

      I don't think I've ever installed Node-Red on a PC - only on the Raspberry Pi 2 - my script for that works out of the box on The Rasperry Pi 2.

      So to give this a shot on my 64-bit Windows 10 installation I went here.. http://nodered.org/docs/getting-started/installation.html

      I grabbed the node-v0.12-7-x64.msi and installed it - defaults - no problem.
      I then grabbed a DOS BOX (cmd.exe) as administrator - and planted myself in drive D: - in the root.

      npm install -g --unsafe-perm node-red

      That worked pretty much as it would on the Raspberry Pi - installing no problem. Having a white CMD window wasn't my best move - as some of the instructions flew by in yellow - but they didn't look like errors. Soon I was back at the command line.

      I didn't have a clue what to do here so I just typed node-red
      and I was in.

      http://127.0.0.1:1880/

      That worked just as I would expect it to and Node-Red came up - so I cancelled out of that (control-C in the DOS box)... and installed my timer.

      As it happened, I had my users directory on Drive D: so I checked in d:\users\peter and sure enough - a .node-red directory !!! This was getting better.

      I went into that directory in the DOS box.

      npm install node-red-contrib-bigtimer

      That worked. I started up node-red again - this time from the current directory.

      Sure enough - no BIGTIMER - my directory was there - in node-red under node-modules - but not appearing.

      Turns out the files were all sitting here.

      C:\Program Files\nodejs\node_modules\npm\node_modules

      So I moved my directory in there...

      I went into that new bigtimer directory and typed....

      npm install

      I noted the usual gripe about lack of repository and licence field...

      and I ran node-red

      And... nothing - no Pete's module. All I can say at this point (this was all done in a bit of a rush to help you out) that this is UTTERLY inconsistent with the experience on the Raspberry Pi....

      I will ask the right questions in the Node-Red group unless anyone in here has an instant solution.

        1. WELL !!! It turns out that I must've had an old version in there - I was writing to the wrong place.

          I just happened to notice when node-red started up - some reference to c:\users\peter\appdata\roaming\npm\node)modules\node-red\settings.js

          So I went off in search.

          C:\Users\Peter\AppData\Roaming\npm\node_modules\node-red\node_modules

          THAT is where I needed to install the directory for BIGTIMER - as it happens I just moved it across to there without any further install - started up NODE-RED and .... BOBS your uncle - my timer works - it even asked if it was ok to use the location and filled it in for me. I have no idea how Windows knows where I am but probably worth checking.

          SO it all works under Windows - you just have to find the right place to install it. NOW all I have to do is figure out how to make Node-Red come up on power up - it uses so few resources there's no reason not to have it running even if I can't immediately thing of a pressing requirement... I'm sure now will appear. Hope you have the same luck armed with this info. And with that I'm off to visit friends and probably drink too much wine.

  4. I think I have a bit of a strange problem also because if I am in a cmd window and navigate to the node-red root folder that was created by the installer, typing node-red is not recognized, if I type just red then my Jetbrains Webstorm Editor opens because it is associated with .js files.......

    Thanks
    Stuart

    1. interesting - well you've seen exactly what I did and node-red works a treat. While waiting to see why my BIGTIMER installation was an abysmal failure, I just added an inject node - and put a message in it - put in the email node - filled in the details - pressed the button and voila - it sent me an email.

      Now- I'm running node-red in a DOS box.... which of course closes when you close the dos box - just as it would close when you close a terminal on the PI - so in addition to figuring out why my node isn't working - and hence presumably any others i try to install - I want node-red to turn on at power up and run as a service. NO idea how to do that. Anyone up to providing instructions?

  5. I remember now the only way I could get node-red to run some time ago was to use this sites installer:

    http://patrickbay.ca/blog/?p=462

    and if you open the launcher in a text editor it uses red.js to start node-red, the only thing is it is bundled with an old version and the latest version is a Milestone update....

    Thanks
    Stuart

  6. Hi Pete,

    If you start node-red with -v after it it tells you that it has failed to load certain modules and explains that because they are related to a raspberry pi they will not be loaded, so if I load node-red on to a pi your modules would load....

    cheers
    Stuart

  7. I have just tried installing API Benchmark from npm as a test, and that too installs to a folder on my root drive called "node-modules" but no sign of it after a restart...

    Thanks
    Stuart

  8. Hi, I have just downloaded your thermostat node and it was put in the c:\node_modules folder and it didn;t show after a restart, I then moved the folder to here:

    C:\Users\Acestu\AppData\Roaming\npm\node_modules\node-red\node_modules

    restarted and hey presto the scargill section and thermometer node, could this be a windows environment variable path problem ?

    Thanks
    Stuart

    1. Thanks Stuart - I tried that and nssm and though I can in fact now easily run Node-Red in a window - I'm having no luck at all running it as a service. It simply won't start up and nssm comes back some complaint about an unexpected pause. Shame as otherwise it's working a treat.

  9. Hi Pete,

    A few weeks ago somebody in one of my many subscibed forums told us about a free windows program that enabled you to make any windows app a service, I can't for the life of me remember what it was called or which forum, if I remember I will let you know, I will have a bit of a search also.

    Thanks
    Stuart

    P.S.
    I bought Netio for my iphone the other night, I have an old Rasp Pi in the cupboard, what OS would you put on it to use a server Pete ?

  10. Hi Pete, there is something odd about your nodes I'm afraid. I run NR in embedded form and your nodes don't appear after a normal installation - e.g. doing an npm install in the root of my application. I've always noticed this about your original node but thought that as you'd published these, they would be OK. I'll try and find some time to track down the issue.

Comments are closed.