OpenGTS Integration not working - Unknown device

Edgar Santiago7 years ago

Hello, I'm integrating Traccar with OpenGTS and It doesnt work. Please I need help.

WARN: Unknown device - 4631194920 (190.167.253.153)

tracker-server log:

2017-09-27 10:27:49 DEBUG: [B9E47D1D: 8080 > 190.167.253.85] HEX: 02010813020000000000
2017-09-27 10:27:49  WARN: Geocoding failed - Empty address - GeocoderException (JsonGeocoder:74 < ...)
2017-09-27 10:27:49  INFO: [B9E47D1D] id: 4631194920, time: 2017-09-27 10:26:43, lat: 18.45980, lon: -69.92647, speed: 2.0, course: 271.0
2017-09-27 10:28:19 DEBUG: [B9E47D1D: 8080 < 190.167.253.85] HEX: 8305463119492001010102081459cbb54159cb69a40b00bdf0d652116b0000000000000066010f04040002ffc90f321d081e1e100000002dd600000dda000000000000060e0000003900000000000000000000000000000091017200f7001e28ac0000f21c0000f21c0000001d0000000000000000
2017-09-27 10:28:19 DEBUG: [B9E47D1D: 8080 > 190.167.253.85] HEX: 02010814020000000000
2017-09-27 10:28:19  WARN: Geocoding failed - Empty address - GeocoderException (JsonGeocoder:74 < ...)
2017-09-27 10:28:19  INFO: [B9E47D1D] id: 4631194920, time: 2017-09-27 10:27:13, lat: 18.45980, lon: -69.92647, speed: 2.0, course: 271.0
2017-09-27 10:28:40  INFO: Shutting down server...
2017-09-27 10:28:53  INFO: Operating system name: Windows Server 2012 R2 version: 6.3 architecture: amd64
2017-09-27 10:28:53  INFO: Java runtime name: Java HotSpot(TM) 64-Bit Server VM vendor: Oracle Corporation version: 25.144-b01
2017-09-27 10:28:53  INFO: Memory limit heap: 494mb non-heap: 0mb
2017-09-27 10:28:53  INFO: Character encoding: UTF-8 charset: UTF-8
2017-09-27 10:28:53  INFO: Version: 3.12-SNAPSHOT
2017-09-27 10:28:55  INFO: Query not provided: database.selectGroupsAll
2017-09-27 10:28:55  INFO: Query not provided: database.selectDevicesAll
2017-09-27 10:28:55  INFO: Query not provided: database.selectLatestPositions
2017-09-27 10:28:55  INFO: Query not provided: database.selectServers
2017-09-27 10:28:55  INFO: Query not provided: database.selectUsersAll
2017-09-27 10:28:55  INFO: Query not provided: database.selectGroupsAll
2017-09-27 10:28:55  INFO: Query not provided: database.selectDevicesAll
2017-09-27 10:28:55  INFO: Query not provided: database.selectGroupPermissions
2017-09-27 10:28:55  INFO: Query not provided: database.selectDevicePermissions
2017-09-27 10:28:55  INFO: Query not provided: database.selectGroupsAll
2017-09-27 10:28:55  INFO: Query not provided: database.selectUserPermissions
2017-09-27 10:28:57  INFO: Query not provided: database.selectAttributeAliases
2017-09-27 10:28:57  INFO: Query not provided: database.selectAttributes
2017-09-27 10:28:57  INFO: Query not provided: database.selectAttributePermissions
2017-09-27 10:28:57  INFO: Query not provided: database.selectGroupAttributes
2017-09-27 10:28:57  INFO: Query not provided: database.selectDeviceAttributes
2017-09-27 10:28:57  INFO: Query not provided: database.selectDevicesAll
2017-09-27 10:28:57  INFO: Starting server...
2017-09-27 10:29:04 DEBUG: [C62BB702: 8080 < 190.167.253.85] HEX: 8305463119492001010102081559cbb55f59cb69a40b00bdf0d652116b0000000000000066010f04040002ffc90f321d081e1e100000002dd60000108e000000000000060e0000003900000000000000000000000000000091017200f7001e28ac0000f23a0000f23a0000001d0000000000000000
2017-09-27 10:29:04  WARN: Unknown device - 4631194920 (190.167.253.85)
2017-09-27 10:33:19 DEBUG: [C62BB702: 8080 < 190.167.253.241] HEX: 8305463119492001010102081559cbb55f59cb69a40b00bdf0d652116b0000000000000066010f04240002ffc90f321d081e1e100000002dd60000108e000000000000060e0000003900000000000000000000000000000091017200f7001e28ac0000f23a0000f23a0000001d0000000000000000
2017-09-27 10:33:19  WARN: Unknown device - 4631194920 (190.167.253.241)
2017-09-27 10:37:19 DEBUG: [C62BB702: 8080 < 190.167.253.153] HEX: 8305463119492001010102081559cbb55f59cb69a40b00bdf0d652116b0000000000000066010f04240002ffc90f321d081e1e100000002dd60000108e000000000000060e0000003900000000000000000000000000000091017200f7001e28ac0000f23a0000f23a0000001d0000000000000000
2017-09-27 10:37:19  INFO: Query not provided: database.selectDevicesAll
2017-09-27 10:37:19  WARN: Unknown device - 4631194920 (190.167.253.153)

