Day view of calendar doesn't display any tasks

Great, you are getting there so.

The credentials node is not one of the farmOS nodes I created, but I put links in the description of the video for any extra nodes I used.

npm install node-red-contrib-credentials

In the video it says farmOS credentials, but that’s just a label you can apply when configuring it.

I haven’t done a video for calendar syncing yet, but I have some examples in GitHub you can import. But I can do a video too.

Edit: actually I’ll do a new calendar flow at some stage this week as the one currently on GitHub doesn’t use my new farmOS nodes.

1 Like

@Farmer-Ed Morning! Wanted to touch base and see if you had the chance to provide any further instructions for a calendar syncing option. Also, do I have to keep the Terminal open all the time when running the NodeRed? Sorry for the ignorant questions!

1 Like

Good Evening @kyle
There’s no ignorant questions, so ask away. There could be multiple answers though, it can be run as a background process but how may depend on how are you running node-red at the moment? is it in docker? Sometimes though having it visible in the terminal can help debugging some issues.

I have come across some issues with the Google API nodes that I was using and I’m not really happy with them, they seem to work for a week then have an issue reauthenticating with Google Oauth2, then I need to reinput all credentials and they’ll run for another week. I think there may have been a minor API change effecting refresh token life since some of these nodes were created and as they are community contrib nodes we are some what dependent on the original authors updating them.

I did however spend some time last night reading the current Google Oauth2 and Google Calendar API documentation and have put together a few flows which can do what we need using the standard http request nodes, I’d like to see how they perform over the next week though.

1 Like

I’ve a few quick questions for you, which may help me understand what you need, since I’m completely redesigning how my own calendars anyway, now would be a good time to include any features you may need (especially if not too far from my own plans).

Have you explored node-red much yet?
Were you able to read any farmOS logs with it?

What exactly would you like to achieve? (like all pending logs sent to a calendar, or something more or less?)

1 Like

@kyle I’ve put together a quick how to for getting Google API Credentials.

I’ve also created a flow for authenticating with Google.

First add the node-red-dashboard nodes in manage palette, then use the import option and copy the raw contents of the git hub file to import my flow.

2 nodes need updating with your credentials, Google Oauth2 and Oauth2 Refresh, just double click on them.

This flow does not do anything other than authenticate and return your access tokens. But if you can confirm that you are able to authenticate with both the Google API and farmOS API then we can look at what you want passed between them.

A quirk of different versions of Node-Red for different system environments means URL endpoints might be slightly different, but usually http://127.0.0.1:1880/ or http://127.0.0.1:1880/endpoint/
So http://127.0.0.1:188/ui may need to be changed to http://127.0.0.1:1880/endpoint/ui
and http://127.0.0.1:1880/Google/oauth2 to http://127.0.0.1:1880/endpoint/Google/oauth2

Edit:
I’ve added a post on using the Google API Authentication flow now.

1 Like

@Farmer-Ed Sorry for the late reply. I’ve been caught up in the spring to-dos on the orchard. I am using scheduled activities in FarmOS to manage the work flow on the orchard. At this point, I am meeting with our team every week and going over tasks (Logs: activities, observations, inputs, etc) that need to happen that week. What I need is a way to put all of these logs onto a calendar so that everyone can easily see them on their calendar. My thought was to have them subscribe to this calendar once I have the information flowing through the Google API. It’s just such an easier way to view the information. Perhaps this is what the FieldKit will do, but I have found it buggy and not syncing. In all honesty, the calendar view in FarmOS 1 worked really well for us. Just trying to find a work around for management and work flow.

1 Like

No Problem @kyle
Let me know if what I posted so far makes sense. If you can get authentication working for both the farmOS API and Google API then it shouldn’t be too hard to get the next bit working to pass the logs you want from one to the other.

1 Like

@Farmer-Ed So, I’m working on getting the authentication working. However, I can’t seem to find the way to add the redirect URL, Client IDs, etc. Any ideas on what I’ve done wrong?

2 Likes

Looks like I missed a step in getting the Google OAuth2 into Node-Red. Let me look into doing this first…

2 Likes

Yes @kyle, these are fed into the node as payloads, but I think in the next version I release I’ll add the option for exactly what you are thinking.

Anyway I use a credentials node node-red-contrib-credentials (node) - Node-RED before the farmOS oauth2 node. It can be installed from the Manage Palette option in the Node Red main menu, just go to install and search credentials.

Then connect that node to the flow before oauth2 and click the add button at the bottom and add the necessary fields, which are:

msg.payload.url
msg.payload.username
msg.payload.password
msg.payload.client_id
msg.payload.client_secret
msg.payload.scope

Be careful not to have a / at the end of the url.

1 Like

I’d concentrate on getting one or other working for the moment, won’t matter which you setup first.

farmOS and Google both use Oauth2 but they are a little different.
The credentials for Google Oauth2 can be added to the node properties, like you were trying for the farmOS one. Probably the most difficult bit there is setting up your Google developer Account and getting the credentials.

1 Like

@Farmer-Ed How do I find the Client Id, secret and scope for FarmOS? I have them for google, but I don’t know how to get them for FarmOS.

Here is what I’ve accomplished:

  1. I have Node-Red running on my computer.
  2. I followed your steps for setting up credentials with google.

What I’m unclear on how to proceed is:

  1. How to set up the credentials for FarmOS (I don’t know where to find the information mentioned above).
  2. How to import the Google Oauth2 into Node Red.

Thanks!

It may be different on Farmier but by default they are:
Client ID: farm
Client secret: client_secret
scope: farm_manager or farm_worker or farm_viewer

They can be changed at administration/configuration/web services/consumers there should be a profile named Farm default if you have that access in Farmier?

Thanks, I’ll look into this.

I’m working on a module for Google Calendar too.

@mstenta what would be the requirements to make a module available on Farmier? I assume a Drupal.org git repo for a start. Probably needs a little tidying up and further testing too.

YES! This looks awesome and exactly what I’m needing. Very cool. Now if I can just figure out how put it all together.

Here is what I’m getting now. . .
image

have you updated the URL to your farmOS instance?
http://192.168.1.34 is the local IP address of my test server

Yeah, I changed it to
image
and still get the same response.

remove the timestamp payload from the inject node and add a debug node after the oauth2 node