Hi everyone. I have vera plus, fibaro RGBW controller and fibaro Universal binary sensor.
I want to control the color of the LED strip depending on the temperature of the water in the sink.
For this, I connected a sensor DS18B20 to Universal binnary sensor.
In the device settings, I set the parameter number 11 and number 12 to 1.
And wrote the following lua script:
local minColdWater=27
local maxHotWater=40
local coeff=maxHotWater-minColdWater
local lul_temp =luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature", 144)
local lightLevel=luup.variable_get("urn:upnp-org:serviceId:Dimming1","LoadLevelStatus",62)
if (tonumber(lul_temp)<minColdWater and lightLevel~="100") then
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {newLoadlevelTarget = 0}, 60)
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {newLoadlevelTarget = 100}, 61)
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {newLoadlevelTarget = 100}, 62)
end
if (tonumber(lul_temp) > minColdWater) then
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {newLoadlevelTarget = 0}, 61)
local brightesCoeff=((tonumber(lul_temp)-minColdWater)*100)/coeff
if (brightesCoeff~=100) then
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {newLoadlevelTarget = 100-brightesCoeff}, 62)
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {newLoadlevelTarget = 0+brightesCoeff}, 60)
end
end
The script runs every second, but the temperature and color of the tape changes very slowly. How can I speed up the temperature sensor and the reaction of the controller?
This is my first experience with Vera.
Maybe I’ve chosen the wrong way?