This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Delta DVP
#3
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.

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
Reply


Messages In This Thread
Delta DVP - by Demus - 24.08.2017, 13:52
RE: Delta DVP - by admin - 24.08.2017, 17:42
RE: Delta DVP - by Erwin van der Zwart - 24.08.2017, 21:43
RE: Delta DVP - by Demus - 25.08.2017, 06:19
RE: Delta DVP - by admin - 25.08.2017, 06:49
RE: Delta DVP - by Demus - 25.08.2017, 06:56
RE: Delta DVP - by admin - 25.08.2017, 08:15

Forum Jump: