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


Automatic Lightning System for HC3 (Motion/Average Lux)


chiel-s

Recommended Posts

Guest
On 9/7/2020 at 2:30 PM, 10der said:

PS: If you used some additional vars from sun calculation do not forget import my QA with 

 

 

ths QA alos update globalvars with actial values.

 

@Bodyart

@10der seems like our pictures has expired in the pastebin or similar (no pictures/links on my end.)

 

I'm trying to get your QA to work with my variable StateSleeping (to keep one level daytime and one when not sleeping, or even better have a variable with sleeping/awake and one with time of day) but have not figured it out yet...

 

Also you refer to another QA for custom variables.. where can I find that one?

Edited by tortho
Link to comment
Share on other sites

Guest

@10der or Anyone please help...

 

I want to set a dim level based on either:

Profile (Fibaro or the QA profile)

A global variable with states (State: Sleeping, morning, day, evening etc.)

 

It seems like times do not do what I want as sleeping is not a fixed time.

Profiles I have not managed to work... please see below example.. Have also tried to set profiles inside a times{} without any luck..

 

Using the 

"Motion lights QA v1.3.07102020.1"

 

Setting profiles with: 

fibaro.call(153, "setProfile", "Sleeping")

 

I get this:

01.01.2021] [18:29:38] [DEBUG] [QA_MOTION_LIGHTS_153]: 18:29 | January 01, 2021 loaded 14 lighting rules[01.01.2021] [18:29:38] [DEBUG] [QA_MOTION_LIGHTS_153]: 18:29 | January 01, 2021 started...[01.01.2021] [18:30:03] [DEBUG] [QA_MOTION_LIGHTS_153]: onAction: {"args":["Sleeping"],"actionName":"setProfile","deviceId":153}[01.01.2021] [18:30:03] [DEBUG] [QA_MOTION_LIGHTS_153]: setProfile Sleeping

 

One of my lights...

    GangNord1 = {
    name = "GangNordDag",
    sensors = {42,148, 47, 222}, --42 Bevegelse GangSyd, 148 bev gangnord2, 47 gangnord 1, 222 toalett dør
    powers = {653}, --653 taklys gangnord 
    profiles = {
            ["Sleeping"] = {
                level = (5),
                timeout = 6
            },
            ["Default"] = {
                level = (100),
                timeout = 600
            }
    }
},
Edited by tortho
Link to comment
Share on other sites

1 hour ago, tortho said:

Anyone please help...

 

can you turn on debugMode?

 

 

Please login or register to see this attachment.

Please login or register to see this code.

 

Link to comment
Share on other sites

Guest

@10der Thanks for the updated QA.

As you will see below, light goes on with 99% regardless if I push the profile Sleeping or Default

Seems like both timeout and level works according to some other timing and levels not defined in lighting.

 

Lighting file:

lighting = {
 
    GangNord1 = {
    name = "GangNordDag",
    sensors = {42,148, 47, 222}, --42 Bevegelse GangSyd, 148 bev gangnord2, 47 gangnord 1, 222 toalett dør
    powers = {653}, --653 taklys gangnord 
    profiles = {
            ["Sleeping"] = {
                levels = (5),
                timeout = 6
            },
            ["Default"] = {
                levels = (20),
                timeout = 600
            }
    }
}
}

 

Debug:

[01.01.2021] [19:55:03] [DEBUG] [QA_MOTION_LIGHTS_153]: starting Motion lights QA v1.3.01012021.1...

[01.01.2021] [19:55:03] [DEBUG] [QA_MOTION_LIGHTS_153]: 19:55 | January 01, 2021

[01.01.2021] [19:55:03] [DEBUG] [QA_MOTION_LIGHTS_153]: 19:55 | January 01, 2021 loaded 1 lighting rules

[01.01.2021] [19:55:03] [DEBUG] [QA_MOTION_LIGHTS_153]: 19:55 | January 01, 2021 started...

