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

Block scene function (washing machine notification)


Question

Posted

Hi everybody!

 

Just a quick question: When I create block scenes there is one "box" that I am having trouble grasping the functionality of and that is the red one where you can enter number of seconds. As I am having trouble getting a few of my block scenes to behave like I want I am wondering if someone could explain what it does exactly. Is it delay before running the next block of the scene, or is it duration of the condition/block that it is part of, or is it something else?

 

An example: I want to create a scene that tells me when the washing machine is done. So I want the scene to send a push notification to my phone when the power consumption has been less than 2W for 5 minutes. If someone could create a scene that would accomplish that and post a screen shot of it I would be very grateful.

 

The ones I have created sort of works but I get "to many instances" warnings all the time even if I select 10 instances, and so they are not really working all that great. I thought by using a variable that is changed when the condition is met would result in the scene not being started over and over again, but that is not working optimally either.

 

I realise that it would probably be better/easier to use LUA, but I have no knowledge of LUA and so I thought it would be fun to get it working with block scenes.

 

I have added screen shots of the scene that I use to set the variable, to 1 indicating that the washing machine is running, at the start of the cycle and the scene that is supposed to run once when the cycle is done.

 

Regards

Ole

Please login or register to see this attachment.

Please login or register to see this attachment.

8 answers to this question

Recommended Posts

  • 1
Posted

Not my own design, forget who did the original design. And it's working:

 

--[[
%% autostart
%% properties
983 power
%% globals
--]]

local power_socket = 983
local powerlive = fibaro:getValue(power_socket, "power") -- monitored unit
  fibaro:debug("Verbruik = "..powerlive.." Watt");
  fibaro:debug("De wasmachine staat uit (Stekker wel ingestoken)");
if (fibaro:countScenes()>1)
then
 fibaro:abort();
 fibaro:debug("Max aantal scene's bereikt!");
  end
local run = 0
local power_socket = 983
local currentDate = os.date("*t");
local power = fibaro:getValue(power_socket, "power")
local counter = 0

if ( tonumber(fibaro:getValue(power_socket, "power")) > 35 ) and run == 0 then
  local start = (os.time())
  fibaro:debug("Wasmachine is bezig")
  fibaro:debug("Verbruik = "..power.." Watt")
run = 1
end

while run == 1 do

if ( tonumber(fibaro:getValue(power_socket, "power")) < 6) then
     counter = counter + 1
    local power2 = fibaro:getValue(power_socket, "power")
        fibaro:debug('counter = ' ..counter.. " : "..power2.."Watt")
    end
          if ( tonumber(fibaro:getValue(power_socket, "power")) > 6) then
      counter = 0
    end
       if ( tonumber(fibaro:getValue(power_socket, "power")) < 6) and counter > 60 then
          fibaro:debug("Wasmachine is klaar.")
          local power3 =  fibaro:getValue(power_socket, "power")
          fibaro:debug("Verbruik 3 = "..power3.." Watt")
          fibaro:debug("Verstuur bericht")
          fibaro:call(1060, "sendPush", "Uw Wasmachine is klaar: " .. string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min)); 
          fibaro:call(616, "sendPush", "Uw Wasmachine is klaar: " .. string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min));
run = 0
       end
 
  fibaro:sleep(1*1000)
end

  • Thanks 1
  • 0
Posted

Not much help, but i can recall i did see a post around on the forum of a person that did just that in Lua. Sadly the search on the forum doesn't really like me when it comes to smart searching :)

  • 0
Posted
35 minutes ago, riemers said:

Not much help, but i can recall i did see a post around on the forum of a person that did just that in Lua. Sadly the search on the forum doesn't really like me when it comes to smart searching :)

Hi All,

 

@riemers, you must mean this one: 

 

  • 0
Posted
5 hours ago, Ole said:

Hi everybody!

 

Just a quick question: When I create block scenes there is one "box" that I am having trouble grasping the functionality of and that is the red one where you can enter number of seconds. As I am having trouble getting a few of my block scenes to behave like I want I am wondering if someone could explain what it does exactly. Is it delay before running the next block of the scene, or is it duration of the condition/block that it is part of, or is it something else?

 

An example: I want to create a scene that tells me when the washing machine is done. So I want the scene to send a push notification to my phone when the power consumption has been less than 2W for 5 minutes. If someone could create a scene that would accomplish that and post a screen shot of it I would be very grateful.

 

The ones I have created sort of works but I get "to many instances" warnings all the time even if I select 10 instances, and so they are not really working all that great. I thought by using a variable that is changed when the condition is met would result in the scene not being started over and over again, but that is not working optimally either.

 

I realise that it would probably be better/easier to use LUA, but I have no knowledge of LUA and so I thought it would be fun to get it working with block scenes.

 

I have added screen shots of the scene that I use to set the variable, to 1 indicating that the washing machine is running, at the start of the cycle and the scene that is supposed to run once when the cycle is done.

 

Regards

Ole

Please login or register to see this attachment.

Please login or register to see this attachment.

Red box delay in seconds for that line actioning

  • 0
  • Inquirer
  • Posted

    I really appreciate all the feedback though it has been all about LUA, and if it proofs impossible to do it using block scenes I will try your suggestion TRicky. But has no-one tried to get this to work using block scenes and variables? ;)

    • 0
  • Inquirer
  • Posted

    I got my block scenes working! The only thing that was missing was a pause at the end of the script, preventing it from running several times within a short period of time.

    • 0
    Posted
    33 minutes ago, Ole said:

    I got my block scenes working! The only thing that was missing was a pause at the end of the script, preventing it from running several times within a short period of time.

    Congratulations!

     

    I'm curious to the scene you made with Blocks.

     

    Would you mind to share it?

     

    TRicky

    • 0
  • Inquirer
  • Posted
    3 hours ago, TRicky said:

    Congratulations!

     

    I'm curious to the scene you made with Blocks.

     

    Would you mind to share it?

     

    TRicky

    Sure! It is very much the same as I posted further up, but with the added pause at the end and 0 in the first condition block. As you can see you need to create a 0 or 1 variable in addition to the "started" and "finished" scenes. For the pause I needed I just used a room block that doesn't do anything other than to pause the scene. If there is a cleaner way to pause a scene, let me know.

     

     

    Please login or register to see this attachment.

    Please login or register to see this attachment.

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