neo7530 / traccar_pusher

2 stars 0 forks source link

Need additional information for traccar_pusher using gotify #1

Open blobb999 opened 2 years ago

blobb999 commented 2 years ago

Thanks a lot for the script and effort, unfortunately i need some additional information, idk how to run it from Traccar. I configured it in traccar.xml this way: <entry key='event.forward.url'>http://localhost:8082/push.php</entry>

Traccar serverlog: WARN: Event forwarding failed - MessageBodyReader not found for media type=application/octet-stream, type=class java.lang.Object,...

The values can be set directly in the code or if i enable the debugging lines, it uses a data.txt config file and needs the format like this?

"push" 1
"gotify" 1
"pushover" 0
"pushonline" 0
"pushalarm" 0
"pushoffline" 0
"pushunknown" 0
"pushmoving" 0
"pushurl" http://localhost:90/
"GotifyApiKey" MyAppTokenXYZ

follow up from: https://github.com/gotify/server/issues/444

neo7530 commented 2 years ago

Hey,

you have to add:

<entry key='event.forward.enable'>true</entry>
<entry key='event.forward.url'>https://WEBSERVER.URL/PATH/</entry>
<entry key='event.forward.header'>Content-Type: application/json; charset=utf-8</entry>

in /opt/traccar/config/traccar.xml

Then you have to start a webserver (apache etc.) and put the push.php as index.php in your "https://WEBSERVER.URL/PATH/".

Next configure your User-Settings as seen in the PIC i've attached TRACCAR PUSH . Thats it.

blobb999 commented 2 years ago

Thank you very much for the help. I set it up exactly described above and still get follow Warning: WARN: Event forwarding failed - MessageBodyReader not found for media type=text/html;charset=utf-8, type=class java.lang.Object, genericType=class java.lang.Object. - MessageBodyProviderNotFoundException (...)

Gotifiy Serverlogs shows nothing from Traccar.

Maybe something changed since you did the PHP script? Traccarlog shows 2021-10-25 11:50:35 INFO: Version: 4.13 2021-10-25 11:50:35 INFO: Starting server...

neo7530 commented 2 years ago

2021-10-25 12:10:38 INFO: Character encoding: UTF-8 charset: UTF-8 2021-10-25 12:10:38 INFO: Version: 4.7 2021-10-25 12:10:38 INFO: Starting server...

blobb999 commented 2 years ago

Ahhh here we are... this could it be? One line above i have: 2021-10-25 12:25:04 INFO: Character encoding: Cp1252 charset: windows-1252

<entry key='event.forward.header'>Content-Type: application/json; charset=windows-1252</entry> ...is helping not, is ignored. Same Warning....

Maybe there is a workaround? For example... where do i have to add this in your PHP script to enforce Traccar´s encoding?

header('Content-type: application/json; charset=windows-1252');
echo json_encode( $data );
neo7530 commented 2 years ago

This has nothing to do with my script. This is just a json parser...

l-e-o-n-c-e commented 2 years ago

Hi, I have exactly the same issue when pushing the events to ft ( https://github.com/jpmens/from-traccar ), so for me the issue is on traccar's side definitely. The error raises during traccar startup, at this point there is no communication with the destination server. I haven't found a solution yet :(