No, sorry I can't currently.
It is a big script which is currently not finished yet and full of unwanted comments and skipped parts of the script.
It is for my camper trips to have weather info ahead for the next 300 and 600 km to my destination.
To help you a little bit further I have some snippets put together to a small demo script.
Code: Select all
local NAME = ''
local LATITUDE = 0
local LONGITUDE = 0
local ALTITUDE = 0
local SPEED = 0
local SPEEDLIMIT = 120
local COURSE = 0
local TIME = 0
return {
active = true,
-- active = false,
on = {
timer = {
-- 'every minute',
'at *:01',
},
variables = {
'Location',
},
devices = {
'Dummy Action',
},
},
logging = {
level = domoticz.LOG_INFO,
-- level = domoticz.LOG_DEBUG,
marker = "Traccar-test"
},
data = {
Location = { initial = 'XXXX;51.9;5.5;75.1;120.00;314;1722869616000' },
},
execute = function(dz, item)
-- Data from traccar to Domoticz Location variable
-- {name};{latitude};{longitude};{altitude};{speed};{course};{fixTime}
local function fillVars(sValue)
local t = dz.utils.stringSplit(sValue, ';')
if #t == 7 then
NAME = t[1]
LATITUDE = tonumber(t[2])
LONGITUDE = tonumber(t[3])
ALTITUDE = tonumber(t[4])
SPEED = tonumber(t[5])
COURSE = tonumber(t[6])
TIME = tonumber(t[7])
return 0
else
return 1
end
end
local function convertTime(nTime)
return dz.time.timestampToDate(TIME / 1000, 'yyyy-mm-dd time')
end
if (item.isVariable) then
if not fillVars(item.value) then
return
end
elseif (item.isTimer) or (item.isDevice) then
if not fillVars(dz.data.Location) then
return
end
dz.log('================================================================================', dz.LOG_FORCE)
dz.log('Data of '..NAME..' - '..LATITUDE..' - '..LONGITUDE..' - '..ALTITUDE..' - '..SPEED..' - '..COURSE..' - '..
TIME..' - '.. convertTime(TIME), dz.LOG_FORCE)
end
end
}
Logic will get you from A to B. Imagination will take you everywhere.