Jump to content

Automatic Lightning System for HC3 (Motion/Average Lux)


Recommended Posts

  • Replies 54
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

See example below. I use global variable for my TV and my Sonos in the kitchen. Make sure to use 0 (off) and 1 (on) as value for the gobal variables.   Keuken = { name = "Keuken", sen

Hi,   I want to share my automatic lightning system with the community. It controls my lights in a room based on motion sensors and average lux in the room. It’s build for HC3.   G

Thanks!! What a great script  It is working! Now I get it, you can combine the TV as a "motion sensor" in the room configuraton. Brilliant.   Keuken = { name = "Keuken", sensors = {67

Posted Images

6 hours ago, chiel-s said:

@10der, is it possible to configure settings for hue lights? Such as:

 

fibaro.call(29, 'changeBrightness', 255)
fibaro.call(29, 'changeHue', 6881)
fibaro.call(29, "changeSaturation", 255)

Would be great. The last piece to finalize my light automation :-) I have tried 'level' but that seems not be working for Hue lights.

Hmmm... why it’s not single command... but ok will do 

Link to post
Share on other sites
8 hours ago, chiel-s said:

@10der, is it possible to configure settings for hue lights? Such as:

 

fibaro.call(29, 'changeBrightness', 255)
fibaro.call(29, 'changeHue', 6881)
fibaro.call(29, "changeSaturation", 255)

Would be great. The last piece to finalize my light automation :-) I have tried 'level' but that seems not be working for Hue lights.

ahh no!

it doesn't work. sorry. My script always want to know the current status of lighting (switch / dimmer / etc).

so, please put your HUE to QA  as switch or dimmer. update value according to the current state of your HUE

and provide this QA id for my script.

Link to post
Share on other sites
3 hours ago, 10der said:

ahh no!

it doesn't work. sorry. My script always want to know the current status of lighting (switch / dimmer / etc).

so, please put your HUE to QA  as switch or dimmer. update value according to the current state of your HUE

and provide this QA id for my script.

 

Hmm ok. And if you only add the Brightness? Because that's the equivalent of the dim level. Woud that be possible?

fibaro.call(29, 'changeBrightness', 255)
Link to post
Share on other sites

@chiel-s I thonk you not clear understand me....

yes, I can turn on anything... but you back to me in 5 min and asking me wht script trying turn on lights every 5 sec.

so yes i can changeBrightness to 255 but how script check what Brightness is 255.

so, please attach me response 

http://192.168.1.36/api/devices/29

where 192.168.1.36 ip address of your HC3

Link to post
Share on other sites
7 minutes ago, 10der said:

@chiel-s I thonk you not clear understand me....

yes, I can turn on anything... but you back to me in 5 min and asking me wht script trying turn on lights every 5 sec.

so yes i can changeBrightness to 255 but how script check what Brightness is 255.

so, please attach me response 

http://192.168.1.36/api/devices/29

where 192.168.1.36 ip address of your HC3

 

 

{
  "id": 29,
  "name": "Hue Color TV",
  "roomID": 219,
  "view": [
    {
      "assetsPath": "/dynamic-plugins/com.fibaro.rgbwController/assets",
      "jsPath": "/dynamic-plugins/com.fibaro.rgbwController",
      "name": "com.fibaro.rgbwController",
      "translatesPath": "/dynamic-plugins/com.fibaro.rgbwController/i18n",
      "type": "ts"
    },
    {
      "type": "json"
    }
  ],
  "type": "com.fibaro.philipsHueLight",
  "baseType": "com.fibaro.colorController",
  "enabled": true,
  "visible": true,
  "isPlugin": true,
  "parentId": 22,
  "viewXml": true,
  "configXml": false,
  "interfaces": [
    "levelChange",
    "light"
  ],
  "properties": {
    "alert": 0,
    "brightness": 254,
    "categories": [
      "lights"
    ],
    "color": "255,162,1,0",
    "colormode": "hs",
    "currentProgram": 0,
    "dead": false,
    "deadReason": "",
    "deviceControlType": 23,
    "deviceIcon": 15,
    "effect": 0,
    "emailNotificationID": 0,
    "emailNotificationType": 0,
    "hue": 6881,
    "isLight": true,
    "lightId": 6,
    "log": "",
    "logTemp": "",
    "manufacturer": "",
    "model": "",
    "on": false,
    "pushNotificationID": 0,
    "pushNotificationType": 0,
    "reachable": true,
    "saturation": 254,
    "saveLogs": true,
    "smsNotificationID": 0,
    "smsNotificationType": 0,
    "state": false,
    "userDescription": "",
    "value": 0
  },
  "actions": {
    "setColor": 1,
    "setValue": 1,
    "startLevelDecrease": 0,
    "startLevelIncrease": 0,
    "stopLevelChange": 0,
    "toggle": 0,
    "turnOff": 0,
    "turnOn": 0
  },
  "created": 1599483514,
  "modified": 1599483514,
  "sortOrder": 38
}

 

Link to post
Share on other sites
local lighting = {
    -- Test = {
    --     name = "Test",
    --     sensors = {745},
    --     luxs = {},
    --     powers = {989},
    --     timeout = 60 * 1
    -- },
    Test2 = {
        name = "Test Test ",
        sensors = {745},
        luxs = {},
        --powers = {1997},
        powers = {628},
        level = "0,255,0,0",
        timeout = 60 * 1
    }
}

also level can be as DImmer 0..99 or for color 0..255

 

Edited by 10der
Link to post
Share on other sites
3 hours ago, 10der said:
local lighting = {
    -- Test = {
    --     name = "Test",
    --     sensors = {745},
    --     luxs = {},
    --     powers = {989},
    --     timeout = 60 * 1
    -- },
    Test2 = {
        name = "Test Test ",
        sensors = {745},
        luxs = {},
        --powers = {1997},
        powers = {628},
        level = "0,255,0,0",
        timeout = 60 * 1
    }
}

also level can be as DImmer 0..99 or for color 0..255

motionLights.fqa 25.4 kB · 0 downloads

 

 

@10der, thanks for your quick reply and thank you for adding this to your script. I really appreciate that and I think a lot of other people on this forum as well! When hue is going to be supported I think this is a must-have-script for everyone owning a fibaro home center ;-) It's so flexible ;-)

 

