openwrt: discard pwr messages when disabled
This commit is contained in:
parent
078652c277
commit
11fb4c4e64
|
@ -60,8 +60,8 @@ function receive(device, pwraddress, pwrport, pwrenable)
|
||||||
|
|
||||||
local meter, value = line:sub(5, 36), tonumber(line:sub(38))
|
local meter, value = line:sub(5, 36), tonumber(line:sub(38))
|
||||||
coroutine.yield(meter, os.time(), value)
|
coroutine.yield(meter, os.time(), value)
|
||||||
elseif line:sub(1, 3) == 'pwr' and line:len() == 47 and line:find(':') == 37 and pwrenable then -- user data + additional data integrity checks
|
elseif line:sub(1, 3) == 'pwr' and line:len() == 47 and line:find(':') == 37 then -- user data + additional data integrity checks
|
||||||
udp:send(line)
|
if pwrenable then udp:send(line) end
|
||||||
elseif line:sub(1, 3) == 'msg' then -- control data
|
elseif line:sub(1, 3) == 'msg' then -- control data
|
||||||
posix.syslog(31, 'received message from '..device..': '..line:sub(5))
|
posix.syslog(31, 'received message from '..device..': '..line:sub(5))
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue