Light Level Measurement

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by Craggen, Sep 14, 2011.

  1. Craggen

    Craggen

    Joined:
    Dec 30, 2009
    Messages:
    26
    Likes Received:
    0
    Location:
    Scotland
    Hi, I'm fairly new to C-Bus and getting to grips with all the tools to support an installation I've built around a Wiser controller unit. All switches, DLTs and sensors are configured and operating as required but I'd like to begin adding some more advanced logic to provide a more dynamic lighting environment.

    My first objective is to have specific lighting groups activated when light levels fall below a certain level (taken from a 5753 series PIR - SENPIRIB). As such I've been attempting to build logic around the following 2 calls in the PICED Logic Editor.

    GetUnitParameter("Local", 11, ptLightLevel)
    GetUnitParamStatus("Local", 11, ptLightLevel)

    Unfortunately GetUnitParamStatus() continuously returns False but other commands such as SetLightingLevel() work correctly.

    Do the 5753 units support measurement of light levels and if so do they broadcast this information? Their firmware is being reported as 1.2.67.

    I also created a Monitor to check whether it would be able to read the light level but it reports "Unit not responding".

    Does anyone have any suggestions as to how I best achieve my goals?

    Thanks.
     
    Craggen, Sep 14, 2011
    #1
  2. Craggen

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    If possible you should try to use the in-built features of the SENPIRB for controlling groups, rather than using Pascal logic.

    What are you wanting to do exactly?
     
    Darren, Sep 14, 2011
    #2
  3. Craggen

    Craggen

    Joined:
    Dec 30, 2009
    Messages:
    26
    Likes Received:
    0
    Location:
    Scotland
    Hi Darren, my idea is that rather than have lights come on at fixed times I'd like them to come on based on light levels within a room going below a specified value. Similarly, if I wanted to define a "lived in" program, rather than depend on fixed times with random offsets, I could have it all initiated from a point where a room became dark enough to merit the activation of lights, more realistic to what you'd normally do manually. Is anything like this possible?

    I hope that makes sense.
     
    Craggen, Sep 14, 2011
    #3
  4. Craggen

    Newman

    Joined:
    Aug 3, 2004
    Messages:
    2,203
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    Turning on lights when the light level drops below a certain point is a native function of the 5753L's. The function is called Sunset to Sunrise.

    When the light level drops below the threshold, as defined by the adjustment screw on the unit, the Sunset to Sunrise virtual key is pressed. When the light level goes above this threshold, the virtual key is released. This enables you to do things like turn on a group and then start a timer whenever the light level drops below this threshold (the default configuration). You could also have a group address turned on whenever the light level is below the threshold and remain on until the light level rises above the threshold again.

    Whether the sensor can do what you want natively, or whether you need to use logic, will depend on the subtleties of the behaviour you're after.
     
    Newman, Sep 15, 2011
    #4
  5. Craggen

    Ingo

    Joined:
    Dec 2, 2006
    Messages:
    290
    Likes Received:
    1
    Location:
    South Africa
    Well... This is how I do it. I read the level, convert it to a level between 0-255 and then elsewhere in my Logic I action whatever happens in my Group address.

    Code:
       if GetUnitParamStatus("Local Network", 16, ptLightLevel) then
       begin
          LightLevelRear := Round(GetUnitParameter("Local Network", 16, ptLightLevel) / 13.22); { Get Light level in CBUS level }
          SetLightingLevel("Group 245 - LightLevel - Rear", LightLevelRear, "0s");
       end;
    I have one of those outside Light sensors but I think the logic would be the same. Oh, and this all assumes you have a Monitor setup in Monitor Manager to do the Light Levels...

    Ingo
     
    Ingo, Sep 15, 2011
    #5
  6. Craggen

    Craggen

    Joined:
    Dec 30, 2009
    Messages:
    26
    Likes Received:
    0
    Location:
    Scotland
    Thanks Newman, Ingo. I was actually under the impression that Sunset and Sunrise functions were based on fixed times, I'll look further into that.

    This may be the solution I'm after but I'd still like to find out why the sensor isn't returning a valid value to me. As I say, GetUnitParamStatus("Local", 11, ptLightLevel) always seems to return False suggesting that the unit doesn't either support this or not responding (it certainly operates correctly when it senses movement). This is even after the creation of a Monitor to test for LightLevel as I was unsure of whether the device would broadcast this information (no mention in documentation).

    Is there any way to confirm whether the feature is supported first of all and if so what is the best way to troubleshoot?
     
    Craggen, Sep 15, 2011
    #6
  7. Craggen

    Newman

    Joined:
    Aug 3, 2004
    Messages:
    2,203
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    In PICED, Sunrise and Sunset times are fixed in the sense that they're calculated from longditude, latitude and date, i.e. they are calculated and very accurate. In the Toolkit UI for the motion sensor the Sunset and Sunrise are just the transitions of light level around the point set by the adjustment screw.

    The GetUnitParamStatus command is used to determine if a value is valid prior to trying to use it. This is very helpful if you have logic depending upon this value. Logic starts running prior to all monitor/status variables being retrieved as this can take some time, so it's useful to know if something is valid prior to using it.

    From the help file:
    I suspect that you don't have a Monitor component configured to use this parameter, i.e. that logic is trying to retrieve a parameter for a unit from memory but no Monitor component has been configured to actually go out there and get it, hence it always returning False. A minor point is to also make sure that your Monitor refresh rate isn't too often, or you'll generate lots of network traffic. For things like light levels once a minute should be fine.

    If you've got the Monitor configured then I suggest you work through the above list one by one. It may be that you've got a hexadecimal address when you need a decimal one, for example.

    Ingo's example is a good one. The value is tested to see if it's real, prior to using it. The GetUnitParameter function is then used to retrieve the parameter.
     
    Newman, Sep 15, 2011
    #7
  8. Craggen

    Craggen

    Joined:
    Dec 30, 2009
    Messages:
    26
    Likes Received:
    0
    Location:
    Scotland
    Thanks again for the detailed explanation.

    My code is very similar to Ingos example and based on guidelines from the documentation.

    As I stated in my first post, I've tried creating a Monitor to get this value and leaving it initially to 5 minute updates but even with a forced Refresh (from the Monitor UI) is reports the unit as not responding. In that case I'd hope the parameter values would be accurate given they are created from pick lists in the UI.

    I'm aware of, but haven't used, the diagnostic utility and the Application Log (in Toolkit). Would they be of any assistance in troubleshooting? When I looked at the Application Log it was empty but appeared to be running - the Pause button was enabled).
     
    Craggen, Sep 15, 2011
    #8
  9. Craggen

    Newman

    Joined:
    Aug 3, 2004
    Messages:
    2,203
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    Hmm, curioser and curiouser. So, the issue as it seems is that the Monitor component can't get the light level from the motion sensor.

    The Application Log or the Diagnostic Utility won't help you much as the commands PICED/C-Touch/Wiser use for Monitor components to get the light level out of these units will not show up in these tools.

    This should all be possible to simulate from within PICED prior to being transferred to the unit (assuming you can make a connection to the network). When simulating you need to connect to C-Bus and wait for all networks to be on-line before the Monitors will start working. If you are simulating this are you waiting for long enough to have sync on all networks?

    I assume you're using PICED 4.10 and does your Wiser have the latest firmware? I do recall there being an issue with Monitor components in a previous version of PICED.

    Screenshots of your Monitor Manager and Monitor Item windows may be helpful.
     
    Last edited by a moderator: Sep 15, 2011
    Newman, Sep 15, 2011
    #9
  10. Craggen

    Craggen

    Joined:
    Dec 30, 2009
    Messages:
    26
    Likes Received:
    0
    Location:
    Scotland
    Newman, let me get some more details and get back to you. I am attempting to simulate from PICED and have just downloaded the latest PICED, Toolket and Firmware but I'll confirm all of this and report back.

    You may have a point with regards waiting. I may not have given it long enough to get connected to the network to allow the monitor to pick up.
     
    Craggen, Sep 16, 2011
    #10
  11. Craggen

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    I have just tested with PICED V4.10 and a SENPIRIB and it all worked perfectly. Let us know if you work out anything new.
     
    Darren, Sep 19, 2011
    #11
  12. Craggen

    Craggen

    Joined:
    Dec 30, 2009
    Messages:
    26
    Likes Received:
    0
    Location:
    Scotland
    OK, first of all to confirm version numbers, I'm all up to date from what I can see.
    PICED 4.10
    Toolkit 1.11.7
    Wiser Firmware 1.23.0

    SENPIRIB Unit Address 11, Firmware version 1.2.67

    Via PICED Monitor Manager I created a Monitor for:
    Unit: 11
    Type: LightLevel
    Rate: 60

    Via the Logic Engine I added a new module with the following code
    if (GetUnitParamStatus("Local", 11, ptLightLevel)) then
    begin
    SetRealSystemIO("EnsuiteLightLevel", GetUnitParameter("Local", 11, ptLightLevel));
    end;

    To support the above code, I created a System IO variable to store the result of the Logic call (there are probably better ways of doing this!). I then linked a Wiser widget to this variable for display on the iPhone client. It always shows 0 (zero) here and also in the System IO dialog.

    Screenshot of Network connected status, Monitor Manager and Monitor Details included.

    Have I missed something along the way?

    Thinking more about the suggestion of using the built in macro functions for Sunset and Sunrise, could I use these functions to set variables for use in other logic code?
     

    Attached Files:

    Craggen, Sep 19, 2011
    #12
  13. Craggen

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    We have found the problem. Monitors do not support the SENPIRIB unit type in the embedded devices (C-Touch, C-Touch Colour, Wiser, PAC). They work OK in PICED, HomeGate and Schedule Plus.

    This is issue #22095
     
    Darren, Sep 20, 2011
    #13
  14. Craggen

    Newman

    Joined:
    Aug 3, 2004
    Messages:
    2,203
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    If you have a Multisensor handy then you could swap out the SENPIRIB with the SENPILL (which is physically the same). The Multisensor has a Light Level Broadcasting feature that will broadcast the current light level as a group address level. Actual light level = group level x 10, so a group address level of 10 means 100 lux, a group address level of 49 means 490 lux, etc.

    You certainly can. You could configure the sensor to turn on a group address when the light level drops below the threshold, and turn it off again when it's above the threshold, for example. Just remember that for the SENPIRIB the Sunset to Sunrise feature is set around the operating point set by the adjustment screw, so it is not literally Sunset or Sunrise. If you want to use the actual times of sunset/sunrise then that's in-built in the logic engine.
     
    Newman, Sep 20, 2011
    #14
  15. Craggen

    Craggen

    Joined:
    Dec 30, 2009
    Messages:
    26
    Likes Received:
    0
    Location:
    Scotland
    Unfortunately I don't have a Multisensor handy to try what you suggest. I think at this stage I'll just need to try an alternative approach based around the switching of a Group Address when the appropriate light levels are reached.

    With regards the issue number mentioned, is the tracker database accessible to the public? Do you issue firmware updates for these units periodically?

    Thanks again for all your help.
     
    Craggen, Sep 20, 2011
    #15
  16. Craggen

    Newman

    Joined:
    Aug 3, 2004
    Messages:
    2,203
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    The issues database is not public.

    The Wiser firmware is updated semi-regularly so you'll likely see this issue fixed at some point.
     
    Newman, Sep 21, 2011
    #16
  17. Craggen

    Josh

    Joined:
    Aug 25, 2004
    Messages:
    240
    Likes Received:
    0
    Location:
    Pretoria, South Africa
    Ingo, are you using this logic on a PAC?
     
    Josh, Jan 23, 2013
    #17
  18. Craggen

    Ingo

    Joined:
    Dec 2, 2006
    Messages:
    290
    Likes Received:
    1
    Location:
    South Africa
    Yes.
     
    Ingo, Jan 23, 2013
    #18
  19. Craggen

    Josh

    Joined:
    Aug 25, 2004
    Messages:
    240
    Likes Received:
    0
    Location:
    Pretoria, South Africa
    I have the Monitor setup, but GetUnitParamStatus always returns false.
     
    Josh, Jan 23, 2013
    #19
  20. Craggen

    Ingo

    Joined:
    Dec 2, 2006
    Messages:
    290
    Likes Received:
    1
    Location:
    South Africa
    Strange, it should return 'True' at some point otherwise your sensor might be faulty. Make sure your address is correct as mine is on ID 16.
     
    Ingo, Jan 23, 2013
    #20
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.