farmOS, NodeRed, Home Assistant etc

So, I’ve been experimenting with reading and searching logs with Node Red and so far it’s going well, I created a flow that searches observations for the term “Due Date” and updates a Google calendar with the dates. Some thing simple to start with.

The flow is here: FarmOS-Node-Red-Flows/Calving-Calendar-Flow.json at main · Farmer-Eds-Shed/FarmOS-Node-Red-Flows · GitHub

This works OK but will create duplicate entries if the flow is re-run, so I’ve added a flag to the logs and use the flag to decide if entry should be added to Google calendar. So the next step for the flow would be to remove the flag after updating the calendar. (probably make more sense the other way round in the end but for now it will do).

The documentation on updating a log using the API is lacking at the moment, the document for 1.x says to use the PUT method but I’ve come across this Drupal document which says to use PATCH method.
Updating existing resources (PATCH) | JSON:API module | Drupal Wiki guide on Drupal.org.

Would I be right in saying that PATCH method and some thing like this would clear all flags:

{
“data”:{
“type”: “log–observation”,
“id”: “{{LOG-UUID}}”,
“attributes”: {
“flag”: []
}
}
}

2 Likes