[01.01.2021] [19:55:13] [DEBUG] [QA_MOTION_LIGHTS_153]: 19:55 | January 01, 2021 GangNordDag Sensor breached

[01.01.2021] [19:55:13] [DEBUG] [QA_MOTION_LIGHTS_153]: 19:55 | January 01, 2021 GangNordDag [on : 99]

[01.01.2021] [19:55:46] [DEBUG] [QA_MOTION_LIGHTS_153]: onAction: {"args":["Sleeping"],"actionName":"setProfile","deviceId":153}

[01.01.2021] [19:55:46] [DEBUG] [QA_MOTION_LIGHTS_153]: setProfile Sleeping

[01.01.2021] [19:55:47] [DEBUG] [QA_MOTION_LIGHTS_153]: 19:55 | January 01, 2021 GangNordDag Sensor safe

[01.01.2021] [19:55:57] [DEBUG] [QA_MOTION_LIGHTS_153]: 19:55 | January 01, 2021 GangNordDag Sensor breached

[01.01.2021] [19:56:30] [DEBUG] [QA_MOTION_LIGHTS_153]: 19:56 | January 01, 2021 GangNordDag Sensor safe

[01.01.2021] [19:57:30] [DEBUG] [QA_MOTION_LIGHTS_153]: 19:57 | January 01, 2021 GangNordDag [off by timeout]

[01.01.2021] [20:00:36] [DEBUG] [QA_MOTION_LIGHTS_153]: onAction: {"args":["Default"],"actionName":"setProfile","deviceId":153}[01.01.2021] [20:00:36] [DEBUG] [QA_MOTION_LIGHTS_153]: setProfile Default

[01.01.2021] [20:00:44] [DEBUG] [QA_MOTION_LIGHTS_153]: 20:00 | January 01, 2021 GangNordDag Sensor breached

[01.01.2021] [20:00:44] [DEBUG] [QA_MOTION_LIGHTS_153]: 20:00 | January 01, 2021 GangNordDag [on : 99]

[01.01.2021] [20:01:14] [DEBUG] [QA_MOTION_LIGHTS_153]: 20:01 | January 01, 2021 GangNordDag Sensor safe

[01.01.2021] [20:02:13] [DEBUG] [QA_MOTION_LIGHTS_153]: 20:02 | January 01, 2021 GangNordDag [off by timeout]

 

 

Edited by tortho
Link to comment
Share on other sites

haven't checked that QA, so quick question: did you guys make use of linked device for light/lux sensor? 

Sometimes not the avarage, but median is what we looking for, e.g. to get rid of spike made by one sensor which got direct sunlight (where the others are "in the dark") or from lamp. To simply decide what one need, one can use linked device, and decide later if max/min/avg/median are the values we looking for

 

Please login or register to see this image.

/monthly_2021_01/image.png.0003cae5c297cf7ea68bc1f4ae3b8703.png" />

  • Thanks 2
Link to comment
Share on other sites

Guest
2 hours ago, tinman said:

haven't checked that QA, so quick question: did you guys make use of linked device for light/lux sensor? 

Sometimes not the avarage, but median is what we looking for, e.g. to get rid of spike made by one sensor which got direct sunlight (where the others are "in the dark") or from lamp. To simply decide what one need, one can use linked device, and decide later if max/min/avg/median are the values we looking for

 

 

I have not used linked devices but will for sure try it our in a couple of rooms where I have multiple sensors.

For my issue above it is not lux related as that room is an internal hallway and want light on regardless.

Link to comment
Share on other sites

17 hours ago, tortho said:

Seems like both timeout and level works according to some other timing and levels not defined in lighting.

just looking your init code and found what wrong.

 

just compare your code and my

 

Please login or register to see this code.

 

so 

profiles

 

shoud be within

times

 

Link to comment
Share on other sites

Guest
1 hour ago, 10der said:

so 

profiles

 

shoud be within

times

 

 

