Fibaro Universal binnary sensor with RGBW controller

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?

According to the Operating manual for the Universal sensor it will check the DS18B20 every 20 seconds by default (parameter 10). Maybe you need to change also parameter 10?

2 Likes

Thanks for response. I will set parameter 10 to 1. I will test and give a response.

I took the liberty of formatting your Lua code to make it a bit more readable. Hope that’s OK.

I was then going to reply, but saw that @korttoma had beatien me to it, with good advice!

You could make the code a bit prettier and more concise by simply using a function for all your SetLoadLevelTarget calls.

local function setLevel (level, device)
    luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {newLoadlevelTarget = l}evel, device)
end
1 Like

Thank you akbooer I wrote function and my code reads better.
I set parameter 10 to 1, but my scene works slowly.
And I think that the problem isn’t in the universal binary sensor.

Sometimes I see that the temperature has changed, but the color of the tape is late by 2-3 seconds.
Tell me please how can I see my log file?

I’ve got an idea, but I don’t know if this is possible.
Can I start associations with a scene number if changing the parameter 10,11 or 12?

Associations are a feature which connect separate Zwave devices directly, nothing to do with Vera or Luup software, or scenes.

Thank you, I see. I have 2 questions.

  1. On the RGBW controller’s settings tab , I found this (see my screenshot).

I set this setting to 1 and it seems to me that the rgbw controller began to work faster. But I don’t understand what kind of ID6?

  1. How can I see my log file?