We have moved at community.getvera.com

Author Topic: Two lights, one switch  (Read 4358 times)

Offline BadPirate

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
Two lights, one switch
« on: September 28, 2011, 02:29:58 am »
I'm trying to control two lights in a room with a single GE dimmer switch; The main lights, and some lamps plugged into a GE lamp dimmer module.  I want the switch to dim both sets of lights simultaneously, turn them off/on simultaneously as well (as if the switch was controlling all the lights in the room)... I wrote a chunk of LUP code to detect whenever dimmer changes came across the net for my bedroom light switch (#8) and adjust the bedside lamps (#5) appropriately (in this code the dim setting is halved, as the bedside lamps seem to be twice as bright at the same dimmer settings as the main lights that are hooked to the switch, possibly due to wattages etc)...  Seems to work okay when controlling through vera (or iVera iphone app), but switch has serious lag (up to a minute) and is unusable...

Am I doing this the wrong way?  Is there a better way?

My Startup Lua:

Code: [Select]
function watch_level(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
local switch_value = luup.variable_get("urn:upnp-org:serviceId:Dimming1", "LoadLevelStatus", 5)
local lamp_value = luup.variable_get("urn:upnp-org:serviceId:Dimming1","LoadLevelStatus",8)
local adjusted_value = tonumber(switch_value) / 2;

if tonumber(lamp_value) ~= tonumber(adjusted_value) then
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {newLoadlevelTarget = adjusted_value}, 8)
end
end

luup.variable_watch ('watch_level', "urn:upnp-org:serviceId:Dimming1", "LoadLevelTarget", 5)
luup.variable_watch ('watch_level', "urn:upnp-org:serviceId:Dimming1", "LoadLevelStatus", 5)
return true

Offline oTi@

  • Community Beta
  • Master Member
  • ******
  • Posts: 4041
  • Karma: +32/-6
  • UI what ?!
Re: Two lights, one switch
« Reply #1 on: September 28, 2011, 07:09:25 am »
If you hit the GE dimmer switch (#5 right?), how quickly do you see the status update in the GUI?
Dezwaved at the moment...

Offline aschwalb

  • Hero Member
  • *****
  • Posts: 590
  • Karma: +0/-1
Re: Two lights, one switch
« Reply #2 on: September 29, 2011, 01:14:01 pm »
If you hit the GE dimmer switch (#5 right?), how quickly do you see the status update in the GUI?

This is due to the fact the Vera has to poll the GE dimmers...  I do a simpler thing where the switch just turns on its light and also tells vera to turn on the plug-in module.  There is a few second lag for the latter, which would mean that each dimmig step would be the same thing.  You might make it better by programming only 3 steps into the dimmer verus their default.  That is one nice feature about the GE dimmers...  if you read the manual parameters 7,8,9,10 control the steps and ramp rate.  By changing these to give you maybe 3 steps 100%, 50%, 10% you might get better repsonse to your LUUP code.

Offline BadPirate

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
Re: Two lights, one switch
« Reply #3 on: September 29, 2011, 03:26:44 pm »
Quote
I do a simpler thing where the switch just turns on its light and also tells vera to turn on the plug-in module. 
How did you program the switch to update Vera directly?  (without having to poll)?

Offline aschwalb

  • Hero Member
  • *****
  • Posts: 590
  • Karma: +0/-1
Re: Two lights, one switch
« Reply #4 on: September 29, 2011, 04:04:09 pm »
Quote
I do a simpler thing where the switch just turns on its light and also tells vera to turn on the plug-in module. 
How did you program the switch to update Vera directly?  (without having to poll)?

I did not.  There is a lag. 

Offline BadPirate

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
Re: Two lights, one switch
« Reply #5 on: September 29, 2011, 08:42:59 pm »
Do you see any harm (or benefit) in turning the poll from the default 60 seconds to something less?

Offline ASIHome

  • Sr. Member
  • ****
  • Posts: 347
  • Karma: +2/-3
Re: Two lights, one switch
« Reply #6 on: September 30, 2011, 10:21:33 am »
By lowering the polling interval you will be creating more traffic on the network which can lead to slow response times.

Offline aschwalb

  • Hero Member
  • *****
  • Posts: 590
  • Karma: +0/-1
Re: Two lights, one switch
« Reply #7 on: September 30, 2011, 11:40:32 am »
By lowering the polling interval you will be creating more traffic on the network which can lead to slow response times.

Barry is right, when I tried to do this I made things worse with more polling.  I have a pretty big network (70+) devices spread over a large area with poor signal propagation.  If Vera is in the immediate area and can see the device directly things are pretty fast even with polling set at default values.

Offline oTi@

  • Community Beta
  • Master Member
  • ******
  • Posts: 4041
  • Karma: +32/-6
  • UI what ?!
Re: Two lights, one switch
« Reply #8 on: October 13, 2011, 12:38:04 pm »
If you hit the GE dimmer switch (#5 right?), how quickly do you see the status update in the GUI?
This is due to the fact the Vera has to poll the GE dimmers...
Precisely. So if the status update in the GUI takes minutes, it is clear it relies on polling / the GE switch is too far away from Vera.

If Vera is in the immediate area and can see the device directly things are pretty fast even with polling set at default values.
Exactly; that's key, the GE device needs to be close enough; irrespective of poll settings. (It is not possible to set the poll interval per device directly.)
Dezwaved at the moment...

Offline aschwalb

  • Hero Member
  • *****
  • Posts: 590
  • Karma: +0/-1
Re: Two lights, one switch
« Reply #9 on: October 13, 2011, 01:53:43 pm »
If you hit the GE dimmer switch (#5 right?), how quickly do you see the status update in the GUI?
This is due to the fact the Vera has to poll the GE dimmers...
Precisely. So if the status update in the GUI takes minutes, it is clear it relies on polling / the GE switch is too far away from Vera.

If Vera is in the immediate area and can see the device directly things are pretty fast even with polling set at default values.

I eventually ended up moving Vera on the other side of the house to get her closer to the switches/devices I wanted her see directly (i.e. no hops).  Now the switches are virtually instant (one switch two lights). 
Exactly; that's key, the GE device needs to be close enough; irrespective of poll settings. (It is not possible to set the poll interval per device directly.)