Two lights, one switch

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]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[/code]

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.

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)?

[quote=“BadPirate, post:4, topic:169255”]

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)?[/quote]

I did not. There is a lag.

Do you see any harm (or benefit) in turning the poll from the default 60 seconds to something less?

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.

This is due to the fact the Vera has to poll the GE dimmers…[/quote]
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.

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

This is due to the fact the Vera has to poll the GE dimmers…[/quote]
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.

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.)[/quote]