Lua code dimmer value

Hi there,

Is it possible to get a virtual dimmer value to use it in a reactor Lua code?

I have this working for virtual switches, reactor activity set to Lua code:

local ADDRESS = “”
local enter = string.char(0x0d, 0x0a);
local commandtosend = “TEMP:1;TEMP:1;” … enter;
local socket = require(“socket”);
local PORT = “23”
c = assert(socket.connect(ADDRESS, PORT))
print("Sending command: " … commandtosend)
local sres, serr = c:send(commandtosend)
local data, rerr = c:receive(5)

but this send a fixed temperature to the controller. Is it possible to get this command:
local commandtosend = “TEMP:1;TEMP:1;” … enter;

to use a dimmer value between 20 and 40 (also need to limit the dimmer to this range), and send it accordingly, like:
local commandtosend = “TEMP:26;TEMP:26;” … enter;

Best Home Automation shopping experience. Shop at getvera!

© 2021 Ezlo Innovation, All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules