Skip to content

Node-RED

38 Topics 295 Posts
  • TEMPLATE NODES

    2
    0 Votes
    2 Posts
    968 Views
    neechN
    This doesn't even work: <div ng-repeat="n in [42, 42, 43, 43] track by $index"> {{n}} </div>
  • Node-red and Check_mk

    1
    0 Votes
    1 Posts
    977 Views
    No one has replied
  • modbus read with node-red

    6
    0 Votes
    6 Posts
    3k Views
    gohanG
    use the serial port node, it should be in node-red (if the modbus data is coming in on the serial port of course)
  • Node-Red ESPeasy and RF24 talking each other

    5
    0 Votes
    5 Posts
    3k Views
    S
    Ok I'm going to share my solution but mixs too many things. Node-red with MySensors module installation ESPEasy for nodemcus MySensors for Arduino NANO + nRF24L01 I will edit this post to add flow and codes.
  • Off the shelf motion sensor

    1
    0 Votes
    1 Posts
    920 Views
    No one has replied
  • 2 Votes
    7 Posts
    9k Views
    peerkersezuukerP
    Hello, I know this is an old post. But i am trying the script getting to work in combination with Domoticz. A did a little rebuild to 2.1.0, and i am getting a RGD light which i can switch to dimmable in Domoticz. I can select color and dim the strip but i am struggeling with the Speed (V_VAR2) and Mode (V_VAR1). How can I adress these two in Domoticz so it is picked up by the node? So i want to set the mode and or the speed from Domoticz to. // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #define MY_RF24_PA_LEVEL RF24_PA_MAX // Enabled repeater feature for this node #define MY_REPEATER_FEATURE #define MY_NODE_ID 9 #include <MySensors.h> #include <DHT.h> #include "FastLED.h" FASTLED_USING_NAMESPACE #if defined(FASTLED_VERSION) && (FASTLED_VERSION < 3001000) #warning "Requires FastLED 3.1 or later; check github for latest code." #endif #define DATA_PIN 3 //#define CLK_PIN 4 #define LED_TYPE WS2811 #define COLOR_ORDER GRB #define NUM_LEDS 60 CRGB leds[NUM_LEDS]; uint8_t gHue = 0; unsigned int currentSpeed = 0 ; int brightness = 96; unsigned int requestedMode = 0 ; int messageType = 0 ; int previousMessageType = -1; String hexColor = "000000" ; unsigned long previousTime = 0 ; void setup() { delay(1000); Serial.begin(115200); FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip); FastLED.setBrightness(brightness); FastLED.show(); } void presentation() { sendSketchInfo("FastLED Node", "1.0"); present(0, S_RGB_LIGHT, "Makes strip said color", true); } void loop() { switch (messageType) { //************** CASE 1 ************** case (1): Serial.print("Hex color override: "); Serial.println(hexColor); colorWipe(); messageType = 0 ; break; //************** CASE 2 ************** case (2): if ( (previousTime + (long) currentSpeed ) < millis() ) { if (requestedMode == 2) {rainbow(); FastLED.show(); } if (requestedMode == 3) {rainbowWithGlitter();FastLED.show(); } if (requestedMode == 4) {addGlitter(80);FastLED.show(); } if (requestedMode == 5) {confetti();FastLED.show(); } if (requestedMode == 6) {sinelon();FastLED.show(); } if (requestedMode == 7) {bpm();FastLED.show(); } if (requestedMode == 8) {juggle();FastLED.show(); } previousTime = millis(); } break; //************** CASE 3 ************** case (3): // Adjust timing of case 2 using non-blocking code (no DELAYs) Serial.print("Case 3 received. Speed set to: "); Serial.print(currentSpeed); Serial.println(" ms."); messageType = 2; break; //************** CASE 4 ************** case (4): // Adjust brightness of whole strip of case 2 using non-blocking code (no DELAYs) Serial.print("Case 4 received. Brightness set to: "); Serial.println(brightness); FastLED.setBrightness(brightness); FastLED.show(); messageType = previousMessageType ; // We get off type 4 ASAP break; } } void receive(const MyMessage &message) { Serial.println("Message received: "); if (message.type == V_RGB) { messageType = 1 ; hexColor = message.getString(); Serial.print("RGB color: "); Serial.println(hexColor); } if (message.type == V_VAR1) { requestedMode = message.getInt(); Serial.println(requestedMode); messageType = 2 ; Serial.print("Neo mode: "); Serial.println(requestedMode); } if (message.type == V_VAR2) { // This line is for the speed of said mode currentSpeed = message.getInt() ; Serial.println(currentSpeed); messageType = 3 ; Serial.print("Neo speed: "); Serial.println(currentSpeed); } if (message.type == V_VAR3) { // This line is for the brightness of said mode brightness = message.getInt() ; //if(brightness > 255) {brightness = 255;} //if(brightness < 0) {brightness = 0;} Serial.println(brightness); previousMessageType = messageType; messageType = 4 ; Serial.print("Neo brightness: "); Serial.println(brightness); } } //********************** FastLED FUNCTIONS *********************** void colorWipe() { for (int i = 0; i < NUM_LEDS ; i++) { leds[i] = strtol( &hexColor[0], NULL, 16); FastLED.show(); } } void rainbow() { // FastLED's built-in rainbow generator fill_rainbow( leds, NUM_LEDS, gHue++, 7); } void rainbowWithGlitter() { // built-in FastLED rainbow, plus some random sparkly glitter fill_rainbow( leds, NUM_LEDS, gHue++, 7); FastLED.show(); addGlitter(80); } void addGlitter( fract8 chanceOfGlitter) { if ( random8() < chanceOfGlitter) { leds[ random16(NUM_LEDS) ] += CRGB::White; } } void confetti() { // random colored speckles that blink in and fade smoothly fadeToBlackBy( leds, NUM_LEDS, 10); int pos = random16(NUM_LEDS); leds[pos] += CHSV( gHue + random8(64), 200, 255); } void sinelon() { // a colored dot sweeping back and forth, with fading trails fadeToBlackBy( leds, NUM_LEDS, 20); int pos = beatsin16(13, 0, NUM_LEDS); leds[pos] += CHSV( gHue, 255, 192); } void bpm() { // colored stripes pulsing at a defined Beats-Per-Minute (BPM) uint8_t BeatsPerMinute = 62; CRGBPalette16 palette = PartyColors_p; uint8_t beat = beatsin8( BeatsPerMinute, 64, 255); for ( int i = 0; i < NUM_LEDS; i++) { //9948 leds[i] = ColorFromPalette(palette, gHue + (i * 2), beat - gHue + (i * 10)); } } void juggle() { // eight colored dots, weaving in and out of sync with each other fadeToBlackBy( leds, NUM_LEDS, 20); byte dothue = 0; for ( int i = 0; i < 8; i++) { leds[beatsin16(i + 7, 0, NUM_LEDS)] |= CHSV(dothue, 200, 255); dothue += 32; } } With Regards, and thanks in advance. Peter
  • counter pulse for gas meter

    2
    0 Votes
    2 Posts
    2k Views
    mfalkviddM
    @ric63 welcome to the MySensors community! The power meter pulse sensor example should be a good base for a sketch. For saving to a file you could probably use the gateway log file, or export data from a controller.
  • Update my controller to MySensors 2.0

    5
    0 Votes
    5 Posts
    2k Views
    rcaridadeR
    Hi, The code that is here:"https://github.com/tbowmo/node-red-contrib-mysensors" as a problem with latest mysensors with arduino 1.6.13 and NodeRed v0.15.02. These line: pl = msg.nodeId + ";" + msg.childSensorId + ";" + msg.messageType + ";" + msg.ack + ";" + msg.subType + ";" + msg.payload; Should be: pl = msg.nodeId + ";" + msg.childSensorId + ";" + msg.messageType + ";" + msg.ack + ";" + msg.subType + ";" + msg.payload + "\n"; This way the message gets to the node, the first one doesn't get there. Thanks, Rui.
  • Is it possible to connect an Ethernet Gateway to Node-Red and share it?

    2
    0 Votes
    2 Posts
    2k Views
    mfalkviddM
    Yes it can be done. There are some cases described in the forum. You could start with these https://forum.mysensors.org/topic/1965/nodered-injected-between-domoticz-and-mysensors https://forum.mysensors.org/topic/3150/use-node-red-to-allow-multiple-connections-to-ethernet-gateway/ https://forum.mysensors.org/topic/700/node-red-as-controller/
  • Flow to turn SerialGateway into MQTT-SerialGateway

    13
    4 Votes
    13 Posts
    8k Views
    Mathieu ChambonM
    I think you made one mistake in the flow, you need to remove "To MQTT" in the Topic item and put "To MQTT" in the Name item else all the message go in "To MQTT" topic. I have start to make the same flow and I found this post, thanks for the job.
  • Use Node-Red to Allow Multiple Connections to Ethernet Gateway?

    13
    0 Votes
    13 Posts
    9k Views
    Q
    So I had a go at using SOCAT and although it's working it doesn't seem to like multiple connections on the TCP port. Although it will accept the connection it seems to output data from Serial>Ethernet is a round robin kind of way. Reason I had two connections to it was to ensure the pipe was always read as the other post it was mentioned if the pipe isn't cleared there would be memory problems and I noticed not all the data was getting to all the TCP connections.. Anyway here is the code if you want to check it out. Socat sudo socat PTY,link=/dev/ttyS81,mode=666,group=dialout,raw TCP-LISTEN:40501,fork,reuseaddr & sudo socat PTY,link=/dev/ttyS82,mode=666,group=dialout,raw TCP-LISTEN:40502,fork,reuseaddr & NodeRead [{"id":"e9998a90.266cc8","type":"serial-port","z":"a89027d9.b1ef08","serialport":"/dev/ttyS82","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","newline":"\\n","bin":"false","out":"char","addchar":true},{"id":"ee7d4fbe.58c5f","type":"serial-port","z":"a89027d9.b1ef08","serialport":"/dev/ttyS81","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","newline":"\\n","bin":"false","out":"char","addchar":true},{"id":"50839f8a.fbcaa","type":"debug","z":"a89027d9.b1ef08","name":"Full-Debug","active":true,"console":"false","complete":"true","x":595,"y":575,"wires":[]},{"id":"d5b18044.18e1f","type":"tcp in","z":"a89027d9.b1ef08","name":"MYS-GW-OUT","server":"client","host":"192.168.1.150","port":"5003","datamode":"stream","datatype":"utf8","newline":"\\n","topic":"MYS-GW-Output","base64":false,"x":103,"y":963,"wires":[["db05059b.37e4e8","4f3b7e79.739e6"]]},{"id":"c462686d.bb5a78","type":"catch","z":"a89027d9.b1ef08","name":"","scope":null,"x":387,"y":574,"wires":[["50839f8a.fbcaa"]]},{"id":"9fdda3da.86eb7","type":"debug","z":"a89027d9.b1ef08","name":"PayloadDebug","active":true,"console":"false","complete":"payload","x":584,"y":666,"wires":[]},{"id":"db05059b.37e4e8","type":"serial out","z":"a89027d9.b1ef08","name":"ControllerOne-Out","serial":"ee7d4fbe.58c5f","x":619,"y":875,"wires":[]},{"id":"75f6db75.bba3c4","type":"serial in","z":"a89027d9.b1ef08","name":"ControllerOne-IN","serial":"ee7d4fbe.58c5f","x":103,"y":894,"wires":[["6bbbe087.e897"]]},{"id":"6bbbe087.e897","type":"tcp out","z":"a89027d9.b1ef08","host":"192.168.1.150","port":"5003","beserver":"client","base64":false,"end":false,"name":"MYS-GW-IN","x":605,"y":949,"wires":[]},{"id":"4f3b7e79.739e6","type":"serial out","z":"a89027d9.b1ef08","name":"ControllerTwo-Out","serial":"e9998a90.266cc8","x":625,"y":1044,"wires":[]},{"id":"73b94814.883c88","type":"serial in","z":"a89027d9.b1ef08","name":"ControllerTwo-IN","serial":"e9998a90.266cc8","x":104,"y":1045,"wires":[["6bbbe087.e897"]]},{"id":"8121ed9b.ba597","type":"tcp in","z":"a89027d9.b1ef08","name":"ControllerOne-TCP-Out","server":"client","host":"127.0.0.1","port":"40501","datamode":"stream","datatype":"utf8","newline":"\\n","topic":"","base64":false,"x":151,"y":731,"wires":[["9fdda3da.86eb7"]]}]
  • "DHCP" (I_ID_REQUEST) Handler

    2
    2 Votes
    2 Posts
    2k Views
    C
    This looks awsome and exactly what i was after. I use ESP8266's with NRF24L01+'s as relay nodes connecting back to a cloud mqtt server but have had to statically assign id's. Thanks!!!
  • "Sketch Time" (I_TIME) Handler

    5
    0 Votes
    5 Posts
    3k Views
    crankyC
    Ah cool :) So yes, make the user do it. I like the sound of that. Time stinks. Only thing I can say about that is, "Never again."
  • Flow to turn SerialGateway with MQTT-FLOW to EthernetGateway

    2
    1 Votes
    2 Posts
    2k Views
    fetsF
    :thumbsup:
  • "Sketch Config" (I_CONFIG) Handler

    3
    0 Votes
    3 Posts
    2k Views
    crankyC
    Not yet, but that was my goal tomorrow. My GH account is https://github.com/jwcrawley It'll be obvious when I add in the repo :) I'll also mention it here. Sincerely, Cranky
  • "Sketch Version" (I_SKETCH_VERSION) Handler

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • "Sketch Name" (I_SKETCH_NAME) Handler

    2
    1 Votes
    2 Posts
    2k Views
    crankyC
    Debugged, changelog 13 jan2016. Added 3rd field, for version. Fixed \n being passed and messing up CSV file. [{"id":"8e3e8f02.7fd0c","type":"mqtt-broker","z":"63842e72.893f78","broker":"localhost","port":"8883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"15","cleansession":true,"willTopic":"","willQos":"0","willRetain":null,"willPayload":"","birthTopic":"","birthQos":"0","birthRetain":null,"birthPayload":""},{"id":"2b18ee58.b63042","type":"mqtt in","z":"63842e72.893f78","name":"Rename sensor in file","topic":"MySensors/+/255/3/0/11","broker":"8e3e8f02.7fd0c","x":147,"y":347,"wires":[["34a4252.48ed9da"]]},{"id":"34a4252.48ed9da","type":"function","z":"63842e72.893f78","name":"message to edit","func":"var splitTopic= msg.topic.split(\"\\/\");\nmsg.edit = {col1:splitTopic[1] , col2:msg.payload}; \n// msg.edit carries over the next 2 nodes to \"find edit and replace\" function node\nreturn msg;","outputs":1,"noerr":0,"x":349,"y":346,"wires":[["2032129a.b17cfe"]]},{"id":"2032129a.b17cfe","type":"file in","z":"63842e72.893f78","name":"","filename":"/root/leases.file","format":"utf8","x":525,"y":347,"wires":[["2c70d9c7.e8d2ee"]]},{"id":"2c70d9c7.e8d2ee","type":"csv","z":"63842e72.893f78","name":"","sep":",","hdrin":"","hdrout":"","multi":"mult","ret":"\\n","temp":"col1,col2,col3","x":110,"y":418,"wires":[["f17d2f12.1254c8"]]},{"id":"f17d2f12.1254c8","type":"function","z":"63842e72.893f78","name":"find edit and replace","func":"for(var i = 0; i < msg.payload.length; i++){\n if( msg.payload[i].col1 == msg.edit.col1 ){\n msg.payload[i].col2 = msg.edit.col2;\n return msg;\n }\n if( msg.payload[i].col1 > msg.edit.col1 ){\n msg.payload.splice(i,0, {col1: (i-1), col2: msg.edit.col2, col3: \"\"}) ;\n }\n}\nreturn msg;","outputs":1,"noerr":0,"x":279,"y":418,"wires":[["c2871f53.c8caa"]]},{"id":"55feab8a.9176ac","type":"file","z":"63842e72.893f78","name":"","filename":"/root/leases.file","appendNewline":true,"createDir":false,"overwriteFile":"true","x":641,"y":419,"wires":[]},{"id":"7263dd71.ca4b94","type":"debug","z":"63842e72.893f78","name":"","active":true,"console":"false","complete":"false","x":631,"y":458,"wires":[]},{"id":"c2871f53.c8caa","type":"csv","z":"63842e72.893f78","name":"","sep":",","hdrin":"","hdrout":"","multi":"one","ret":"\\n","temp":"col1,col2,col3","x":446,"y":418,"wires":[["55feab8a.9176ac","7263dd71.ca4b94"]]},{"id":"852f49a7.0d18c","type":"comment","z":"63842e72.893f78","name":"I_SKETCH_NAME handler ([0-255];255;3;0;11;[name])","info":"Whenever a sensor announces itself to the network as [any];255;3;0;11;[name from presentation],\nit modifies field 2 for that appropriate sensor. \n\nThe resulting modification is then saved.","x":310,"y":456,"wires":[]}]
  • nodered "injected" between domoticz and mysensors

    21
    3 Votes
    21 Posts
    16k Views
    V
    @tbowmo May you please share your node-red set up by exporting your setup as flow? If feasible for you

30

Online

11.7k

Users

11.2k

Topics

113.1k

Posts