PIR, Shac, logic control and schedule

Discussion in 'C-Bus Automation Controllers' started by max w, Mar 10, 2020.

  1. max w

    max w

    Joined:
    Sep 14, 2017
    Messages:
    24
    Likes Received:
    2
    Location:
    GB
    Hi I have a PIR and edlt controlling some lights in a bathroom which is programer with min logic and a schedule in a shac to do ..
    100% light level 07:00 - 23:00
    15% light level 23:00 - 07:00
    I now want to set a scene for the lights and some LED strip and disable the PIR, this I can get to work.
    The problem I have is trying to get the lights to run at the correct level for the time after turning off the scene.
    Has any one any smart ideas?

    :rolleyes:
     
    max w, Mar 10, 2020
    #1
  2. max w

    eha002

    Joined:
    Jun 29, 2012
    Messages:
    9
    Likes Received:
    0
    Location:
    Alstonville
    Can we take a step back and define what you are trying to achieve from a Physical level first, (pretend you are the customer asking me, the programmer to do it)

    my assumptions.
    you want the sensor to turn the light On and Off,
    And the edlt to turn them on and off.
    Overnight you only want this only come on to 15% brightness from either device, or does the switch still need to do up to full brightness?

    also what is the function of the scene?
    Disable the sensor so the light doesn't turn itself off.
    Turn on Bathroom light (does this follow the relay logic? Or needs to be brighter than 15% overnight?)
     
    eha002, Mar 13, 2020
    #2
  3. max w

    SgrAystar

    Joined:
    Oct 4, 2018
    Messages:
    57
    Likes Received:
    5
    Location:
    Melbourne, Australia
    In our bedroom ensuite I use a similar schedule which I imagine is a common config to set a dummy GA to 100% or 30%, and minimum on the dimmer to provide night lights.

    If I wanted to allow a scene to override, and return to the correct dimming state when the scene is not set, then I would approach it with an extra dummy GA and coding:

    Dim_Level_From_Schedule_GA = 100% or 15% set from the schedule
    Dim_Level_From_Scene_GA = 100% when Scene is set, 0% when scene is not set
    Dim_Level_To_Use_As_Min_On_Output_GA = Maximum of these two (Dim_Level_From_Schedule_GA or Dim_Level_From_Scene_GA)

    OT: The dummy GA that is used as the min on the output, I also put as a spare button on the DLT as short press = ON. This provides a simple override when my other half often has to get up early for work and wants 100% lighting.
     
    SgrAystar, Mar 13, 2020
    #3
  4. max w

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,524
    Likes Received:
    173
    Location:
    Adelaide, Australia
    The SHAC has a StoreScene procedure to save the current values in the specified scene. So create a scene containing the values you want to restore. When the PIR triggers (on a dummy ga) , save the scene then set whatever you want. When the pir ga turns of, set the saved scene.
     
    Ashley, Mar 13, 2020
    #4
  5. max w

    max w

    Joined:
    Sep 14, 2017
    Messages:
    24
    Likes Received:
    2
    Location:
    GB
    Hi Everyone thanks for your replies and Help. sorry if i created some confusion with the lack of the full scope!


    100% Bathroom light level 07:00 - 23:00
    15% light level 23:00 - 07:00
    PIR is set to trigger the light on with the dimmer o/p set to logic min.
    set a schedule to run
    100% light level 07:00 - 23:00 GA on the dimmer logic
    15% light level 23:00 - 07:00 GA on the dimmer logic
    scene set on edlt
    lights at 100%
    PIR Disable
    GA for dimmer logic 100%
    scene set off on edlt
    Lights bathroom 0%
    Led tape off
    PIR disable off
    GA for logic 0%

    schedule with a dummy GA to 23:00 to 7:00 set to 100% (true)
    event script looking at this GA and if its true set GA for logic to 15%

    it works but have I over complicated it?

    Thanks for all your help again!
     
    max w, Mar 16, 2020
    #5
  6. max w

    SgrAystar

    Joined:
    Oct 4, 2018
    Messages:
    57
    Likes Received:
    5
    Location:
    Melbourne, Australia
    If you use a single GA it will get overwritten by your scene handling, and when you want to return you do not know what time of day to apply.
    Separating the inputs and outputs allows you to keep a running record of time of day.

    I haven't moved onto LUA yet but the code below may serve as an example.

    Code:
        set a schedule to run
        100% light level 07:00 - 23:00 GA_input_from_schedule
        15% light level 23:00 - 07:00 GA_input_from_schedule
    
        Once SceneIsSet("scene_on_edlt") then
            begin
            SetLightingLevel("GA_input_from_scene", 100%, 0);
            end;
    
        Once NOT SceneIsSet("scene_on_edlt") then
            begin
            SetLightingLevel("GA_input_from_scene", 0%, 0);
            end;
    
        Once (HasChanged(GetLightingLevel("GA_input_from_schedule") OR HasChanged(GetLightingLevel("GA_input_from_scene") then
            begin
                If GetLightinGLevel("GA_input_from_schedule") >= GetLightingLevel("GA_input_from_scene") then
                    SetLightingLevel("GA_output_on_the_dimmer_logic", GetLightingLevel("GA_input_from_schedule"), 0)
            else
                SetLightingLevel("GA_output_on_the_dimmer_logic", GetLightingLevel("GA_input_from_scene"), 0);
            end;
    
     
    SgrAystar, Mar 17, 2020
    #6
    AntDwyer3875 and max w like this.
  7. max w

    max w

    Joined:
    Sep 14, 2017
    Messages:
    24
    Likes Received:
    2
    Location:
    GB
    ;)
    Thanks for your help works a treat!
    Good LUA example!
     
    max w, Mar 17, 2020
    #7
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.