eusonlito / GPS-Tracker

GPS Tracker platform for Sinotrack, Coban, Teltonika, Concox, Jimilab, OsmAnd and Queclink devices built with Laravel 11 + PHP 8.2 and MySQL 8. Plataforma GPS Tracker para dispositivos Sinotrack Sinotrack, Coban, Teltonika, Concox, Jimilab, OsmAnd y Queclink creada con Laravel 11 + PHP 8.2 y MySQL 8.
https://tracker-demo.lito.com.es/
MIT License
137 stars 62 forks source link

Fix Timezone #5

Closed eusonlito closed 1 year ago

JakeOcean commented 1 year ago

I was able to finally get my st-902 pointed at my own server. I think I was out of service when I attempted it before -- can these settings be changed with a USB cable?

I am seeing data in my logs. I switched from debug-socket back to h02 -- the messages format is the same

HIDDEN

This data is not visible in the backend, so either the protocol is different, my settings are wrong, or perhaps I do not have the tracker ID entered correctly?

JakeOcean commented 1 year ago

On the backend my Device serial number is correctly set to HIDDEN

eusonlito commented 1 year ago

Ok, the data is correct to protocol H02. Let me check if there are some additional column or value not parsed by default regular expression 👍🏿

JakeOcean commented 1 year ago

After parking my car, several hours later a few trips appeared!

The times are wrong, so I think I need to still set my device to use UTC perhaps?

Either way I think the protocol is working, based on the data, but I will let you know tomororw after I test a bit more.

Screen Shot 2023-02-25 at 8 16 35 PM
JakeOcean commented 1 year ago

Actually, those times are too late to be UTC... It's not 9:55 UTC on 2/26 yet..

eusonlito commented 1 year ago

Yes, you need to setup your device with UTC timezone: https://github.com/eusonlito/GPS-Tracker#set-the-time-zone-to-utc-to-delegate-the-time-adjustment-to-the-platform

eusonlito commented 1 year ago

Also you can send a message (same text as SMS) from Devices > Messages. But TCP messages need wait to device wake up to apply the change.

JakeOcean commented 1 year ago

I was able to update my Tracker to UTC -- thank you so much for your help!

I have my Vehicle set to my local timezone of America/New_York and I just started a new drive -- the time seems to be off by 1 hour, so maybe it is a Daylight savings issue? Either way, not a big deal for now.

I will drive around for a few days and test everything out, and then maybe I can contribute a few updates too if you are open to it

eusonlito commented 1 year ago

Can you check the server logs if device is reporting the correct UTC time?

[UTC_DATETIME] *HQ,DEVICE_ID,V1,UTC_TIME,...

Or in database tables trip and position, the columns xxxxx_utc_at.

Anyway I will do some tests with your same Timezone because I have found other users with a similae issue: https://stackoverflow.com/questions/74588944/getting-the-difference-in-time1-hour-for-daylight-saving-time-timezones-like-a

JakeOcean commented 1 year ago

When I check the DB, the UTC time is correct.

I started my trip at 11am est today, which is 4pm UTC. Does your timezone selector take into account daylight savings time? In the Spring and Fall we adjust our clocks 1 hour, which can be a pain in PHP, but thankfully Carbon usually handles it

Screen Shot 2023-02-27 at 2 37 34 PM

EDIT: But you can also see that my End time is not correct. The UTC start/end correctly shows my trips was ~44 mins, but the non UTC values make the trip seem 12+ hours

eusonlito commented 1 year ago

Do you have enabled automatic timezone in vehicle? Can you show the rows columns in your screenshot?

In my case, with Europe/Madrid, PHP is handling fine the utc to timezone conversion with and without daylight savings...

JakeOcean commented 1 year ago

I do have auto timezone enabled, should I try and disable?

Here is a screenshot showing the columns, but keep in mind the trips above this one were before I correctly set my devices timezone.

Screen Shot 2023-02-27 at 2 57 36 PM

eusonlito commented 1 year ago

Yes, try to disable the automatic timezone inside vehicle. Anyway I testing timezone conversions using several timezones.

eusonlito commented 1 year ago

Update the source before try disabling the automatic timezone because there was an bug with boolean casting on vehicle.

JakeOcean commented 1 year ago

The times are correct now after a pull and disabling autotimezone!