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

Scene aint doing what i want it to do


Question

Posted

Hello,

 

I hope somebody can help me here. i had a scene that worked perfect but after update to 4.590 it went nuts. Screens where going up and down 20 times in 1 minute.

now i changed the scene and tryed to made it as simple as possible. But i cant get it to work. it keeps making the counter 0. While it shoud not do that (i think).

 Its this scene:

--[[
%% properties
189 value
%% weather
%% events
%% globals
--]]

--local sourceTrigger = fibaro:getSourceTrigg
--local startSource = fibaro:getSourceTrigger();
local Up = fibaro:getGlobalValue("Zonw_op")  
local calc = Up - fibaro:getValue(189, "value")
if
  ((Up > fibaro:getValue(189, "value")) ) 
then
    fibaro:setGlobal("Zonwering_terras", "0");
  print (Up)
  print (fibaro:getValue(189, "value"))
end
 

 

And i had some more triggers in it, but this one seems to go wrong every time the outdoor lux changes.

i tryed to change this line: ((Up > fibaro:getValue(189, "value")) ) TO ((fibaro:getValue(189, "value") < Up) )

but nothing works.

 

the value of Up is set to 800 (doesnt change at al)

the value of 189 is at this moment far above 800, but every change of 189 makes the  Zonwering_terras change to 0 again ( other scene makes it go up with 1 every 2 minutes, that one works perfect)

i cant figure out what im doing wrong, even if i make this in block scenes it goes wrong.......

 

thanks for any help.

 

Greetings TSN

6 answers to this question

Recommended Posts

  • 1
Posted

I think the global variable is a string that you have to convert to a numeric value.

Please login or register to see this code.

 

  • Thanks 1
  • 1
Posted

Device property values and global variables are strings. Try this:

 

Please login or register to see this code.

 

  • Thanks 1
  • 0
  • Inquirer
  • Posted

     

     

    1 hour ago, kevgeniy said:

    Device property values and global variables are strings. Try this:

     

    Please login or register to see this code.

     

    thanks for ur help

     

    If i put tonumber at the local line i get an error.

     

    If i make scene like this: 

     

    --[[
    %% properties
    189 value
    452 value
    454 value
    %% weather
    %% events
    %% globals
    --]]


    local Up = fibaro:getGlobalValue("Zonw_op"); 
    local calc = Up - fibaro:getValue(189, "value");
    if
      tonumber  (( (fibaro:getValue(189, "value")< Up  ))
              or ( (fibaro:getValue(452, "value") < 12 ))
              or ( (fibaro:getValue(454, "value") > 0  ))) 
    then
        fibaro:setGlobal("Zonwering_terras", "0");
      print ('Zonwering omhoog')
    else
      print ('Niks aan het handje')
    end

     

    (added some other triggers again)

    then it seems to work.

    But it worked fore a while, but since 4.590 it went all wrong!!!

     

    So its seems to be solved, i will check tomorrow again.

     

    Thanks to u both @kevgeniy and @RH_Dreambox

     

    • 0
  • Inquirer
  • Posted (edited)
    1 hour ago, TSN2 said:

     

     

    thanks for ur help

     

    If i put tonumber at the local line i get an error.

     

    If i make scene like this: 

     

    --[[
    %% properties
    189 value
    452 value
    454 value
    %% weather
    %% events
    %% globals
    --]]


    local Up = fibaro:getGlobalValue("Zonw_op"); 
    local calc = Up - fibaro:getValue(189, "value");
    if
      tonumber  (( (fibaro:getValue(189, "value")< Up  ))
              or ( (fibaro:getValue(452, "value") < 12 ))
              or ( (fibaro:getValue(454, "value") > 0  ))) 
    then
        fibaro:setGlobal("Zonwering_terras", "0");
      print ('Zonwering omhoog')
    else
      print ('Niks aan het handje')
    end

     

    (added some other triggers again)

    then it seems to work.

    But it worked fore a while, but since 4.590 it went all wrong!!!

     

    So its seems to be solved, i will check tomorrow again.

     

    Thanks to u both @kevgeniy and @RH_Dreambox

     

     

     

    Edited by TSN2
    • 0
  • Inquirer
  • Posted

    Whats wrong in this?

     

    --[[
    %% properties
    189 value
    %% weather
    %% events
    %% globals
    --]]


    local Down =  fibaro:getGlobalValue("Zonw_neer"); 
    local Lux =   fibaro:getValue(189, "value");
    --print (Down)
    if
                 (           (Lux > Down)                           and     
                    tonumber(fibaro:getValue(452, "value")) >  12   and
                    tonumber(fibaro:getValue(454, "value")) == 0  ) 
    then 
        fibaro:setGlobal("Zonwering_terras", tonumber(fibaro:getGlobalValue("Zonwering_terras")) + 1);
        print ( '+1')
    else
      print ('Niks aan het handje')
    end
     

    one moment it works just fine, and the next moment it goes  wrong!!!!!

    i never had problems with this kind of scene's now i dont know anymore.

     

    just cant get it working. with or without tonumber it just wont work!!!

     

    grts TSN

    • 0
  • Inquirer
  • Posted

    now it seems to work again, i did use the tonumber again (like u said)

    now it looks like this: 

     

    --[[
    %% properties
    189 value
    %% weather
    %% events
    %% globals
    --]]

    local startSource = fibaro:getSourceTrigger();
    local Down =  (tonumber (fibaro:getGlobalValue("Zonw_neer"))); 
    local Lux =   (tonumber (fibaro:getValue(189, "value")));
    local calc =  (Down - Lux)
    --print (Lux)
    --print (Down)
    --print (calc)
    if (
     (  (tonumber (Lux)) > (tonumber(Down))  and  tonumber(fibaro:getValue(452, "value")) > 15  and  tonumber(fibaro:getValue(454, "value")) == 0 )
    --or
    --startSource["type"] == "other"
    )
    then 
        fibaro:setGlobal("Zonwering_terras", tonumber(fibaro:getGlobalValue("Zonwering_terras")) + 1);
        print ( '+1')
    else
      print ('Niks aan het handje')
    end

     

    I'll see if this works tomorrow............. i hope so

    Grts TSN

    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...