Open MarkSau opened 3 years ago
@MarkSau . I think that the connection is timing out after 60 seconds. Do you know if you registered the ScannerIDNumber with Traccar so that it knows which device to update? Do you have Traccar server logs that you can send from the logs directory under the traccar directory?
@lmandres directly after start of the script Traccar shows me that the device is online. But i can't see the next push after 30 sec in the logs of traccar, only the inital one. btw. Tracecar shows me the device still as online (green) Update: Now after 10 min. the connection state switched to unknown.
@lmandres it looks like that the script does not send data in the configured timespan. your script has a time.sleep. as my understanding the script should "sleep" for the time e.g. 30 sec and reactivate afterwards. But TOP shows me that the python process is running all the time without any pause. i assume that it is running in a loop or something like that and not able to send future data.
next finding: I started the script with opt pdb for debugging.
it looks like that the script is looping in the runScannerClient module
/opt/GT06/GT06ScannerClient/runClient.py(70)
() -> scanner.runScannerClient() (Pdb) n Scanning . . . {'latitude': nnnnnnnnnnnnn, 'latitudeDir': 'N', 'longitude': nnnnnnnnnnnn, 'longitudeDir': 'E', 'groundSpeedKnots': 0.098, 'altitude': 177.1, 'altitudeUnits': 'M', 'time': '19:27:47', 'timestamp': '192747.00', 'satellitesInView': '12'} Scanning . . . {'latitude': nnnnnnnnnnnnnn, 'latitudeDir': 'N', 'longitude': nnnnnnnnnnnnnn, 'longitudeDir': 'E', 'groundSpeedKnots': 0.069, 'altitude': 175.8, 'altitudeUnits': 'M', 'time': '19:28:48', 'timestamp': '192848.00', 'satellitesInView': '11'} Scanning . . . {'latitude': nnnnnnnnnnnnnn, 'latitudeDir': 'N', 'longitude': nnnnnnnnnnnnnn, 'longitudeDir': 'E', 'groundSpeedKnots': 0.061, 'altitude': 175.0, 'altitudeUnits': 'M', 'time': '19:29:48', 'timestamp': '192948.00', 'satellitesInView': '11'}
fo me its shows that this part will not leave and is looping.
@MarkSau , so the relevant line in the code is as follows:
https://github.com/lmandres/GT06ScannerClient/blob/master/GT06ScannerClient.py#L222
The sleep just does a 1 second pause so that the script isn't continuously running. The actual wait is calculated from the current time minus the previous time, and if that wait is longer then the script is supposed to continue. I did this because I do a request for a map if the map server is available in my personal script.
I have a feeling that some request is timing out due to the 60 second interval involved. The network delay time is set as follows:
https://github.com/lmandres/GT06ScannerClient/blob/master/gt06Client.py#L16
and is consumed here:
https://github.com/lmandres/GT06ScannerClient/blob/master/gt06Client.py#L44
EDIT: Added information about the map server.
Seems that the script has a problem with the delyed sent.
after start the script sends the data to the traccar server, but afterwards it only shows me the data on the console and never more on the server.
my config.yml file:
`<?xml version="1.0"?>
` Output on console:
pygame 1.9.6 Hello from the pygame community. https://www.pygame.org/contribute.html Namespace(config='config.xml', gps_baud=None, gps_port=None, id=None, maps_url=None, server_address=None, server_port=None, update_delay=None) Scanning . . . {} Scanning . . . {'latitude': nnnnnnnnnnnnn, 'latitudeDir': 'N', 'longitude': nnnnnnnnnnnn, 'longitudeDir': 'E', 'groundSpeedKnots': 0.098, 'altitude': 177.1, 'altitudeUnits': 'M', 'time': '19:27:47', 'timestamp': '192747.00', 'satellitesInView': '12'} Scanning . . . {'latitude': nnnnnnnnnnnnnn, 'latitudeDir': 'N', 'longitude': nnnnnnnnnnnnnn, 'longitudeDir': 'E', 'groundSpeedKnots': 0.069, 'altitude': 175.8, 'altitudeUnits': 'M', 'time': '19:28:48', 'timestamp': '192848.00', 'satellitesInView': '11'} Scanning . . . {'latitude': nnnnnnnnnnnnnn, 'latitudeDir': 'N', 'longitude': nnnnnnnnnnnnnn, 'longitudeDir': 'E', 'groundSpeedKnots': 0.061, 'altitude': 175.0, 'altitudeUnits': 'M', 'time': '19:29:48', 'timestamp': '192948.00', 'satellitesInView': '11'}
nnnnnnnnnnnnnn=mask latitude/longitude