This is my config file:

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>

<properties>

    <!-- SERVER CONFIG -->

    <entry key='web.enable'>false</entry>
    <entry key='web.port'>8082</entry>
    <entry key='web.path'>./web</entry>

    <entry key='geocoder.enable'>true</entry>
    <entry key='geocoder.type'>google</entry>

    <entry key='logger.enable'>true</entry>
    <entry key='logger.level'>all</entry>
    <entry key='logger.file'>./logs/tracker-server.log</entry>

    <entry key='processing.computedAttributes.enable'>true</entry>

    <entry key='media.path'>./media</entry>

    <entry key='server.statistics'>https://www.traccar.org/analytics/</entry>

    <!-- DATABASE CONFIG -->

<entry key='database.ignoreUnknown'>true</entry>

<entry key='database.selectDevices'>
    SELECT CONCAT('1', imeiNumber) AS id, imeiNumber AS uniqueId FROM Device WHERE imeiNumber REGEXP '^[0-9]+$';
</entry>

<entry key='database.insertPosition'>
    START TRANSACTION;
        UPDATE Device SET lastValidLatitude = :latitude, lastValidLongitude = :longitude, lastGPSTimestamp = UNIX_TIMESTAMP(:fixTime), lastUpdateTime = UNIX_TIMESTAMP(NOW()) WHERE imeiNumber = SUBSTRING(CAST(:deviceId AS CHAR(32)), 2);
        SELECT @accountID := accountID, @deviceID := deviceID FROM Device WHERE imeiNumber = SUBSTRING(CAST(:deviceId AS CHAR(32)), 2);
        INSERT INTO EventData (accountID, deviceID, timestamp, statusCode, latitude, longitude, speedKPH, heading, altitude, rawData, creationTime, address)
        VALUES (@accountID, @deviceID, UNIX_TIMESTAMP(:fixTime), 0, :latitude, :longitude, :speed * 1.852, :course, :altitude, '', UNIX_TIMESTAMP(NOW()), :address);
    COMMIT;
</entry>

    
    

    <!-- PROTOCOL CONFIG -->

    <entry key='gps103.port'>5001</entry>
    ...
    <entry key='vtfms.port'>5145</entry>

</properties>
dsm7 years ago

I think the SQL-Table is "devices" not "device".

Anton Tananaev7 years ago

The error means that you don't have device in the OpenGTS database.

Edgar Santiago7 years ago

I am really sure that I have it.

Anton Tananaev7 years ago

What's the output of the following SQL query:

SELECT CONCAT('1', imeiNumber) AS id, imeiNumber AS uniqueId FROM Device WHERE imeiNumber REGEXP '^[0-9]+$';
Edgar Santiago7 years ago
id                        |   uniqueId
14631194920     |    4631194920
--------------------------------------

1 row in set (0.00 sec)
Anton Tananaev7 years ago

Try to use selectAllDevices instead of selectDevices.

Edgar Santiago7 years ago

I changed selectDevices to selectAllDevices and it didn't work.

Edgar Santiago7 years ago

