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

How to delay Sprinkler based on Netatmo


Question

Posted

Hi All,

 

I have seen many suggestions on that, but none of them works for complete programming ignorant.

 

Can anybody help with step by step instruction on how to stop sprinklers depending on either weather forecast, or better based on Netatmo rain gauge reading.

 

Any help appreciated, I’m so annoyed that my old Gardena was doing better job than Fibaro.

5 answers to this question

Recommended Posts

  • 0
Posted (edited)

Hi, Im using VD with button that will set delay to defined time. Its being triggered by weather or manually. In your case, I believe it can be triggered by Netatmo (I dont have it to give it a try).

 

Please login or register to see this code.

 

Edited by Igy
  • 0
  • Inquirer
  • Posted (edited)

    Hi Igy, thanks but I use HCL and I could not use LUA. Is there a way to translate such code into string used by VD in HCL?

    Edited by PawRew
    • 0
    Posted

    I think that there is no way :-(

    • 0
    Posted (edited)

    @Igy Hey, I am also a noob if we are talking about lua code, but how can I set the virtual device to be triggered by netatmo rain gauge? Thank you very much!

    Edit: Also I want to apply it to a lua scene so I don't have to press buttons. The idea is to get the values from rain gauge and then from those values change the delay to the respective number of hours. For example, if it rains more than 100 ml the delay is set to 24 hours and if it rains more than 500ml the delay is set to 48 hours.

    Edited by Stiven
    • 0
    Posted
    On 7/22/2018 at 9:13 AM, Igy said:

    Hi, Im using VD with button that will set delay to defined time. Its being triggered by weather or manually. In your case, I believe it can be triggered by Netatmo (I dont have it to give it a try).

     

    Please login or register to see this code.

     

    Altough a few years old, this is still very nice code. Thanks a lot!

    I am not a programmer but was able to use the code for creating a new VD where I can manually delay rain for garden sprinklers.

     

    Please login or register to see this image.

    /monthly_2020_05/image.png.7a5178167b1b94cc1270290b4bbd221b.png" />

     

    I faced one problem: when I chose a delay, it kept setting that delay infinite. So I created 2 global variables, RainDelaySet and RainDelayHour. After each button I set raindelayset to 1 and RainDelayHour to the chosen hours.

    Now, when you press a button, it knows that you want to set to that value and when you do nothing, it counts back to no delay.

     

    I just installed Sankotronic Weather State and Forecast (man what an effort did he put in, respect! Well documented, good manual, outrageous). It works almost but now looking to integrate both, so I don't have to bother to set de delays myself.

     

    Example 24hr button:

    fibaro:setGlobal("RainDelaySet", "1")
    fibaro:setGlobal("RainDelayHour","24")

     

    Code for the +1 button:

    fibaro:setGlobal("RainDelaySet", "1")
    local RainDelayPlus = (tonumber(fibaro:getGlobalValue("RainDelayHour")) + 1)
    fibaro:setGlobal("RainDelayHour",RainDelayPlus)

     

    Code for the -1 button:

    fibaro:setGlobal("RainDelaySet", "1")
    local RainDelayMin = (tonumber(fibaro:getGlobalValue("RainDelayHour")) - 1)
    fibaro:setGlobal("RainDelayHour",RainDelayMin)
     

    Main loop code:

     

    HC2 = Net.FHttp("127.0.0.1", 11111); 
    -- Get RainDelay from GlobalVar and Sprinklers Panel
    if tonumber(fibaro:getGlobalValue("RainDelaySet")) == 1
      then 
        fibaro:debug("RainDelay ingesteld vanuit variabele en RainDelaySet 1 naar 0")
        RainDelayGlobalVar = tonumber(fibaro:getGlobalValue("RainDelayHour"))
          fibaro:setGlobal("RainDelaySet", "0")
        RainDelay = tonumber(fibaro:getGlobalValue("RainDelayHour"))
        response, status, errorCode = HC2:PUT("/api/panels/drenchers", '{ "rainDelay": '..RainDelay..'}')
          if tonumber(errorCode) == 0 then 
             fibaro:debug("Connection successful.");
          else 
           fibaro:debug("Connection failed!!!"); 
       end  

      else
        fibaro:debug("RainDelaySet 0 blijft 0")
      end

     

    -- get data table from the Sprinklers Panel
    response, status, errorCode = HC2:GET("/api/panels/drenchers")
    jsonTable = json.decode(response)
    delay=jsonTable.rainDelay/3600
       function round(delay, idp)
         local mult = 10^2 -- number of decimal places
         return math.floor(delay * mult + 0.5) / mult
       end
    fibaro:call(632, "setProperty", "ui.Delay.value", round(delay).." uren")  --display of actual delay on VD label
    fibaro:call(632, "setProperty", "ui.RainDelayVar.value", round(fibaro:getGlobalValue("RainDelayHour")))
     

    Don't know if it is well-coded (don't think so) but it works like a charm for me. As told, working on the automation from Sankotronics weatherforecasts.

    Maybe someone can use it.

    Thanks again @Igy

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