Skip to content

Data reading

Data from LK4 can be read on demand by special HTTP request and MQTT command. All device parameters are divided into reading groups, so that only the desired values can be freely selected and read. The response contains variables from selected groups in JSON format.

HTTP

Two queries are available - one for static data and one for dynamic data (a conventional term). The data to be read is selected by placing selected groups as parameters of the HTTP query as follows:

  • static data:

    http://[IP]/api/v1/read/set/?[GRUPA 1]
    
    http://[IP]/api/v1/read/set/?[GRUPA 1]&[GRUPA 2]&[GRUPA 3]
    

    e.g.

    http://192.168.1.100/api/v1/read/set/?outConfig
    
    http://192.168.1.100/api/v1/read/set/?outConfig&dsConfig&i2cConfig&diffConfig
    
  • dynamic data:

    http://[IP]/api/v1/read/status/?[GRUPA 1]
    
    http://[IP]/api/v1/read/status/?[GRUPA 1]&[GRUPA 2]&[GRUPA 3]
    

    e.g.

    http://192.168.1.100/api/v1/read/status/?boardValues
    
    http://192.168.1.100/api/v1/read/status/?boardValues&statusValues&timeValues&outValues&dsValues&i2cValues&diffValues
    

A complete list of groups and their data is described in List of groups.

Access permissions with Basic Authentication

When Basic Authentication is enabled, access to data groups depends on the user role. These restrictions apply only to HTTP requests and do not affect MQTT.

  • Public (without authentication):

    • publicConfig
  • User user:

    • static groups:
      webConfig, outConfig, pwmConfig, iAConfig, dsConfig, i2cConfig, otherSensorsConfig, diffConfig, iDConfig, powerConfig, modbusConfig, modbusCConfig, modbusCmdConfig, mrConfig, varConfig
    • dynamic groups:
      boardValues, statusValues, timeValues, outValues, pwmValues, iAValues, dsValues, i2cValues, otherSensorsValues, diffValues, iDValues, powerValues, mrValues, varValues
  • User admin:

    • access to all data groups.

MQTT

This feature will be available in a future firmware release.

The command to read data via MQTT should be sent like other MQTT commands (more about this). The command format is as follows:

read=[GRUPA 1]

read=[GRUPA 1]&[GRUPA 2]&[GRUPA 3]

List of groups

Groups of readings are divided into two types:

  • with static data such as settings, names of sensor readings
  • with dynamic data such as sensor readings

Group types are read by separate queries, and each query may contain many groups (reading method described above).

In the list below, the names of some variables are supplemented with {X,Y}, which means that it is a set of readings. For example, iDValue{1,2} corresponds to iDValue1 and iDValue2, and oledLine{1,4}{1,4} corresponds to oledLine1, oledLine12, oledLine13, oledLine14, oledLine21, oledLine22, oledLine23, oledLine24, oledLine31, oledLine32, oledLine33, oledLine34, oledLine41, oledLine42, oledLine43, oledLine44.

Static data

  • publicConfig

    [
        "hardwareVersion",
        "softwareVersion",
        "webLanguage",
        "webRefresh",
        "webHomepage",
        "webAutoSignIn", // not used since SW 1.38
        "netHostname"
    ]
    
  • generalConfig

    [
        "hardwareVersion",
        "softwareVersion",
        "mqttDeviceID",
        "modemPresent"
    ]
    
  • webConfig

    [
        "webRefresh",
        "webLanguage",
        "webUserSetNames",
        "webReadOnlyUser",
        "webAutoSignIn", // not used since SW 1.38
        "webHomepage",
        "webCheckUpdates", // reserved for future use
        "webVisibility",
        "webPositionTop",
        "webPositionLeft",
        "picture" // reserved for future use
    ]
    
  • varConfig

    [
        "varName{1,8}"
    ]
    
  • outConfig

    [
        "outName{1,6}",
        "outAutoSwitch{1,6}",
        "outAutoSwitchH{1,6}",
        "outAutoSwitchL{1,6}",
        "outStartOn{1,6}",
        "outStartOnTime{1,6}",
        "outResetTime{1,6}",
        "outSaveState{1,6}",
        "outNegation",
        "outLock"
    ]
    
  • pwmConfig

    [
        "pwmName{1,3}",
        "pwmChangeTime{1,3}",
        "pwmActiveLow{1,3}",
        "pwmModeOnOff{1,3}"
    ]
    
  • regConfig

    [
        "regMode",
        "regEnabled",
        "regPIDInput",
        "regPIDTarget",
        "regPIDKp",
        "regPIDKi",
        "regPIDKd",
        "regPIDOutput",
        "regPIDSpeed",
        "regPIDInvInput",
        "reg3PTarget",
        "reg3PDelayPWM",
        "reg3PMinTime",
        "reg3PDelayAct",
        "reg3POutput",
        "reg3PSpeed",
        "reg3PInvInput",
        "regPInput",
        "regPTarget",
        "regPMaxPwr",
        "regPDelayAct",
        "regPOutput",
        "regPSpeed",
        "regPInvInput",
        "regVInput1",
        "regVInput2",
        "regVInput3",
        "regVTarget",
        "regVCtTime",
        "regVDelayAct",
        "regVOutput",
        "regVSpeed",
        "regVInvInput"
    ]
    
  • iAConfig

    [
        "iAName{1,3}",
        "iASensor{1,3}",
        "iACalibration{1,3}",
        "iAMultiplier{1,3}"
    ]
    
  • dsConfig

    [
        "dsName{1,8}",
        "dsID{1,8}",
        "dsOffset{1,8}"
    ]
    
  • i2cConfig

    [
        "i2cPressureCal",
        "i2cTempName",
        "i2cHumName",
        "i2cPressureName",
        "i2cSensor",
        "i2cPMSensor",
        "i2cCO2Sensor",
        "i2cFrequency",
        "i2cINA740Sensor", // added in SW 1.24
        "i2cMLX90614Sens" // added in SW 1.38
    ]
    
  • otherSensorsConfig

    [
        "pm1Name",
        "pm2Name",
        "pm4Name",
        "pm10Name",
        "co2Name"
    ]
    
  • diffConfig

    [
        "diffName{1,6}",
        "diffConfig1S{1,6}",
        "diffConfig2S{1,6}",
        "diffConfigO{1,6}"
    ]
    
  • iDConfig

    [
        "iDName{1,4}",
        "iDNegation{1,4}",
        "iDBistable{1,4}",
        "iDBistableTime{1,4}",
        "iDCountImpulse{1,2}"
    ]
    
  • serialPortConfig

    [
        "uartSensor" // reserved for future use
    ]
    
  • modemConfig

    [
        "modemCode",
        "modemAPN",
        "modemNumberEv{1,4}",
        "modemTextEvT{1,4}",
        "modemTextEvF{1,4}",
        "modemReturnSMS",
        "modemCLIP", // added in SW 1.38
        "modemCLIPNumber", // added in SW 1.38
        "modemCLIPOutput" // added in SW 1.38
    ]
    
  • modbusConfig

    [
        "modbusTCPServer",
        "modbusID{1,5}",
        "modbusSensor{1,5}"
    ]
    
  • modbusCConfig

    [
        "modbusCConfig{1,5}",
        "modbusCField{1,5}{1,30}"
    ]
    
  • modbusCmdConfig

    [
        "modbusCommand{1,10}",
    ]
    
  • mrConfig

    [
        "mConfig{1,30}"
    ]
    
  • powerConfig

    [
        "powerName{1,6}",
        "powerImpulses{1,6}",
        "powerIOption{1,6}",
        "powerUOption{1,6}",
        "powerUnit{1,6}",
        "powerCounting{1,6}",
        "powerSaveToMem",
        "powerPriceEnbl", // added in SW 1.24
        "powerPriceMode", // added in SW 1.24
        "powerPriceDVal", // added in SW 1.24
        "powerPriceDAPI" // added in SW 1.24
    ]
    
  • eventConfig

    [
        "event{1,20}"
    ]
    
  • scheduleConfig

    [
        "schedule{1,50}"
    ]
    
  • wdConfig

    [
        "wdConfig{1,6}"
    ]
    
  • remoteConfig

    [
        "remoteEnabled",
        "remoteHost",
        "remotePort",
        "remotePassword",
        "remoteNegation",
        "remoteInputs{1,12}"
    ]
    
  • httpConfig

    [
        "httpModem", // not used since SW 1.18a
        "httpReadingCode",
        "httpDigestAuth",
        "httpPerEnabled",
        "httpPerPeriod",
        "httpPerURL",
        "httpPerMethod", // added in SW 1.38
        "httpPerHeaders", // added in SW 1.38
        "httpPerBody", // added in SW 1.38
        "httpURLEvT{1,4}",
        "httpURLEvF{1,4}",
        "httpMethodEvT1{1,4}", // added in SW 1.38
        "httpMethodEvF1{1,4}", // added in SW 1.38
        "httpHeadersEvT1{1,4}", // added in SW 1.38
        "httpHeadersEvF1{1,4}", // added in SW 1.38
        "httpBodyEvT1{1,4}", // added in SW 1.38
        "httpBodyEvF1{1,4}" // added in SW 1.38
    ]
    
  • mqttConfig

    [
        "mqttEnabled",
        "mqttAuth",
        "mqttTLS",
        "mqttLWT",
        "mqttHost",
        "mqttPort",
        "mqttLogin",
        "mqttPassword",
        "mqttPrefix",
        "mqttPeriod",
        "mqttKeepAlive",
        "mqttSend",
        "mqttSendChanges"
    ]
    
  • snmpConfig

    [
        "snmpTrapEnabled",
        "snmpV2Enabled",
        "snmpV3Enabled",
        "snmpCommRead",
        "snmpCommWrite",
        "snmpCommTrap",
        "snmpTrapReceive",
        "snmpUser",
        "snmpAuthPass",
        "snmpPrivacyPass"
    ]
    
  • networkConfig

    [
        "netHostname",
        "netHttpPort",
        "netHttpsOn",
        "netMac",
        "netDhcp",
        "netIp",
        "netMask",
        "netGateway",
        "netDns1",
        "netDns2",
        "netWifi",
        "netWifiMode",
        "netWifiSSID",
        "netWifiSecurity",
        "netWifiPass",
        "netWifiDhcp",
        "netWifiIp",
        "netWifiMask",
        "netWifiGateway",
        "netWifiDns1",
        "netWifiDns2"
    ]
    
  • timeConfig

    [
        "timeNTP",
        "timeNTPHost",
        "timeNTPPort",
        "timeTimezone",
        "timeNTPPeriod"
    ]
    
  • accessConfig

    [
        "auth",
        "upgr",
        "adminLogin",
        "adminPass",
        "userLogin",
        "userPass",
        "authUser{1,50}"
    ]
    
  • emailConfig

    [
        "emailHost",
        "emailPort",
        "emailTLS",
        "emailUser",
        "emailPassword",
        "emailSender",
        "emailWdTo",
        "emailWdSubj",
        "emailWdText",
        "emailToEvT{1,4}",
        "emailToEvF{1,4}",
        "emailSubjEvT{1,4}",
        "emailSubjEvF{1,4}",
        "emailTextEvT{1,4}",
        "emailTextEvF{1,4}"
    ]
    
  • oledConfig

    [
        "oledEnabled",
        "oledTime",
        "oledSize",
        "oledScreen{1,4}",
        "oledLine{1,4}{1,4}",
        "oledFrequency"
    ]
    

