Logic Machine Forum
Jupiter System For gas tanks monitor - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Jupiter System For gas tanks monitor (/showthread.php?tid=3735)



Jupiter System For gas tanks monitor - khalil - 08.12.2021

Hello Dears,
I have Jupiter System for gas tanks, it uses HTTP GET and Response 
Is it possible to make an integration.

the documents attached.

BR,
.pdf   Wac_ERP_Interface_V1.0.25 October2019.pdf (Size: 519.51 KB / Downloads: 19)



RE: Jupiter System For gas tanks monitor - admin - 08.12.2021

Should be easy to do. Can provide real data output from the system and which data points you need?


RE: Jupiter System For gas tanks monitor - khalil - 08.12.2021

(08.12.2021, 13:10)admin Wrote: Should be easy to do. Can provide real data output from the system and which data points you need?

Thank you admin for the answer.
Right now I just need the answer, so the customer will confirm the installation of Jupiter system. 
we should read the analog values (Gas level in the tanks) and Alarms
BR,


RE: Jupiter System For gas tanks monitor - khalil - 13.09.2022

Hello Admin
How to read these values CurrentLevelPercent, /MeterCounter, CombinedAlertStatus?
regards,


RE: Jupiter System For gas tanks monitor - admin - 13.09.2022

Adjust URL and all parameters as needed. The resulting sites table will have the data that you need.
Code:
url = 'http://192.168.1.1/WacMobileService/WebService1.asmx/GetWacStatuses?UserName=string&Password=string&GroupId=string&SubGroupId=string&bOnlyWithAlerts=string&RequiredAlertsBitmap=string&MaxResults=string'
data, err = require('socket.http').request(url)

log('result', data, err)

if not data then
  return
end

sites = {}

callbacks = {
  StartElement = function(p, tag)
    ctag = tag

    if tag == 'wSiteStatus' then
      site = { status = {} }
      state = 'site'
    elseif tag == 'wBulkStatus' then
      status = {}
      state = 'status'
    end
  end,
  EndElement = function(p, tag)
    ctag = nil

    if tag == 'wSiteStatus' then
      state = nil

      if site.SiteId then
        sites[ site.SiteId ] = site
      end
    elseif tag == 'wBulkStatus' then
      state = 'site'

      if status.BulkId then
        site.status[ status.BulkId ] = status
      end
    end
  end,
  CharacterData = function(p, value)
    value = value:trim()

    if #value == 0 or not ctag then
      return
    end

    if state == 'site' then
      site[ ctag ] = value
    elseif state == 'status' then
      status[ ctag ] = value
    end
  end
}

parser = require('lxp').new(callbacks)
parser:parse(data)
parser:close()

log(sites)