有个问题:添加blocky判断的时候总是失效,因数据为文本,无法做大于小于的判断,所以失效。
代码小白,都是照搬。研究了半月还是不会,请求帮助大神帮忙解决下。能否改写成数值格式。
贴出代码
代码: 全选
commandArray = {}
if devicechanged['pms'] then
local device = otherdevices_svalues["pms"]
print(device)
local pm1, pm25, pm10, hcho
_,_,pm1, pm25, pm10, hcho = string.find(device, "(.+);(.+);(.+);(.+)")
print(pm1) --show temp in LOG
print(pm25) --show humidity in LOG
print(pm10) --show humstat in LOG,
print(hcho) --show humstat in LOG,
commandArray[1] = {['UpdateDevice'] = 4 .. '|0|' .. pm25}
commandArray[2] = {['UpdateDevice'] = 3 .. '|0|' .. pm10}
commandArray[4] = {['UpdateDevice'] = 14 .. '|0|' .. hcho}
end
return commandArray