28.08.2017, 08:54
@AlexLV, see this example, it will accept "on", "off" and any numeric value:
Code:
data = server:receive()
if data then
chunks = data:split(' ')
if #chunks == 3 and chunks[ 1 ] == 'group' then
addr = chunks[ 2 ]
value = chunks[ 3 ]
if value == 'on' then
value = true
elseif value == 'off' then
value = false
else
value = tonumber(value)
end
if value ~= nil then
grp.write(addr, value)
end
end
end