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.
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¶
-
generalConfig
[ "hardwareVersion", "softwareVersion", "mqttDeviceID", "modemPresent" ]
-
webConfig
[ "webRefresh", "webLanguage", "webUserSetNames", "webReadOnlyUser", "webAutoSignIn", "webHomepage", "webCheckUpdates", "webVisibility", "webPositionTop", "webPositionLeft", "picture" ]
-
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" ]
-
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" ]
-
modemConfig
[ "modemCode", "modemAPN", "modemNumberEv{1,4}", "modemTextEvT{1,4}", "modemTextEvF{1,4}", "modemReturnSMS" ]
-
modbusConfig
[ "modbusTCPServer", "modbusID{1,5}", "modbusSensor{1,5}" ]
-
modbusCConfig
[ "modbusCConfig{1,5}", "modbusCField{1,5}{1,30}" ]
-
mrConfig
[ "mConfig{1,30}" ]
-
powerConfig
[ "powerName{1,6}", "powerImpulses{1,6}", "powerIOption{1,6}", "powerUOption{1,6}", "powerUnit{1,6}", "powerCounting{1,6}", "powerSaveToMem" ]
-
eventConfig
[ "event{1,20}" ]
-
scheduleConfig
[ "schedule{1,50}" ]
-
wdConfig
[ "wdConfig{1,6}" ]
-
remoteConfig
[ "remoteEnabled", "remoteHost", "remotePort", "remotePassword", "remoteNegation", "remoteInputs{1,12}" ]
-
httpConfig
[ "httpReadingCode", "httpDigestAuth", "httpPerEnabled", "httpPerPeriod", "httpPerURL", "httpURLEvT{1,4}", "httpURLEvF{1,4}" ]
-
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" ]
-
otherSensorsValues
[ "pm1", "pm2", "pm4", "pm10", "co2" ]
-
diffValues
[ "diff{1,6}" ]
-
iDValues
[ "iDValue{1,4}", "iDImpulseTime{1,2}" ]
-
serialPortValues
[ "barcode", "distance", "duralux{0,10}" ]
-
modemValues
[ "modemConsole", "modemConnected", "modemRegistered" ]
-
modbusValues
[ "modbusValue{1,5}{1,30}" ]
-
mrValues
[ "mValue{1,30}" ]
-
powerValues
[ "power{1,6}", "energy{1,6}" ]
-
eventValues
[ "eventConditionResult{1,20}" ]
-
varValues
[ "var{1,8}" ]
-
wdValues
[ "wdEnableStatus", "wdPingTime", "wdPingFailCount", "wdRestartCount" ]
-
timeValues
[ "time", "uptimeDays", "uptimeHours", "uptimeMinutes", "uptimeSeconds" ]