I added the QA but the lights are not turned on. After commenting the --jT = json.decode((fibaro.getGlobalVariable("HomeTable"))) line the script (I am not using a hometable), the QA starts succesfully but the lights are not reacting. When I enable the debug mode I get the following message:

 

[08.09.2020] [21:10:16] [DEBUG] [QA_MOTION_LIGHTS_113]: 21:10 | September 08, 2020 started...
[08.09.2020] [21:10:18] [DEBUG] [QA_MOTION_LIGHTS_113]: 21:10 | September 08, 2020 Keuken Sensor breached
[08.09.2020] [21:10:18] [DEBUG] [QA_MOTION_LIGHTS_113]: 21:10 | September 08, 2020 Keuken [on : 0,255,0,0]
[08.09.2020] [21:10:28] [DEBUG] [QA_MOTION_LIGHTS_113]: 21:10 | September 08, 2020 Keuken Sensor safe
[08.09.2020] [21:10:28] [DEBUG] [QA_MOTION_LIGHTS_113]: 21:10 | September 08, 2020 Keuken [was [off] manualy]

 

 

 

 

 

 

 

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

Ok. Can we close this Qa and just simple create a new scene 

empty LUA scene

ok? Ready?
yeah

just in blank right panel 

fibaro.call(29, “setColor”, 0,255,0,0)

run

your HUE should start green color 

if not - strange 

Btw

can you try 

level = 255

6 hours ago, chiel-s said:

actions": { "setColor": 1, "setValue": 1,

According you device it should support this commands

Link to post
Share on other sites
26 minutes ago, 10der said:

Ok. Can we close this Qa and just simple create a new scene 

empty LUA scene

ok? Ready?
yeah

just in blank right panel 

fibaro.call(29, “setColor”, 0,255,0,0)

run

your HUE should start green color 

if not - strange 

Btw

can you try 

level = 255

According you device it should support this commands

 

@10der,

fibaro.call(29, “setColor”, 0,255,0,0) 

