[EXAMPLE] Irrigation zone control

Discussion in 'C-Bus Automation Controllers' started by Daggo, Feb 26, 2018.

  1. Daggo

    Daggo

    Joined:
    Feb 21, 2018
    Messages:
    8
    Likes Received:
    0
    Just a simple manual zone control i have setup, might help others. I have another one for auto running through all stations if anyone needs too.

    Need to set zone2time levels in the object page (1 Minute) to level 1 and so on. Then in visualization set object vis parameter to display tags.

    Code:
      -- Checks if button was turned on or off
    value = event.getvalue()
    -- Gets user selected zone running time from on screen time per zone
    zone2time = GetUserParam('Local', 'zone2time')
    zoneoncheck = GetUserParam('Local', 'zoneon')
    
    if (value == 255) then
      -- Set value of user parameter 'zoneon' on local network to 2 this changes on screen display too ZONE 2 running
        SetUserParam('Local', 'zoneon', 2)   
      -- Set value of other zones to 0.
        SetCBusLevel(0, 113, 7, 0, 0)
        SetCBusLevel(0, 113, 6, 0, 0)
        SetCBusLevel(0, 113, 5, 0, 0)
        SetCBusLevel(0, 113, 4, 0, 0)
        SetCBusLevel(0, 113, 1, 0, 0)
      -- Set group 'Group 3' on application 'Irrigation' in network 'Local' to 255 over 0 seconds and after time reset to 0.
      PulseCBusLevel('Local', 'Irrigation', 'Group 3', 255, 0, zone2time * 60, 0)
      -- wait for zone2time to finish in seconds
      os.sleep(zone2time * 60)
      -- need to set this cbus level otherwise irrigation button stays on even tho its off with the pulsecbuslevel.
      SetCBusLevel(0, 113, 3, 0, 0)
      -- check to see if any other station are running if yes do nothing.
      value2 = GetUserParam('Local', 'zoneon')   
    if ( value2 == 2) then
      SetUserParam('Local', 'zoneon', 0)     
     end
      -- check to see if station 2 is running if yes then change stations status to off.
    elseif  (zoneoncheck == 2) then
      SetUserParam('Local', 'zoneon', 0)
    end
     
    Daggo, Feb 26, 2018
    #1
    1. Advertisements

  2. Daggo

    Daggo

    Joined:
    Feb 21, 2018
    Messages:
    8
    Likes Received:
    0
    Pressing button Turns on the zone you want plus turns off any other that might be on.
    Pressing button again or turning on another station will turn off the zone.
     
    Daggo, Feb 26, 2018
    #2
    1. Advertisements

  3. Daggo

    Jake N

    Joined:
    Oct 9, 2018
    Messages:
    3
    Likes Received:
    0
    Hi Daggo

    Thanks for sharing your code, ive been having a hard time getting the 'basics' to work on the 5500SHAC. I will try your code out next its exactly what ive been trying to do... Could you also post the auto running version?

    Many thanks
     
    Jake N, Feb 17, 2019
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.