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

Notification if power usage drops <10W for 10 mins


Question

Posted

I'm totally new to Fibaro, this forum and home automation, so forgive me my n00b questions and if i should have found the answer somewhere else on the forum i'd like to know as well of course

Please login or register to see this image.

/emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

 

What am i trying to reach with my HC2: 

- Push notification when washing machine has finished washing

- without having to notify the system that i've turned the machine on first, it should monitor that for itself

 

What do i have: 

- the power socket of the washing machine is plugged in a Fibaro Wall Plug

 

So when the power usage of the washing machine is >10W for =>10 mins, it should conclude that the washing machine is on. 

After that previous condition, it should monitor when power usage drops <10W for =>3mins, to conclude the washing is done. 

 

I'm trying to use graphic blocks and have created two scenes: 

1. to set a variable that the status of the washing machine is ON (see picture washingmachineON.PNG) and notify by pushmessage the machine is on

2. to send a pushmessage when power usage drops (see washingmachineDONE.PNG)

 

So far i did not get the push notifications, not sure what went wrong. 

 

Also wondering if this could be done easier and nicer by creating a virtual device but i have no experience yet on that. 

 

All the help is welcome! Thanks.

Please login or register to see this attachment.

Please login or register to see this attachment.

9 answers to this question

Recommended Posts

  • 0
Posted

You don't say which FIbaro controller you have. Do you have the HCL or HC2?

 

I have done the push notification when washing is done with Lua. It was the only way, but is only possible with HC2.

See this topic: 

Please login or register to see this link.

 