returns in:

[08.09.2020] [21:35:30] [ERROR] [SCENE109]: (load):2: unexpected symbol near '<\226>

I don't think that it supported? I know that the following is working:

fibaro.call(29, "changeHue", "5021")
fibaro.call(29, "changeSaturation", "199")
fibaro.call(29, "changeBrightness", "114")
fibaro.call(29, "turnOn")

Also good to know that Philips Hue always needs the fibaro.call(29, "turnOn") line to turn it on. When calling changeHue or changeBrightness won't turn the light on. At this moment none of my Hue lights react, also the rooms without any level settings defined. Level 255 is also not working.

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

please check:

fibaro.call(29, “setColor”, 0,255,0,0) 

should be

 

fibaro.call(29, "setColor", 0,255,0,0) 

You are using bad char 

 

 

  • Thanks 1
Link to post
Share on other sites
17 minutes ago, petrkl12 said:

please check:

fibaro.call(29, “setColor”, 0,255,0,0) 

should be

 

fibaro.call(29, "setColor", 0,255,0,0) 

You are using bad char 

 

 

 

Could be, but I also cound't turn them on via the user interface. Rebooted homecenter.

When I run:

fibaro.call(29, "turnOn")
fibaro.call(29, "setColor", 0,255,0,0) 

 

The light goes on and turns green. So you were right, that is working. Debug mode returns (my timeout = 5 now):

[08.09.2020] [22:14:41] [DEBUG] [QA_MOTION_LIGHTS_113]: 22:14 | September 08, 2020 Test Test [off by timeout (was [on] manually)]

 

When I trigger the motion sensor the light doesn't turn on. Debug returns:

 

[8.09.2020] [22:18:13] [DEBUG] [QA_MOTION_LIGHTS_113]: 22:18 | September 08, 2020 Test Test Sensor breached
[08.09.2020] [22:18:13] [DEBUG] [QA_MOTION_LIGHTS_113]: 22:18 | September 08, 2020 Test Test [on : 0,200,0,0]
[08.09.2020] [22:18:22] [DEBUG] [QA_MOTION_LIGHTS_113]: 22:18 | September 08, 2020 Test Test Sensor safe
[08.09.2020] [22:18:22] [DEBUG] [QA_MOTION_LIGHTS_113]: 22:18 | September 08, 2020 Test Test [was [off] manualy]

 

 

 

Edited by chiel-s
Link to post
Share on other sites
1 hour ago, 10der said:

 

Thanks @10der!! It is working! :-) Great! The hue lights react now and I can set the colour. Is it also possible to set the brightness of the hue light? I thought I could use the 4th value? Where '99' and '10' are the brightness. But that is not working.  In example:

 

Keuken = {
    name = "Keuken",
    sensors = {67,72,36,"statusTVPhilips"},
    minLux = 100,
    luxs = {69,38},
    powers = {31,32,27,26,29,28,23},
    timeout = 5,
    times = { 
        -- Normal light over day (like 2700k)
        ["06:00..02:00"] = 
        {
        	level = "250,202,8,99",
        },
        -- Dim light at night and make it orange
        ["02:00..06:00"] = 
        {
        	level = "255,128,0,10",
        }
  	 }
},

 

  • Thanks 1
Link to post
Share on other sites
23 minutes ago, chiel-s said:

set the brightness of the hue light?

just assign level as integer

 

level = 255

@chiel-s OMG. I forgot what HUE has bug and I should add 

fibaro.call(id, "turnOn")
Link to post
Share on other sites

@chiel-s can you change body of QA.

I am busy with the current work now. sorry, can`t re-publish QA in the topic.

 

thnak you!

 

 

Edited by 10der
Link to post
Share on other sites

PS: according to Fibaro docs

"0,255,0,0"

r,g,b,w

brightness - my guess independent

:( 

 

Link to post
Share on other sites

@10der another fix 

v1.2.090920.3

 

so, now you can use (or not use) 5 params in color.

r, g, b, w

or 

r, g, b, w, brightness 

 

level = "0,255,0,0,10",

 

 

MotionL.LUA

@chiel-s

Edited by 10der
Link to post
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...