Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

Create a scene between global variable and set point temperature.


Question

Posted

can anyone help me to figure out to Create lua programming for below case

when hub.call(225, 'setCoolingThermostatSetpoint', 22)then hub.setGlobalVariable('temp', '22')

when hub.call(225, 'setCoolingThermostatSetpoint', 23)then hub.setGlobalVariable('temp', '23')

when hub.call(225, 'setCoolingThermostatSetpoint', 24)then hub.setGlobalVariable('temp', '24')

 

i tried below coding but its having problem at bold text  location.


 

-- Function to update the global variable based on thermostat setpoint value
function setCoolingThermostatSetpoint(value)
    -- Convert the value to a string to avoid assertion errors
    local strValue = tostring(value)
 
    if strValue == "21" then
        fibaro.setGlobalVariable('temp', strValue)
    elseif strValue == "22" then
        fibaro.setGlobalVariable('temp', strValue)
    elseif strValue == "23" then
        fibaro.setGlobalVariable('temp', strValue)
    elseif strValue == "24" then
        fibaro.setGlobalVariable('temp', strValue)
    elseif strValue == "25" then
        fibaro.setGlobalVariable('temp', strValue)
    elseif strValue == "26" then
        fibaro.setGlobalVariable('temp', strValue)
    end
end
 
-- Polling for the thermostat setpoint (assuming thermostat ID is 225)
function checkThermostatSetpoint()
    -- Get the current cooling setpoint from the thermostat device
    local currentSetpoint = fibaro:getValue(225, "targetTemperature")  -- Replace with your thermostat's setpoint parameter
    if currentSetpoint then
        setCoolingThermostatSetpoint(currentSetpoint)
    else
        fibaro:debug("Failed to retrieve thermostat setpoint")
    end
end

5 answers to this question

Recommended Posts

  • 0
Posted

Please login or register to see this code.

 

aside from the actions you need to create the global variable ("temp") and ad a valiue 0

Also ad a suitable trigger to the scene. For instance a change in the current setpoint. 

  • 0
Posted

I just have a question because I'm curious - what is it needed for?

  • 0
Posted
On 12/31/2024 at 1:06 PM, Nadeem said:

can anyone help me to figure out to Create lua programming for below case

when hub.call(225, 'setCoolingThermostatSetpoint', 22)then hub.setGlobalVariable('temp', '22')

when hub.call(225, 'setCoolingThermostatSetpoint', 23)then hub.setGlobalVariable('temp', '23')

when hub.call(225, 'setCoolingThermostatSetpoint', 24)then hub.setGlobalVariable('temp', '24')

 

i tried below coding but its having problem at bold text  location.


 

-- Function to update the global variable based on thermostat setpoint value
function setCoolingThermostatSetpoint(value)
    -- Convert the value to a string to avoid assertion errors
    local strValue = tostring(value)
 
    if strValue == "21" then
        fibaro.setGlobalVariable('temp', strValue)
    elseif strValue == "22" then
        fibaro.setGlobalVariable('temp', strValue)
    elseif strValue == "23" then
        fibaro.setGlobalVariable('temp', strValue)
    elseif strValue == "24" then
        fibaro.setGlobalVariable('temp', strValue)
    elseif strValue == "25" then
        fibaro.setGlobalVariable('temp', strValue)
    elseif strValue == "26" then
        fibaro.setGlobalVariable('temp', strValue)
    end
end
 
-- Polling for the thermostat setpoint (assuming thermostat ID is 225)
function checkThermostatSetpoint()
    -- Get the current cooling setpoint from the thermostat device
    local currentSetpoint = fibaro:getValue(225, "targetTemperature")  -- Replace with your thermostat's setpoint parameter
    if currentSetpoint then
        setCoolingThermostatSetpoint(currentSetpoint)
    else
        fibaro:debug("Failed to retrieve thermostat setpoint")
    end
end

 

And I see the first issue - fibaro:getValue is for HC2, in HC3 must be fibaro.getValue = only "dot", not "double dot".
The same issue fibaro:debug must be fibaro.debug.

 

I expect that you have to see it in alert/error notification, try to read it...

  • 0
  • Inquirer
  • Posted

    Thanks @Whswede let me try and update you 

    @Jiri Dobsovic purpose of this global variable is like i am linking global variable with temperature sensor in one of my scenerio.

    • 0
  • Inquirer
  • Posted

    @Whswede here is result

     

    [05.01.2025] [12:47:28] [DEBUG] [THERMOSTAT MONITORING STARTED.]: nil[05.01.2025] [12:47:33] [ERROR] [SCENE173]: (load):18: Assertion failed: Expected number

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...