I don't have changing icons, so I cannot help you with that, sorry.

  • 0
  • Inquirer
  • Posted

    Sorry, I have the HC2

     

    I will check your topic, thank you!

     

    You don't say which FIbaro controller you have. Do you have the HCL or HC2?

     

    I have done the push notification when washing is done with Lua. It was the only way, but is only possible with HC2.

    See this topic: 

    Please login or register to see this link.

     

    I don't have changing icons, so I cannot help you with that, sorry.

    • 0
    Posted

    Good luck

    Please login or register to see this image.

    /emoticons/default_icon_smile.gif" alt=":-)" />

    • 0
    Posted

    What i found out is that power consumption monitoring through block scenes is not really reliable.

     

    Lua code works better.  Instant checking can return wrong values --at least for me it never worked.  

     

    This script i use for notification if power drops under certain value or to switch off a wall plug or whatever else. Never failed.  You can adjust the timings --those 60000 aka 60 seconds-- to better suit your needs

     

     --[[ 
     %% properties 
     7 power    --device ID to be monitored
    156 --phone ID
     %% globals 
     --]] 
     
     local power 
     local isOn 
     local counter = 0 
     local scene = 4 
     
     if (fibaro:countScenes() > 1) then 
       fibaro:abort() 
     end 
     
     
     isOn=tonumber(fibaro:getValue(7, "value"))  
     fibaro:debug(isOn) 
     
     if (isOn == 1) then    
       while (counter < 8) do 
         power=tonumber(fibaro:getValue(7, "power"))      
         if (power > 100) then   --100 is the value when the script sends notification
           break 
         else 
             counter = counter+1; 
             fibaro:sleep(60000) 
         end 
         
         if (counter >= 8) then 
            fibaro:call(156, 'sendPush', "Washing machine has finished")
      --  local subject = "Email subject" -- if you need email notification also
      --  local message = "Email message" -- if you need email notification also
        fibaro:call(2, "sendEmail", subject, message)
         end 
     
       end 
     end 
     
     fibaro:sleep(60000) --60s break 
     fibaro:killScenes(scene); 
    • 0
  • Inquirer
  • Posted

     

    What i found out is that power consumption monitoring through block scenes is not really reliable.

     

    Lua code works better.  Instant checking can return wrong values --at least for me it never worked.  

     

    This script i use for notification if power drops under certain value or to switch off a wall plug or whatever else. Never failed.  You can adjust the timings --those 60000 aka 60 seconds-- to better suit your needs

     

     --[[ 
     %% properties 
     7 power    --device ID to be monitored
    156 --phone ID
     %% globals 
     --]] 
     
     local power 
     local isOn 
     local counter = 0 
     local scene = 4 
     
     if (fibaro:countScenes() > 1) then 
       fibaro:abort() 
     end 
     
     
     isOn=tonumber(fibaro:getValue(7, "value"))  
     fibaro:debug(isOn) 
     
     if (isOn == 1) then    
       while (counter < 8) do 
         power=tonumber(fibaro:getValue(7, "power"))      
         if (power > 100) then   --100 is the value when the script sends notification
           break 
         else 
             counter = counter+1; 
             fibaro:sleep(60000) 
         end 
         
         if (counter >= 8) then 
            fibaro:call(156, 'sendPush', "Washing machine has finished")
      --  local subject = "Email subject" -- if you need email notification also
      --  local message = "Email message" -- if you need email notification also
        fibaro:call(2, "sendEmail", subject, message)
         end 
     
       end 
     end 
     
     fibaro:sleep(60000) --60s break 
     fibaro:killScenes(scene); 

     

     

    Thank you very much, i will try this. However, i would really like to trigger an action only when power drops below X value AFTER there was a power rise above X value for Y minutes. In what way should i adapt the LUA script to this? 

    • 0
    Posted

    ok. let me try to make something for you. I'm nowhere near other people here when it comes to LUA. The script runs on my machine.

     

    --[[
    %% autostart
    %% properties
    %% globals
    --]]

    if fibaro:countScenes() > 1 then
       fibaro:abort();
    end

     local ReferenceWatt = 50
     local loop = 30 -- script runs every 30 seconds
     local timecheck = 20 --time difference after power change

    local sourceTrigger = fibaro:getSourceTrigger();
    function tempFunc()
     local LastWattChange = os.time() - fibaro:getModificationTime(7, 'power')
     local Watt = fibaro:getValue(7, 'power')
      --replace 7 with the ID of your wall plug--

    if ((LastWattChange > timecheck and LastWattChange < (timecheck + loop) and tonumber(Watt) < ReferenceWatt) or sourceTrigger["type"] == "other") then
     fibaro:debug("Do something here")
        -- here is where you put your command --
    end

    setTimeout(tempFunc, loop*1000)
    end

    if (sourceTrigger["type"] == "autostart") then
       tempFunc()
    end

    • 0
  • Inquirer
  • Posted

    ok. let me try to make something for you. I'm nowhere near other people here when it comes to LUA. The script runs on my machine.

     

    --[[

    %% autostart

    %% properties

    %% globals

    --]]

    if fibaro:countScenes() > 1 then

       fibaro:abort();

    end

     local ReferenceWatt = 50

     local loop = 30 -- script runs every 30 seconds

     local timecheck = 20 --time difference after power change

    local sourceTrigger = fibaro:getSourceTrigger();

    function tempFunc()

     local LastWattChange = os.time() - fibaro:getModificationTime(7, 'power')

     local Watt = fibaro:getValue(7, 'power')

      --replace 7 with the ID of your wall plug--

    if ((LastWattChange > timecheck and LastWattChange < (timecheck + loop) and tonumber(Watt) < ReferenceWatt) or sourceTrigger["type"] == "other") then

     fibaro:debug("Do something here")

        -- here is where you put your command --

    end

    setTimeout(tempFunc, loop*1000)

    end

    if (sourceTrigger["type"] == "autostart") then

       tempFunc()

    end

     

    Thank you again!

     

    Trying to understand the script: 

     

     local ReferenceWatt = 50   <-- is this the number of Watt that deviates from non-active and active? So if normal is 4 Watt, this script will trigger action at 54 Watt?

     

     local timecheck = 20 --time difference after power change  <-- and this means after 20 checks (of 30 seconds each) seeing a deviation of 50 Watt, the action is triggered?

     

    Am I reading this correct?

    • 0
    Posted

    ReferenceWatt  is the value that the script checks to decide if it does any action after the power level has dropped under 50, by any amount. This value can be set to anything.

    timecheck is expressed in seconds - those are 20 seconds.  the script will check if the last power change was done more then 20 seconds ago.

     

    PS: a word of advice: something like this doesnt work for a plug which monitors a PC for example. The power load of a PC changes all the time, you cant even get 20 seconds from the last power change usually.

     

    This works fine for TV's, washing machines, lamps etc.  

    • 0
    Posted

    ReferenceWatt  is the value that the script checks to decide if it does any action after the power level has dropped under 50, by any amount. This value can be set to anything.

    timecheck is expressed in seconds - those are 20 seconds.  the script will check if the last power change was done more then 20 seconds ago.

     

    PS: a word of advice: something like this doesnt work for a plug which monitors a PC for example. The power load of a PC changes all the time, you cant even get 20 seconds from the last power change usually.

     

    This works fine for TV's, washing machines, lamps etc.  

     

     

    I'm trying to use this script to power down after 30 minutes, i've changed the settings scan interval and timecheck but i won't get it working.

    Which settings do i need to change to shutdown after 30 minutes below x watts?

    local loop = 60 -- script runs every 60 seconds

    local timecheck = 1800 --time difference after power change

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