Can we contact via skype? this is my email: itt.edgarstgo@gmail.com

Edgar Santiago7 years ago

Hey Tananaev, I could resolve the problem inserting :

<entry key='database.selectDevices'>
    SELECT CONCAT('1', imeiNumber) AS id, imeiNumber AS uniqueId FROM Device WHERE imeiNumber REGEXP '^[0-9]+$';
</entry>

Thank you for your help.

Anton Tananaev7 years ago

Sorry, but how is it different from your original config?

Edgar Santiago7 years ago

Oh sorry, I inserted both selectDevices and selectAllDevices and its working.

<entry key='database.selectDevices'>
    SELECT CONCAT('1', imeiNumber) AS id, imeiNumber AS uniqueId FROM Device WHERE imeiNumber REGEXP '^[0-9]+$';
</entry>

<entry key='database.selectAllDevices'>
    SELECT CONCAT('1', imeiNumber) AS id, imeiNumber AS uniqueId FROM Device WHERE imeiNumber REGEXP '^[0-9]+$';
</entry>
Deme Tole7 years ago

I installed the version:
https://github.com/tananaev/traccar/releases/download/v3.14/traccar-linux-3.14.zip

In Linux Centos7 64Bts

Then install:
https://sourceforge.net/settings/mirror_choices?projectname=opengts&filename=server-base/2.6.5/OpenGTS_2.6.5.zip

Then I detail the traccar.xml.

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>
<properties>
    <!-- SERVER CONFIG -->
    <entry key='web.enable'>false</entry>
    <entry key='web.port'>8082</entry>
    <entry key='web.path'>./web</entry>
    <entry key='geocoder.enable'>true</entry>
    <entry key='geocoder.type'>google</entry>
    <entry key='logger.enable'>true</entry>
    <entry key='logger.level'>all</entry>
    <entry key='logger.file'>./logs/tracker-server.log</entry>

    <entry key='processing.computedAttributes.enable'>true</entry>
    <entry key='media.path'>./media</entry>
    
    <!-- DATABASE CONFIG -->
    <entry key='database.driver'>com.mysql.jdbc.Driver</entry>
    <entry key='database.url'>jdbc:mysql://localhost:3306/misdatos?allowMultiQueries=true</entry>
    <entry key='database.user'>root</entry>
    <entry key='database.password'>ventanas.2017</entry>
    <entry key='database.ignoreUnknown'>true</entry>

    <entry key='database.selectDevices'>
        SELECT CONCAT('1', imeiNumber) AS id, imeiNumber AS uniqueId FROM Device WHERE imeiNumber REGEXP '^[0-9]+$';
    </entry>

    <entry key='database.insertPosition'>
        START TRANSACTION;
            UPDATE Device SET lastValidLatitude = :latitude, lastValidLongitude = :longitude, lastGPSTimestamp = UNIX_TIMESTAMP(:fixTime), lastUpdateTime = UNIX_TIMESTAMP(NOW()) WHERE imeiNumber = SUBSTRING(CAST(:deviceId AS CHAR(32)), 2);
            SELECT @accountID := accountID, @deviceID := deviceID FROM Device WHERE imeiNumber = SUBSTRING(CAST(:deviceId AS CHAR(32)), 2);
            INSERT INTO EventData (accountID, deviceID, timestamp, statusCode, latitude, longitude, speedKPH, heading, altitude, rawData, creationTime, address)
            VALUES (@accountID, @deviceID, UNIX_TIMESTAMP(:fixTime), 0, :latitude, :longitude, :speed * 1.852, :course, :altitude, '', UNIX_TIMESTAMP(NOW()), :address);
        COMMIT;
    </entry>

    <!-- PROTOCOL CONFIG -->
    <entry key='gps103.port'>5055</entry> 
    <entry key='gt06n.port'>5023</entry>
</properties>

Although I have created the device in OpenGts.

But I always report the following:

17-10-16  20:12:51  WARN: Unknown device - 631202 (192.168.100.10)

Your help as I can overcome this problem.

Very thankful.

Anton Tananaev7 years ago

Have you tried adding database.selectAllDevices as well?

Deme Tole7 years ago

Thank you

I'll try

and tell you how I was.