Assuming the new install of mosquitto is at v2.0.x then you will need to explicitly edit the config file to allow any connections not from localhost.
As part of a move to a more secure out of the box posture, the default config only allows connections from localhost.
Details in the release notes: https://mosquitto.org/blog/2020/12/version-2-0-0-released/
You need to add the following to the /etc/mosquitto/mosquitto.conf
listener 1883 allow_anonymous true
Depend on the nodes in use, some nodes just pass forward msg.payload others pass the whole msg object so you can sometimes get away with passing things as msg.mydata etc. The other option is to store it in flow context either with a change node or function node.
If you're only interested in seeing the current value at a glance and don't have something like node-red-dashboard set up, you might be interested in node statuses.
Documentation; scroll down to "Adding Status"
Basically, you can set some text that will appear under a given node. Run your current flow through a function node with something like this:
const lastValue = msg.payload.someValue
node.status({text: lastValue.toString()})
return msg
The status will appear under the node and will always be updated to the current value. Much easier than digging through the debug console.
If you're not scared of a little programming, I was using NodeMCU's running some simple C code in Arduino Studio with sensors, then updating over a MQTT network and graphing in node-red. Pretty much this
https://www.hackster.io/13699/autonomous-weather-station-with-esp8266-90f8b3
Great entry point if you're a beginner.
Oh I'm new too, I only just started node-red a few months ago and started using context this month, but it's been very useful. Here is the documentation for context: https://nodered.org/docs/user-guide/context
You have a few options. All of node red's data will be stored under ~/.node-red(of whatever user you install ed as), so you can copy that folder after deploying node red on your new server. You could also export and import your flows from your old server to the new one. You can also make a project to store everything on github and download it to your new server. I haven't played around with that yet, that looks to be the best way for mass deployment.
For the web interface you could use the Node-RED Dashboard, and the GPIO pins should already be controllable on the Raspberry Pi through one of this nodes.
Think your best bet might be the trigger node for this and flow variables
If you have a function node that over right a flow variable ever time it gets a fresh message from the doors etc
You could then use the trigger node to fire after x amount of time and or msgs received
Then you could progress the flow and call the flow variable that has the last most up to date message this could be done by a trigger or delay node kicking off
https://nodered.org/docs/user-guide/writing-functions
With flow variables there is noting to say the connections between nodes need to be wired as in
Door opens --> save to flow variable
Another flow
Delay node (wait 5min) ---> function node requesting info from the flow variable ---> adjust light etc
If you follow https://nodered.org/docs/getting-started/raspberrypi
And do a fresh install on the pi following the bash install once that's done all required packages should be installed at the end of the above site it describes how to set node red to auto start on pi boot
Once that's all set up just find your pis IP address and pop in the port 1880 at the end eg 192.168.1.123:1880 should get into node red then from any machine on the network or localhost:1880 on the pi itself
Is the debug node dumping the full msg object or msg.payload? Also you can check context variables in the right side toolbar, little drop down near debug icon should show context https://nodered.org/docs/user-guide/editor/sidebar/context you do need to hit refresh after a var is set/updated (not as reactive as debug output)
Unrelated, drop the var keyword, msg variable already exists as its passed in from the preceding node so that will nite you if you continue that pattern elsewhere.
It’s included in the settings file. For raspbian, I believe the default location on is in a hidden directory at ~/.node-red/settings.json
You can rearrange the palette order to your liking there, following this guide
There is a whole section in the docs for this. Did you even look? Googling "node-red function" is literally all you had to do.
https://nodered.org/docs/user-guide/writing-functions
You can even return multiple outputs or do it asynchronously.
Check your settings.js file
https://nodered.org/docs/user-guide/logging
Your looking to see if the metrics option is turned on
metrics
When set to true, the Node-RED runtime outputs flow execution and memory usage information.
Did you try looking at https://nodered.org/?
Fwiw, there are a few different Hue modules in the Palette Manager, and no Insteon ones. A Google search for "Node-RED Insteon" shows that there are some people using them together.
There used to be A Developer's guide to Node-RED on Coursera.
Had a quick look but couldn't immediately find it on Coursera, maybe they took it down. Good luck!
The direct link to the app is https://play.google.com/store/apps/details?id=com.okhiroyuki.redmobile
The curated part is having a collection of nodes that are phone-specific preinstalled and in my experience, all the preinstalled nodes worked and had decent instructions in the info panel. Obviously YMMV but I thought that was nice.
Hi,
according the IR-commands: I use a Harmony one, the codes are included there. Even special ones to turn just on or just off. I think some Denon codes also work.
Rs232 is a real physical port at the back of the device.
For RS232 I connected: RS232(-—-)USB(-—-)Raspberry Pi In detail: I use USB to RS232 male cable + RS232 female to female adapter. I first used a USB to Rs232 male but It didn’t worked for me, because the pins for sending and receiving were wrong. I also have read that FTDI chip are the best. This cable (+ adapter) works for me: https://www.amazon.de/dp/B006AA04K0/ref=pe_27091401_487024491_TE_item
Software: Raspberry pi: Its important to put the node-red user into dialout group
Node-Red: I use serial node (its included into node-red) to connect between the device and node-red. You need to setup the hardware settings the right way: I will show you the setting later by screenshot.
After this is done you can send and receive data from Marantz SR 6004 using different commands. I found the command list here, sometimes you need to put a „/r“ behind the commands to make it work I think. l http://www.remotecentral.com/cgi-bin/mboard/rs232-ip/thread.cgi?110
I process the data to make it usable and send/receive it via MQTT. In e.g. HomeAssistant you can use MQTT buttons, switches … to integrate the device. You can also set and(!) get all the states of the device (selected source, volume, on or off state), therefore its really reliable even if home assistant restarts.
I passed the value along to dweet.io and used the dweet node to stream the incoming command
I'm trying to share my applet, https://ifttt.com/applets/70232574d-if-you-say-light-it-up-then-make-a-web-request
https://nodered.org/docs/user-guide/projects/
Make a git repo to store your flow, and have a CI pipeline handle deploying changes to all your nodes.
That's about as specific or a recommendation as possible without knowing more about your application stack.
> how did you do the hdmi-cec stuff?
Everything I know about CEC I learned from this blog post. Once you’ve installed cec-client
and figured out the right cec frames to send to your tv, you can simply use an exec
node to fire them.
> I also have a wireless Xbox360 controller. Does that work with Bluetooth?
Looks like you need an adapter, but doable: https://retropie.org.uk/docs/Xbox-360-Controller/
Not sure how the connect/disconnect detection would work though.
Most flows should migrate without any issue, I've not really had any problems migrating old systems over the last year or two. If you want to be super careful though, first step would be to back up your current flow. Spin up a new version on your personal computer and them import the flow. That should give you the chance to play around and make sure that everything works before fully upgrading the Raspberry Pi version.
I'd recommend using the install / upgrade script here: https://nodered.org/docs/getting-started/raspberrypi in case you've not already got the helpful start / stop scripts.
It does get pretty daunting haha I don’t think there’s anything wrong with using the list, just try and best conform to the syntax node red wants and you should be good. This page helped me a ton with context variables https://nodered.org/docs/user-guide/writing-functions
Most of your posts here asking for help are covered in the 'getting started guide/cookbook' for node red and many of the 'intro to node-red' youtube tutorials will cover these basic questions or at least give you a foundation where you can ask questions that more clearly show what you are actually trying to do. For example, you say you want to send a message "only once every x seconds and avoid every other duplicate" but your example sounds like you really want to 'Drop messages that have not changed value', which is an example node-red walks you through how to do in the cookbook.
https://nodered.org/docs/user-guide/
https://cookbook.nodered.org/
Check that your settings.js
file tells Node-RED to use the filesystem for context storage.
The behavior you're seeing looks like it's using the memory storage instead (which is the default for some reason).
Please follow the naming guide lines for nodes in the packaging documentation
>Naming
>
>If you wish to use node-red in the name of your node please use node-red-contrib-
as a prefix to their name to make it clear they are not maintained by the Node-RED project. Alternatively, any name that doesn’t use node-red as a prefix can be used.
Here is the basic idea though -- You put a switch node on your TCP input that matches both the "on" event and the "off" event from your Creston. Then a change node that sets msg.payload to true or false. You previously had it modifying "msg.Lamp on" which is not the field that your TP-Link node is looking at -- It only looks at msg.payload.
My "for fun" configuration was: ssh with google authenticator on raspberry pi
https://www.raspberrypi.org/blog/setting-up-two-factor-authentication-on-your-raspberry-pi/
Router NAT on non standard SSH port plus fail2ban on pi http://www.fail2ban.org/wiki/index.php/Main_Page
then tunneling ports with ssh client - so on my phone I put localhost:1888
It does (as of yesterday) in the scorecard feature.
But by then is already too late as you've already published it to npmjs.org.
Please delete it from npm and repush with the correct name.
You can download the latest version of Node.js (including npm) from https://nodejs.org/en/download. You’ll need one of the ARM binaries.
You can then install it following the instructions here.
I don’t think it’s available from the package manager you’re using, but I could be wrong.
Check out the catch node
https://nodered.org/docs/user-guide/handling-errors
I think if your telegram fails to send it should throw an error of some sort you can use the catch node to pick up on this error and then get it to send you a sms via twilio or other 3rd party sms node
I have this etc up for aDB when the ip changes the MySQL node trows an error and then the catch. Ode sends a message via telegram to say the ip has changed could work maybe for your application
Also would you mind sharing the flow you are using to send an image via telegram that's pretty nice idea Cheers
Assuming you are using a function node. The code is JavaScript. You have made too 'return' calls. The second one will never be run. As that's not how JavaScript works. What ever was in the msg variable will be returned.
Normally you would want to work out what to send in payload. Then add payload to message. And return msg.
So
let msg = {payload : "hello world"}
return msg
In the code you show The payload you are creating is JSON. The { } brackets define an object. It looks like your trying to make an array. Arrays are in [ ] brackets.... In arrays just comma separate your values in in square brackets. In curly brackets you have an object that needs a comma separated list of { key:value } pairs:
msg = {payload : [arr1,arr2,arr3]}
//or
msg = {payload : {key1:val1,key2:val2,key3:val3}}
Which one you need and what the keys and values are is upto your use case
If you need multiple outputs from a function, then perhaps check this out:
https://nodered.org/docs/user-guide/writing-functions#multiple-messages
Can't guarantee but using the "in" comparator instead of the "is" comparator should work. See here: https://folio.ink/mxYi2E
But you could as well just use regex like so:
https://folio.ink/qZ33wF
did you run
npm install --global --production windows-build-tools
as explained in the documentation: https://nodered.org/docs/getting-started/windows#installing-nodejs-windows-build-tools
thanks for that. i will check the offical Nodered forums for help as well.
I am following this documentation https://nodered.org/docs/getting-started/docker#dockerfile-which-copies-in-local-resources to build the GIT code into a container
+1 on this.
For personal use I just use the "nodered/node-red" image from the docs and it's always worked with no issue. It'll be a lot easier for folks to help, if you specify what exactly doesn't work.
I mean I've never used Docker personally, but I have used Node-RED with Github... IDK if this is something basic you've already tried, but one thing to point out is that Node-red doesn't speak to Git "out of the box," you have to enable the "projects" feature to do that.
So if you have a Git repo that your Node-RED instance isn't reading, I would check that first?
Otherwise you might have to give more specifics of what exactly you're doing and what you expect to happen as a result....
You could create a function node and add an JavaScript condition.
Something linke this:
if (msg.payload === „time“){ msg.payload = time(); } return msg
Im currently on mobile, so the Syntax can have errors. But you can find more informations here: https://nodered.org/docs/user-guide/writing-functions
When u don't know how to use a node I would recommend these 2 steps: 1. Google the name of the nodered module, they always have a webpage on which u can find info on how to use the node itself (most of the time): https://flows.nodered.org/node/node-red-contrib-tuya-smart-device#output-format
Cheers!
https://nodered.org/docs/user-guide/runtime/configuration
Finding the home directory is specific to your install. You can do a search for the settings.js file across your file system. When you find the home directory delete the flow file. It will look something like flows_<hostname>.json
there are multiple options for this, you could store persistent data in a database (e,g, sqlite) and create a flow that lets you initialize the values or change them using something like an inject node, or you could use the in built variables http://www.steves-internet-guide.com/node-red-variables/ in particular take a look at the section on "Storing Context Data in The File System" (https://nodered.org/docs/api/context/store/localfilesystem)
You can see all the plug-in created by the community and I remember trying some of them for state machine capabilities. https://flows.nodered.org/
You can also use the function node to try it yourself in JavaScript. https://nodered.org/docs/user-guide/writing-functions
you can use the global and flow objects to get and set property values.
https://nodered.org/docs/user-guide/writing-functions#flow
The flow object would be recommended as it will be in the context of the Flow Tab your nodes are running in, whereas the global object will be in the context of your entire Node-RED runtime.
Your start value is not preserved between calls of the function. As soon as you return, it is gone. You can use context.set() and context.get().
That's easy, add it to a flow variable
See: https://nodered.org/docs/user-guide/writing-functions "To get a value from context: "
[{"id":"15af0057.224c58","type":"inject","z":"5c9bda6f.2ea8cc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":270,"y":440,"wires":[["92cafd88.d55798"]]},{"id":"92cafd88.d55798","type":"function","z":"5c9bda6f.2ea8cc","name":"","func":"msg.payload = flow.get(\"test\") - 5;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":460,"y":440,"wires":[["b1337293.f7085"]]},{"id":"3c835771.9117","type":"inject","z":"5c9bda6f.2ea8cc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":260,"y":380,"wires":[["933f97d9.3dcbc8"]]},{"id":"933f97d9.3dcbc8","type":"change","z":"5c9bda6f.2ea8cc","name":"","rules":[{"t":"set","p":"test","pt":"flow","to":"500","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":380,"wires":[["b1337293.f7085"]]},{"id":"b1337293.f7085","type":"debug","z":"5c9bda6f.2ea8cc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":630,"y":420,"wires":[]}]
Before the function node put the string in a flow variable and then only pass the array to the function. You can get flow vars from within function nodes. You can use a change node to set a flow var.
Look at the storing data section https://nodered.org/docs/user-guide/writing-functions
my bad they don't allow process. After reading the docs properly the best way to do it seems to be the change node using a JSONata expression
https://nodered.org/docs/user-guide/environment-variables#jsonata-expressions
So setup a input node to trigger the change nodes that set your env variables
Ok so I watched the video here. https://nodered.org/docs/user-guide/context and that explains it. Even though I updated the flow to clear the variables on start if another request to the flow comes in before the current one finishes it can cause all sorts of issues with missing or incorrect data. Since I am calling the flow from multiple sources at the same time (mostly) I am seeing this. So for now I have staggered the cronjobs on the List so they shouldn't overlap.
When you set a flow variable it stores the information for recall later. They are cached.
There are flow and global contexts. This person is doing it correctly.
Store the state of each sensor in a global context object when it arrives. If a new state arrives also loop through your object with the states and make the LED red or green.
i was thinking you were talking about home assistant in node red, but basically you could interact with it via mqtt, or http reqests / responses or websockets. a website can be added to homescreen in android, very similar to an app, and so a dashboard could be quite simple.
have you looked at the available palette's.... there is a blynk one. i dont use it or know anything about it, but that might be a start
also a quick search of node red api led me to - https://nodered.org/docs/api/
if you are just doing something simple, i have use the joinapp to make custom commands as well. for example open or close my garage door, i would set a custom command, that went to nodered and that triggered the flow, basically like an http post or webhook
>Why are you trying to npm init?
I was wanting to program my own nodes and was just following these instructions. It says I have to use a "npm init" comand on the command line? Why we would have to use anything on the command line from such a visual language perplexes me also.
>If you want to control your node red, stop using the hassio add-on, and run your own docker of node red.
I guess I could. But, wouldn't it still be in a docker and have the same problem? Or, is the Hassio version a cut-down version with things missing?
The problem with that is..I'm wanting to create nodes for others to install. Which is why I posted the original question. :-)
I was just trying to following these simple instructions to create a node. It should be fairly simple in a visual point-n-click language like NR. But alas, no.
Don't worry about the term, it is used colloquially both ways, just wanted to clarify what I was talking about. Yeah, the context variables are quite useful overall. If you haven't worked with them, a nice place to start would be here.
> npm install @node-red-contrib-themes/midnight-red
Thanks. I followed https://nodered.org/docs/getting-started/docker which shows how to install an npm under the container shell section
BTW, in the official docker image, the working file path is:
/usr/src/node-red/node_modules/@node-red-contrib-themes/midnight-red/theme.css
I'm not sure if it will work with the one you have above or the one on your github readme, but thought I'd share.
I don't know anything about HOOBS or the install script it uses for node-red, but my recommendation would be to follow this guide and install it yourself:
I'm not sure where it installed to; I followed directions here: https://nodered.org/docs/getting-started/raspberrypi
Running as root from here: https://t3alliance.org/lessons/node-red-root/
Does that answer your questions? Bit of a noob here...
One msg is a reference.
There is actually a long discussion about this behaviour on the node red forum, with version 1 this will change, including the sync to async behaviour.
See this explanation https://nodered.org/blog/2019/09/13/cloning-messages
It is possible? Yeah it looks like it through the API: https://nodered.org/docs/api/admin/
You are going to have a write a bash script or something though probably to interact with it.
Honestly, I think it would be simpler to add a check into each flow for home/not home though. You can make it a sub-flow if it would be multiple nodes then you can just re-use it and drop into your flows where applicable.
I don't recall seeing anything that allows you to modify the color of nodes.
Anyway, the file you are looking for is called a flows.json (it can be renamed also). It's hard to know where hassio decided to store that file since it's customizable.
My guess would be ~/.node-red/(hostname)_flows.json
https://nodered.org/docs/creating-nodes/
Copy the original and rename the copy. Like any customization it may lead to a more involved update process. I'm not an expert on licensure though and while i highly doubt this would be kosher on anything public, if it's just you in your own home i don't think it'll be an issue.
depends on the system, but get docker installed, and then get node red installed
both of those depend on your computer, but its pretty straight forward. from what i remember, i had a bit of issue with node red, but in docker you just start a new one, and if it doesnt work or whatever, you can stop it and delete it if you want to. make sure you have a backup of your NR files, and then just have them in whatever folder and point to that. in the future you can upgrade NR by updating the docker, and point to the same files
i also suggest the Portainer Docker which makes everything easy to manage.
It is returning the values from the function to the caller of the function. But
hslToRgb(h1,s1,l1)
calls the hslToRgb function and ignores the result. The function node is also a function, and you have to return a value or use node.send(). Here's the documentation for the function node.
As well as the js operators it sounds like you'll need to store values between payloads in the node, flow, or global context and call them pack on the next payload to calculate the differences. More info on that can be found here: https://nodered.org/docs/writing-functions#storing-data
Here's what I ended up doing to get this to work. It definitely needs a lot more polishing, this is just my first pass at it.
I created a function with the following code. It runs at 10am.
let noon = msg.payload[0]; let nice_weather = [800, 801, 802]; // https://openweathermap.org/weather-conditions let min_temp = 20;
if (noon.main.temp_max >= min_temp && nice_weather.includes(noon.weather[0].id)) { return [{"payload":"Nice weather planned, turning on heater."}, null]; } else { return [null, {"payload": "Lousy weather ahead. Turning off heater."}]; }
So you aren't running the commands locally or via putty?
In other words, when you follow this instruction: "go to hoobs.local ->top right menu -> Terminal and run following command:" you are accessing a command line interface via web browser?
If that is the case, I recommend installing and using puTTY for your operating system and using that. https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
for incoming webhooks I'd try to avoid having to expose your server to the Internet.
My solution would be to use an intermediate service like http://dweet.io/ that provides a webhook URL and translates that into a URL that can easily be queried at regular intervals.
It depends which way round you need the service to run.
if node-red needs to receive a message then IFTTT Webhooks needs a publicly accessible URL. But I agree, steer clear of exposing any ports on your server. In this case I'd use a service like http://dweet.io/ that can set up a free URL for IFTTT to access and another URL that node-red can monitor.
If you are trying to get node-red to trigger IFTTT to do something. Then belibeond is correct, you do not need to expose anything.
I may not be very helpful but you may want to look into ngrok. I have never used it but read about it here a little while ago and remembered it because I may try it one day. It sounds like it may be be what you need.
Idk if this will help with node red but this relates to doing this with Home Assistant: https://www.hackster.io/robin-cole/hijack-a-hue-remote-to-control-anything-with-home-assistant-5239a4
Might be able to adapt the concept to your purposes
On iPhone I found SensorLog that can apparently send sensor data (including accelerometer) via HTTP (slower) or TCP/UDP (more for real-time). In Android there are many possibilities like the already mentioned Tasker or my favourite Automate . If you don't want to "program" something separately I'm sure there are apps like SensorLog for Android. On the node-red side use the HTTP-in node and the TCP/UDP-in nodes respectively.
I haven't tried this myself until now but am reasonably sure it will work. Only the speed I'm uncertain about if you want real-time data.
i Have Public IP so i use HTTP Shortcut a lot.
​
<code>https://play.google.com/store/apps/details?id=ch.rmy.android.http_shortcuts</code>
Check out /r/kustom
The widget app (KWGT in the app store) will let you build a button widget super easy, and attach to a press event to do whatever work you want. It's been a couple years since I've used it, but that sub was pretty helpful.
Depending on how you have your services set up, you can use a http in node to open up a web path. Make a call to that, and make nodered respond back with an empty response + kick off your flow. Should be basically instant. Even can open up a few other endpoints to report back status, and get super fancy with your widget
Thanks. It seems there are several generations. I haven't used Android much and the Play Store entry doesn't show much about requirements.
Have you tried Userland? https://play.google.com/store/apps/details?id=tech.ula
Also why not upgrade the device to a more recent version of android by flashing the device with a custom firmware?
Have you looked at an MQTT keypad? I use MQTT with node red for other things and it works great.