Dynamic data

  • boardValues

    [
        "boardVoltage",
        "boardTemp",
        "boardHum"
    ]
    
  • statusValues

    [
        "restartFlag",
        "oledScreenNow",
        "netWifiStatus",
        "mqttConnected"
    ]
    
  • outValues

    [
        "out{1,6}",
        "outAutoSwitchE{1,6}"
    ]
    
  • pwmValues

    [
        "pwm{1,3}",
        "pwmDuty{1,3}",
        "pwmFrequency"
    ]
    
  • regValues

    [
        "regOutputDuty"
    ]
    
  • iAValues

    [
        "iAValue{1,3}",
        "iARawValue{1,3}"
    ]
    
  • dsValues

    [
        "ds{1,8}",
        "dsReadID"
    ]
    
  • i2cValues

    [
        "i2cTemp",
        "i2cHum",
        "i2cPressure",
        "i2cAirQuality",
        "dewPoint",
        "i2cAddSensor{1,5}", // added in SW 1.24
        "i2cAddValue{1,5}{1,5}" // added in SW 1.24
    ]
    
  • otherSensorsValues

    [
        "pm1",
        "pm2",
        "pm4",
        "pm10",
        "co2"
    ]
    
  • diffValues

    [
        "diff{1,6}"
    ]
    
  • iDValues

    [
        "iDValue{1,4}",
        "iDImpulseTime{1,2}"
    ]
    
  • serialPortValues

    [
        "barcode",
        "distance",
        "duralux{0,10}" // reserved for future use
    ]
    
  • modemValues

    [
        "modemConsole",
        "modemConnected",
        "modemRegistered"
    ]
    
  • modbusValues

    [
        "modbusValue{1,5}{1,30}"
    ]
    
  • mrValues

    [
        "mValue{1,30}"
    ]
    
  • powerValues

    [
        "power{1,6}",
        "energy{1,6}",
        "powerPriceFVal" // added in SW 1.24
    ]
    
  • eventValues

    [
        "eventConditionResult{1,20}"
    ]
    
  • varValues

    [
        "var{1,8}"
    ]
    
  • wdValues

    [
        "wdEnableStatus",
        "wdPingTime",
        "wdPingFailCount",
        "wdRestartCount"
    ]
    
  • timeValues

    [
        "time",
        "uptimeDays",
        "uptimeHours",
        "uptimeMinutes",
        "uptimeSeconds"
    ]