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

Stucked in LUA timer or what do I miss?


Question

Posted

Guys I will appriciate your comment and help.

case:

mechanical ventilator with 3 speed settings, operated 24/24 on speed 1, operated on speed 2 by a Yung radiografic device, by a push button speed 3 >>never used.

Goal: implement also speed 3

Mounted >> Fibaro dubble relais

Relais signals that speed 2 is operating

Wish: after 5 minutes on speed 2 >>>switch to speed 3

if operated to stop(speed 2) after 30 sec stop speed 3.

 

Problem with my LUA it starts automaticly speed 3 after 30-45 sec and I have no clue

 

 

 

Please login or register to see this attachment.

5 answers to this question

Recommended Posts

  • 0
Posted

Don't know exactly wat you mean, but this script runs every 60 sec and turn ID104 Off after 20 sec

 

I have test this

 

can you explane ID32 and ID104

 

 

  • 0
  • Inquirer
  • Posted

    Hi Kage,

    Sorry it was not complete, ID32 >>speed 2 and ID104 speed 3.

    line 9 start measuring time of running speed 2

    line 24 time setting of switch to speed 3

    line 26 start speed 3

    line 29 switch off speed 2

    switch off speed 3 still to add after 60 sec

     

    It should not auto start every 60 sec but must be triggerd by running speed 2 longer than xx sec

    the time setting is short for testing will become 300 sec for speed 2 and speed 3 will by switched of if if speed 2 is switched of manually +30 sec

    • 0
    Posted

    the tempFunc will start and runs the script every 60 sec 

    can the mechanical ventilator runs two speeds? (is it a Itho)

     

    --[[
    %% properties
    32 value
    %% events
    %% globals
    --]]

    local startSource = fibaro:getSourceTrigger()

    local speed2 = 32
    local speed3 = 104
    local endTimeSpeed2     = tonumber(20)
    local switchTo3         = tonumber(60)
    local endTimeSpeed3        = tonumber(30)

    local speed2Value        = tonumber(fibaro:getValue(speed2, "value"))
    run = tonumber(0)
    counter = tonumber(0)
    countdown = tonumber(60)

    if speed2Value == 1 then
      fibaro:debug("start scene")
      laatstebeweging = tonumber(fibaro:getModificationTime(speed2, "value"))
      run =1
    end
    while run == 1 do
      speed2Value = tonumber(fibaro:getValue(speed2, "value"))
      counter = counter + 1
      tijdnu = tonumber(os.time())
      timeLapse = tijdnu - laatstebeweging
        if timeLapse == switchTo3 then
            fibaro:debug(timeLapse.." seconds have passed!")
            fibaro:call(speed3, "turnOn")
            fibaro:debug("Going to speed 3!")
        end
          if switchTo3 + endTimeSpeed2 == counter then
            fibaro:call(speed2, "turnOff") 
            fibaro:debug("Turning of speed 2!")
        end
          if speed2Value == 0 then
            newModificationTime = tonumber(fibaro:getModificationTime(speed2, "value"))
              if tijdnu - newModificationTime > endTimeSpeed3 then
                fibaro:call(speed3, "turnOff") 
                fibaro:debug("Turning of speed 3!")
                run = 0
              end
        end      
    fibaro:sleep(1*1000)
    end

    • 0
  • Inquirer
  • Posted

    Hello Kage,

    Thanks fot the LUA, it is working great according the list above!

    Yes the ventilator runs at 3 speeds, speed1 >24/24 speed2 manually operatedand speed 3 wil run thanks to you!

    I have two bathrooms and one toilet all equiped with Yung radigrafic switches,since 1992. In that time there was no domotica! If light is switched on/off the ventilator will start/stop.

    I know I can replace it complete with Fibaro relais but in that time it was costing a small fortune, and it is working great.

    But there is a small mistake in the scene, speed 2 is manually operated, so not stopped by HC2. Can you please adapt?

    I have tried to fix it but that is far above my knowledge.

    Thanks in advance

    • 0
  • Inquirer
  • Posted

    Kage, I fixed it!Thanks for your support.

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