24.08.2017, 21:43
(This post was last modified: 24.08.2017, 21:46 by Erwin van der Zwart.)
Hi,
Delta has there own protocol to a IP gateway, this gateway uploads data to the Delta Cloud Service and there is no API.
What i have done before is reading the Delta gateway's HTTP pages to get the data from it.
It's written for our HVAC SmartStruxure Lite controller, also LUA but it should be easy to port to the LM controller format.
BR,
Erwin
Delta has there own protocol to a IP gateway, this gateway uploads data to the Delta Cloud Service and there is no API.
What i have done before is reading the Delta gateway's HTTP pages to get the data from it.
It's written for our HVAC SmartStruxure Lite controller, also LUA but it should be easy to port to the LM controller format.
Code:
-- ******** Delta Solivia GW -> MPM module version 1.0 created by Erwin van der Zwart ******** 2015-12-10 ******** --
if not init then
-- Import libraries
require ("http")
-- Set timout for max wait time on HTTP response
http.TIMEOUT = 15
-- Delta Solivia GW Settings
IP_Address = '192.168.10.207'
UserName = 'admin'
PassWord = 'Schneider'
-- MPM objects
var("Absolute_Maximum_In_We_Object", "ME.AV44")
var("Percentage_Of_Nominal_Power_Object", "ME.AV45")
-- End init
init = true
else
-- Login before requesting data
if not login then
response = http.request('http://' .. IP_Address .. '/LoginCgi?ed_user=' .. UserName .. '&pw1=' .. PassWord .. '&logIn=Log+in')
-- Check if Response = successfully completed
for i in string.gmatch(response, '<body><br><h2 align="left"><font color="#339900">.-</font>') do
if i ~= nil then
responsestring = i:match([[color="#339900">(.-)</]])
--print(responsestring)
end
end
if responsestring == 'Operation successfully completed!' then
print('Login procedure ready, getting values..')
login = true
end
else
-- Get data from webservice
local data = http.request('http://' .. IP_Address .. '/Unbalanced.htm')
--print(data)
-- Check if data is received
if not data then
print('No data found.. , restarting procedure to try again..')
login = nil
return
end
-- Check if login is handled correct
for i in string.gmatch(data, '<h2>.-</h2>') do
if i ~= nil then
login_asked = i:match([[<h2>(.-)</h2>]])
if login_asked == 'Please log in' then
print('Login not ready or logged out, system will try to login again..')
login = nil
return
end
end
end
-- Power Balancing
for i in string.gmatch(data, '<input type="text".-</p>') do
if i ~= nil then
--print(i)
absolute_maximum_in_We = i:match([[name="t1" value="(.-)"]])
if absolute_maximum_in_We then
Absolute_Maximum_In_We_Object = absolute_maximum_in_We
print('Absolute maximum in We = ' .. absolute_maximum_in_We)
end
percentage_of_nominal_power = i:match([[name="t2" value="(.-)"]])
if percentage_of_nominal_power then
Percentage_Of_Nominal_Power_Object = percentage_of_nominal_power
print('Percentage of nominal power = ' .. percentage_of_nominal_power)
end
end
end
-- Add extra data pagefields here...
end --End Login
end -- End init
BR,
Erwin