traccar -> node-red

Leif Neland6 years ago

Has somebody tried sending events to node-red?

I have tried setting up a webservice to listen on localhost:1880/rest/traccar, but nothing shows up on a debugnode, neither from traccar or when I'm trying to wget to that, so it is probably a node-red problem, not traccar.

I'd like my home-automation to turn on the lights and the tea-kettle when I get home...

<entry key='event.forward.enable'>true</entry>
<entry key='event.forward.url'>http://localhost:1880/rest/traccar/'</entry>
<entry key='forward.enable'>true</entry>
<entry key='forward.url'>http://localhost:1880/rest/traccar/'</entry>
Anton Tananaev6 years ago

Why do you have a quote (') at the end of the URL?

Leif Neland6 years ago

Yeah, that was a mistake.
I'm not sure if I should try to parse the location data in php to json and feed it into mqtt, which node-red loves.

Anyway, is there a way to trigger events, to debug event.forward? Rather than have somebody drive my car in and out of geofence while I'm debugging ;-)

Anton Tananaev6 years ago
Leif Neland6 years ago

At least the location works:

a simple

<entry key='forward.url'>https://localhost:1880/rest/traccar/event?name={name}&deviceTime={deviceTime}&fixTime={fixTime}&valid={valid}&course={course}&speed={speed}&lat={latitude}&lon={longitude}&alt={altitude}&status={statusCode}</entry>

and a node-red html-input node produces a nice object

msg.payload : Object
object
name: "Twingo"
deviceTime: "1510964953000"
fixTime: "1510964953000"
valid: "true"
course: "0.0"
speed: "0.0"
lat: "45.32382166666667"
lon: "20.478911666666667"
alt: "0.0"
status: "0xF020"

which is easy to work with in node-red.

Now I just need to process events...

Heiko Amma6 years ago

are you processing events in node red?

i configured it as follow:

in traccar.xml enter these two keys

<entry key='event.forward.enable'>true</entry>
<entry key='event.forward.url'>http://localhost:1880/traccar</entry>

in node red use http input node -> Method: POST -> URL: /traccar

in traccar webinterface -> server settings-> configure notifications, geofence, sos ore something else. Then click on the device, above device settings -> activate notifications for device.

Now you geht an object in node red with the event and device data.

Serge Kostromin5 years ago

Hello!
I have Android client installed on my smartphone. Set up Node-Red URL with POST input node and added URL to client settings. Got no info in the debug at the moment. Is my idea correct and what am I doing wrong?