@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!
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.
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?)
@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.
@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.
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.
@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?
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.
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.
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?
@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.