@10derNoted that and tried but must have done something wrong..

 

I do not want to set timing (sunset or hours..) on this, I just want to set profiles with various levels and timeout.

Will this be possible?

 

And can you then create a sample of 3 profiles

-default as I assume it does not keep the profile after restart?

-sleeping with a different timeout and levels

-evening with a different timeout and levels

 

Or if other have some good thoughts on how to control without binding to hours or sunset/rise. 

Link to comment
Share on other sites

2 hours ago, tortho said:

 

@10derNoted that and tried but must have done something wrong..

 

I do not want to set timing (sunset or hours..) on this, I just want to set profiles with various levels and timeout.

Will this be possible?

 

And can you then create a sample of 3 profiles

-default as I assume it does not keep the profile after restart?

-sleeping with a different timeout and levels

-evening with a different timeout and levels

 

Or if other have some good thoughts on how to control without binding to hours or sunset/rise. 

 

long story short if you want to control timing by itself please set 

 

Please login or register to see this code.

 

1) script was designed for time-sloting and this script has is time-sloting driving model

2) profiles was designed only for overriding time-sloting.

 

 

but do ask me why event was occured at Eveving as Morning :) cuz (again) you disable own time-driving and switching on own.

Link to comment
Share on other sites

3 hours ago, tortho said:

I do not want to set timing

Please login or register to see this code.

 

Link to comment
Share on other sites

Guest

Thank you @10der, I will load profile from a global var at startup as well and believe then I'm pretty much covered :-D

 

I have a box with indication light and a switch outside the bedroom door on 2nd floor which controls a fibaro smart implant and then easily turn on "sleeping" and perimeter/1st floor alarm when I go to bed.

Will then use this to set the global variable and all will then go to lowest dim when motion is detected nighttime :-)

 

