Node-red and mosquitto together - some fiddling about

Node-red is amazingly powerful, and relatively easy to do things with. I've now set up Node-red on the RPi3 server, and also the MQTT broker mosquitto.

Here's the Node-red browser display:

Node-red display in my browser
I've configured:
  • An MQTT Broker input node, connected to...
    • This is subscribed to the topic "test/myTopic" 
  • A debug node, configured to display the msg.payload
    • Which can be viewed in the "debug" tab on the right pane
  • An HTTPRequest node, configured to the URL /myTestHTTPRequest, connected to...
    • i.e. accessed via http://server.local:1880/myTestHTTPRequest
  • A JavaScript function node, which creates a msg.payload with the JS date/time, connected to...
  • An HTTPResponse node, which returns the input date/time string to the HTTP requester 
And astonishingly, it all works! Very cool. 

I am very impressed by the range of node types available, including 
  • Various protocol inputs/outputs (MQTT, tcp, udp, HTTP)
  • Lots of function operations, that can transform the input to an output
  • Social: Email and twitter input/output (!)
  • RPi GPIO input/output - cool!!
  • File-based storage operations (tail, changed, write)
I'm going to have to see how others have managed scheduling events, like lights on/off. Presumably it's a separate MQTT command issuing tool!

Comments

Popular posts from this blog

Replacing Coffee Machine Pump (Dualit Espressivo)

Multiple SHT30 sensors on a single I2C bus with Sonoff-Tasmota

NodeMCU + Tasmota code + SHT30