Hi!
I’m running a local thinger.io instance on a raspberry pi (installed using the standard snap package) and connecting it to a local Node-red server through HTTP endpoints and an API.
I’ve got different endpoints both in Thinger and Node-red depending on the info I’m sending though them. A nodemcu calls the endpoints, which in turn make a POST request to Node-red to pass the data. I had two endpoints of this kind working perfectly.
The problem is I just created a new one which seems to break all of them. Everything is working fine, until a device makes a call to the endpoint. This endpoint calls Node-red, which receives the request, but no endpoint calls after this are made for 2 minutes. After 2 minutes pass, Node-red only receives requests from this endpoint, the rest of them just stop working.
This is what is written to the endpoint:
thing["complete_motion_report"] >> [](pson& out){ time_t t = now(); char time[50]; snprintf(time, 50, "%d:%d:%d %d/%d/%d", hour(t), minute(t), second(t), day(t), month(t), year(t)); out["motion"] = ; // true or false out["threshold"] = MOTION_REPORT_THRESHOLD; out["node_name"] = String(nodeName); out["stamp"] = String(time); }; // IN LOOP if(millis() - lastMotionReport > MOTION_REPORT_THRESHOLD*1000){ thing->call_endpoint("NodeRedMotionReport", thing["complete_motion_report"]); Serial.printf("\n Motion report sent."); lastMotionReport = millis(); }
Everything works fine if I comment the ‘call_endpoint’ line. I also made sure the endpoint is not called more than once every 10 seconds (although I’m not sure this restriction applies to local instances).
The receiving end in Node-red is just a ‘HTTP in node’, of which I have three. The other two (with the other two endpoints) work perfectlly until this one gets used.
Sorry for the long description, hope someone can help.
Thanks!