I think the SQL-Table is "devices" not "device".
The error means that you don't have device in the OpenGTS database.
I am really sure that I have it.
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]+$';
id | uniqueId
14631194920 | 4631194920
--------------------------------------
1 row in set (0.00 sec)
Try to use selectAllDevices
instead of selectDevices
.
I changed selectDevices to selectAllDevices and it didn't work.
Can we contact via skype? this is my email: itt.edgarstgo@gmail.com
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.
Sorry, but how is it different from your original config?
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>
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.
Have you tried adding database.selectAllDevices
as well?
Thank you
I'll try
and tell you how I was.
Hello, I'm integrating Traccar with OpenGTS and It doesnt work. Please I need help.
tracker-server log:
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>