Link to comment
Share on other sites

  • Topic Author
  • Hi @10der,

     

    Thanks for sharing a new version of the script. Great.

    Question, when I enable the debug mode, the script is keep on displaying messages like:

     

    Please login or register to see this code.

     

    Is that normal? Thanks.

    Link to comment
    Share on other sites

    Strange , it’s trace 

    just trace how parsed time

    its ok and not ok in some time ;) 

    Link to comment
    Share on other sites

  • Topic Author
  • Hi @10der,

     

    Got a question.

    I want to switch on a light only based on time and lux, not when there is motion.

    Currently I use the following code in combination with a Fibaro power plug:

     

    Please login or register to see this code.

     

    This works very well. Global variable is always 1.

     

    When I try exactly the same with another light (Fibaro switch) it works when I run the script, but next day it won't turn on. 

     

    Please login or register to see this code.

     

    What can be wrong? Is this the correct way of doing this? Or should I use the timed = true? Timed is not working neither.

     

     

    Edited by chiel-s
    Link to comment
    Share on other sites

    14 hours ago, chiel-s said:

    Hi @10der,

    hi!

     

    if i am right catch your idea:

     

    1) this QA can't work without motion triggering. it always trying to check motion.

    2) motion definition can be absent if you what just control lighting what manual turned

    for example my wife always forget to turn off garden ligths after she worked in garden

     

      Garden = {
        name = "Garden backlight",
        manual = true,
        sensors = {},
        powers = {"Garden/lighting"},
        timeout = 60 * 30
      },
     
    so, after manual turning on by wife ? QA turn off without any checks lighting after 30 min.

     

    3) if you want use this QA without motion you can do a little trick

     

    Please login or register to see this image.

    /monthly_2021_01/image.png.d96fbeda545cb4ba0a6ab38a17d99e3e.png" />

     

     

    Please login or register to see this code.

     

     

    [05.01.2021] [13:08:08] [DEBUG]: starting Motion lights QA v1.3.01012021.1...

    13:08 | January 05, 2021    started...
    13:08 | January 05, 2021    Testing    Sensor breached
    13:08 | January 05, 2021    Testing    [is not dark for lighting]    25/10
    13:08 | January 05, 2021    loaded 1 lighting rules
    (cover lux device)

     

    13:15 | January 05, 2021    Testing    Sensor breached
    13:15 | January 05, 2021    Testing    [on : 99]
    13:15 | January 05, 2021    Testing    Sensor breached
     

    (uncover)

    13:17 | January 05, 2021    Testing    [off by lux]

     

     

     

     

     

     

     

     

     

    Edited by 10der
    Link to comment
    Share on other sites

  • Topic Author
  • Thanks for your reply @10der.

    The trick you explained is exactly what I have implemented. But I think i found my mistake in the code. I had 2 pieces of code:

     

    Please login or register to see this code.

     

    I think the timeout of Voordeur_beweging was turning off the light of Voordeur_avond. I now combined it:
     

    Please login or register to see this code.

     

    I think I fixed it now ?

     

    Cheers,

    Chiel

     
     
     
    • Thanks 1
    Link to comment
    Share on other sites

    • 2 weeks later...

    Hi @10der,

     

    If the powers have to be active solely between saying Dec 1st to Dec 25th on each year between 5:00 p.m. and 5:00 a.m., what should be inserted in times = ?

    All other conditions ( sensors, luxs ) do have their specific values.

     

    One other suggestion to improve the code is to add on the "log" text ( i.e

    self:updateProperty("log","" .. os.date("%H:%M | %d.%b.%Y") .. " turned Off") )

    the time when the powers were turned ON respectively when the powers were turned OFF. Unfortunately my skills in coding are limited and I am having problems to identify were such command have to be inserted. Can you help ?

     

    Thanks in anticipation,

    Dan

     

     

     

    • Thanks 1
    Link to comment
    Share on other sites

  • Topic Author
  • Hi @10der,

     

    Got a question.

    I want to disable the motion sensors in a room when I am sleeping. This way my cats won't turn the lights on when moving around. I want to achieve this by using the Profile functionality. So when the Fibaro Profile is set to "Home" the lights will turn on. When the Fibaro Profile is set to "Night" (or any other Profile) the lights won't turn on.

     

    I created the following script but the debug returns "Test [is not time for lighting]".

    Do you have any suggestions?

     

    Please login or register to see this code.

     

    Thanks! :-)

    Link to comment
    Share on other sites

    1 hour ago, chiel-s said:

    Hi @10der,

     

    Got a question.

    I want to disable the motion sensors in a room when I am sleeping. This way my cats won't turn the lights on when moving around. I want to achieve this by using the Profile functionality. So when the Fibaro Profile is set to "Home" the lights will turn on. When the Fibaro Profile is set to "Night" (or any other Profile) the lights won't turn on.

     

    I created the following script but the debug returns "Test [is not time for lighting]".

    Do you have any suggestions?

     

    Please login or register to see this code.

     

    Thanks! :-)

     

    can you forgot for this feature? i am said about fxxxxxing profiles?

     

    just add a global var

     

    Please login or register to see this attachment.

     

    Please login or register to see this code.

     

    override = "WorkRoomLED",

     

    Edited by 10der
    Link to comment
    Share on other sites

    PS: 

     

    test = {
        name = "Testing",
        sensors = {745},
        powers = {989},
        timeout = 1,
        debugMode = true,
        times = {
          ["06:00..18:00"] = {},
          profiles = {
            ["MyProfile"] = {
              ["06:00..23:55"] = {
                timeout = 60
              }
            }
          }
        }
      }
      

     

     

    [16.01.2021] [23:27:36] [DEBUG]: setProfile MyProfile
    23:27 | January 16, 2021    Testing    using MyProfile profile
    23:28 | January 16, 2021    Testing    using MyProfile profile
    23:28 | January 16, 2021    Testing    Sensor breached
    23:28 | January 16, 2021    Testing    [on : 99]
     

    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Reply to this topic...

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