Author Topic: Synchronized Dimming  (Read 514 times)

Offline brandon125

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
Synchronized Dimming
« on: May 11, 2017, 10:29:12 pm »
I am switching from ST to VeraSecure once it arrives. I was wondering if I could do a synchronized dimming like I could do with smartthings. Now, it wasn't super fast, but it worked. Is there a way I can have 3 under Cabinet Ge zwave light dimmers synchronized?

Thanks!

Offline reneboer

  • Hero Member
  • *****
  • Posts: 1060
  • Karma: +53/-30
Re: Synchronized Dimming
« Reply #1 on: May 12, 2017, 04:42:14 am »
Hi,

One way I think you can do this (not tested though), is make one of the dimmers the main one. Then create a bit of LUA you add to the start up that puts a watch on the LoadLevel variable of that main dimmer and set the slave dimmers load levels to match. The LoadLevel of a dimmer does not seem available in a scene, so that is why some coding is required.

In this forum you find examples on how to put a watch on a variable, and in the wiki http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_variable_watch

Cheers Rene
2xVeraLite, VeraEdge, openLuup, ALTUI, 20 switches, 10 dimmers, 20 sensors, 10 scene controllers, 1 Harmony Hub, many plug-ins. Not enough time.

Offline brandon125

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
Re: Synchronized Dimming
« Reply #2 on: May 12, 2017, 08:27:44 am »
I am not very good at code at all, is pleg an option?

Offline baldhead

  • Newbie
  • *
  • Posts: 15
  • Karma: +1/-0
Re: Synchronized Dimming
« Reply #3 on: May 13, 2017, 12:58:25 am »
Hello !

I think you don't need pleg for that,

here is my lua startup, for synchronizing a fibaro dimmer with four hue spots. (initialy, the dimmer used to drive four halogen bulbs, replaced by the hue spots - I've just changed the wiring, in order to keep the Hue bulbs connected to the main, and not being dimmed by the fibaro)

Code: [Select]
luup.variable_watch("Dim_synchronize_bedroom", "urn:upnp-org:serviceId:Dimming1","LoadLevelStatus", 198)


function Dim_synchronize_bedroom(dev_id,service, variable, old_val, new_val)
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {newLoadlevelTarget = new_val },302)
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {newLoadlevelTarget = new_val },303)
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {newLoadlevelTarget = new_val },304)
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {newLoadlevelTarget = new_val },305)
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {newLoadlevelTarget = new_val },314)
end
198 is the ID of my fibaro dimmer in the wall, and 302 to 304 are the gu10 Hue bulbs and 314 a philips Hue go

my first attempt was to create a scene, but I manage only to get on an off with a little latency , with this simple code in the lua startup, the synchronization is just perfect  ;D


Offline brandon125

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
Re: Synchronized Dimming
« Reply #4 on: May 14, 2017, 08:48:02 pm »
How should I create this? I am not good at LUUP at all and I am ok at PLEG. What do you recommend?

Offline reneboer

  • Hero Member
  • *****
  • Posts: 1060
  • Karma: +53/-30
Re: Synchronized Dimming
« Reply #5 on: May 15, 2017, 06:16:15 am »
Hi,

You would put this in the startup LUA. In the menu select Apps, Develop Apps, Edit Startup LUA.

You have to be a bit careful because a big syntax error can cause issues.

I am not a PLEG user so not sure how that would work.

Cheers Rene
2xVeraLite, VeraEdge, openLuup, ALTUI, 20 switches, 10 dimmers, 20 sensors, 10 scene controllers, 1 Harmony Hub, many plug-ins. Not enough time.

Offline shallowearth

  • Hero Member
  • *****
  • Posts: 887
  • Karma: +41/-9
Re: Synchronized Dimming
« Reply #6 on: May 15, 2017, 09:04:19 am »
If you can already use PLEG just use PLEG
For the condition, add a device property then watch variable LoadLevelStatus
Create a repeating condition when Variable is True
set LoadLevelTarget on the devices you wish to synchronize

That last step is the tricky one
If you named your condition MasterDimmer
Then you would set you Logical action to set the value of Slaved Dimmer to {(MasterDimmer)}
« Last Edit: May 15, 2017, 09:48:31 am by shallowearth »

Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 9417
  • Karma: +715/-130
    • RTS Services Plugins
Re: Synchronized Dimming
« Reply #7 on: May 15, 2017, 10:25:45 am »
If you put the Status property on ALL the dimmers ... and fired the condition when any changes ...
Then all would be equal masters ... change 1 .. and they all change to its value.

I published an example of this a few years back ...