Node-RED farmOS library

I’m starting to hack together a farmOS library for node-red! Not sure what all this might evolve into, but I think it would be great to create some “farmOS Auth” nodes to simplify connecting to a farmOS server, and create some nodes to read/create logs, assets, areas, and post to sensors. I think we could create a configuration node, too, that could hold farmOS credentials. I wanted to start a thread to get some ideas from others.

I’ve hacked together some flows that support Drupal Auth (cookie + csrf token) and support for farmOS OAuth which is in development. I added a couple dashboard elements that pull some basic info from the API. You should be able to import the JSON from my gist (you can click on these images to expand)

The next steps to create some custom nodes might be pretty straightforward. We could probably start a github repo for that.


@dornawcox might be interested in this!

did you ever do more work on this?

I would be interested in collaborating if you are still using node red - found your flow here interesting although I cannot seem to make it work for my deployment, although its definitely pointing me in the right direction


No, I never got much further with this. The Authentication flows might not be totally correct anymore - especially for OAuth. But I don’t imagine they would be too far off. One thing to change would be the OAuth URL from server/oauth2/authorize to server/oauth/authorize.

I’d be interested in revisiting it for farmOS 2.x though!

At first I was thinking about using NodeRED as
a “gateway” for sensor data. There’s already support for MQTT and other protocols, its just a matter of wiring them up to the farmOS API. Creating logs & assets seemed like a good thing to support too, but I didn’t have any real use cases…

But this would actually be a neat way to aggregate sensor data & create logs if they meet certain conditions @mbillion! I think you could create all of your logic from the UI and export to code. Maybe you’re already thinking about that…


Im having a hard time getting posts to go through; For all the NodeMCU Esp8266 I have connected to sensors, but I also have them connected to things like lights and pumps. I can use the node red dashboard to set timing schedules turning on and off certain devices, or manually control the devices like irrigation pumps using the internet.

So I already have MQTT and a functional mesh network connecting everything and working. Now what I am trying to do is get the mqtt messages that would normally just show up on my dashboard to convert into POST’s into logs or farm inputs etc.

Having trouble getting node-red to speak to FarmOS though through the API. Can get the Drupal CSRF tokens, cannot get Oauth to authenticate. Then using CSRF I am still getting 404 when I am trying to post. saying the url’s do not exist

Right now just trying to do the base example on the most simple log post.

It would be super nice if I could - as far as a use case goes, have the dashboard of node-red hooked up to different sensors and control mechanisms, hitting a button starts a “log” etc.

This goes in line with my general inquests recently of tracking start and end times as well as consolidated sensor values. I think you could find a ton of ways to use this - once I get it connected I will share some of the ways I intend on using it


i just got it 403 to deny me instead of 404 doesnt exist so I am moving down the list

1 Like

Just saw this - the 2.0 milestone release of Node-Red: Release 2.0.0: Milestone Release · node-red/node-red · GitHub