Hi,
I have a script to create the curve easily.
It work perfect/
My problem is about password, if my customer use special caracter like @ it doesn't work.
I tried to replace with %40 ...
ASCII/UNICODE... @ %40 @ Alt 64
example:
password= xxxXxxx%40yyyYyy
without sucess.
Any help apreciated
I have a script to create the curve easily.
It work perfect/
My problem is about password, if my customer use special caracter like @ it doesn't work.
I tried to replace with %40 ...
ASCII/UNICODE... @ %40 @ Alt 64
example:
password= xxxXxxx%40yyyYyy
without sucess.
Any help apreciated
Code:
----------------------------
-- creer la courbe
function createCurve(adresse, classement)
if adresse then
require('json')
require('socket.url')
require('socket.http')
-- parameters
daily = 365*24*60 -- 1 day
daily1year = 365*24*12 -- 365 day
daily2year = 2*365*24*12 -- 365 day
year5_d = 5*365 -- 5 year
trend_type = 'C' -- C is counter, D is counter with neg. delta, G is absolute value
object = adresse
if grp.find(adresse) then
--separe nom du cpt pour mettre que le libelle dans nom des courbes
nom_compteur=grp.alias(adresse)
nom_compteur_split=string.split(nom_compteur,'-')
-- si pas total, on separe
if nom_compteur_split[4] then
zone=string.gsub(nom_compteur_split[2],'CPTTD_','')
nom_compteur=zone..'-'..nom_compteur_split[5]
end
trend = {
object = knxlib.encodega(object), -- object id in db
name = nom_compteur, -- trend name
type = trend_type,
resolution = 60, -- every 5 minute
precision = 1, -- floating point precision
count_resolution = 365*24*12, -- 1 year
count_daily = 5*365, -- 5 years
category = classement
}
data = json.encode(trend)
post = 'data=' .. socket.url.escape(data)
--auth=require('mime').b64('admin:'..password)
--res, err = socket.http.request('http://'..auth..'@127.0.0.1/scada-main/trends/save', post)
res, err = socket.http.request('http://admin:'..password..'@127.0.0.1/scada-main/trends/save', post)
sleep(1)
if err then
log(res, err)
end
end
end
end
---------------------------
-----------
FRANCE SMARTHOME & SMARTBUILDING INTEGRATION
SE ECO EXPERT
FRANCE SMARTHOME & SMARTBUILDING INTEGRATION
SE ECO EXPERT