Author Topic: Solved! -- How to Keep your Cooper RF Master/Accessory Switch always in Sync  (Read 9925 times)

Offline shallowearth

  • Hero Member
  • *****
  • Posts: 966
  • Karma: +45/-9
Not sure your devices don't seem to be quite working up to par..

What version is the firm ware on your dimmer?
I have two that are 3,3,52,1,0  and one that is 3,3,67,1,1

One of my 3,3,52,1,0 dimmers is slightly less reliable then the other two on instant status.

You can find this on the advanced variables tab for the device, VersionInfo


Offline jquincy

  • Full Member
  • ***
  • Posts: 138
  • Karma: +0/-0
So I took out the dimmers and replaced them with Cooer 9501  Version on all of them is  3,3,52,3,15.

Same situation. When I manually turn off the switches it can take 3 seconds or 20 minutes to register on the UI.

Very confused. When I turn them on or off from the UI they  are instant. But when I manually turn them off I get the delay. Aggravating since I can't set up Pleg conditions with them if the do not register off or on properly

Offline shallowearth

  • Hero Member
  • *****
  • Posts: 966
  • Karma: +45/-9
Yeah, something is amiss, I assume you have done a network heal, maybe try Vera support, seems like the Vera itself is having trouble with instant status.

All my coopers instant status works fine except for that one dimmer.  It is too suspicious that even switching things up with a non-dimmer still is having problems, unless your networks it just so busy crazy that the instant status it just not routing back to the vera.

I would do a network heal, and then double check that you don't have any run away scenes or devices that are flooding your mesh commands.

Cindy

Offline jquincy

  • Full Member
  • ***
  • Posts: 138
  • Karma: +0/-0
Before I totally give up on these Cooper dimmers I would like to try your solution above. I have tried Solution 1 and they still get out of sync.



Solution 2...
Switch still getting out sync (may you have a button that doesn't support scenes that is turning on/off your master switch).
Create a Scene that runs every so often (every few minutes?), to sync up your Accessory switch.
You want to create a scene that all it does is run some LUUP code (maybe there is a smarter way to trigger the scene... this was just the easiest way I found).


 To do that you have to start by creating a scene that turns on the Master Switch, than use the advanced editor to actually delete that action (scene should have no actions, don't know how else to get there... yes, the UI is wierd).

You state to set up the master switch to go on and then under Advanced Editor you turn it off? Think I am confused here.

Then go into the Also, execute the following Luup code, and click on No Luup Code Defined
And add the following code there but
replace 6 with your Master Switch and
7 with your Accessory Switch.

Where do I find Also to add the Lua code?


Should work for keeping all acceossory switches in sync you can add a new line for each accessory switch (between the then and else, or the else and end statement).

if ( luup.variable_get("urn:upnp-org:serviceId:SwitchPower1", "Status", 6) == "1") then
luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "1"}, 7) else
luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "0"}, 7)
end




Since I have 3 Auxiliary switches do I need 3 lines of code between then & else and also between else & end?

Thanks





Offline shallowearth

  • Hero Member
  • *****
  • Posts: 966
  • Karma: +45/-9
First lets understand what is causing your switches to get out of sync?
I assume that you have all your associations set correctly so that no press of any of the switches (master or Aux) causes an out of sync scenario.

Assuming that is all working....

Is it Vera scene that is running and causing it to get out of sync?  That is super easy to fix using the advanced editor.

Or is it that you are using the Vera UI, the Vera App for Ipad/Android or other 3rd party app to control the master switch that is causing the Aux switches to get out of sync?





Offline jquincy

  • Full Member
  • ***
  • Posts: 138
  • Karma: +0/-0
All switches are associated properly. I am operating them under Vera UI 15. They seem to get out of sync when the master switch is activated by a PLEG scene or turned off via minimote scene

Offline shallowearth

  • Hero Member
  • *****
  • Posts: 966
  • Karma: +45/-9
OK, are the Aux switches on/off or dimmers?

My scene shots are going to be from UI7 but should be clear enough to get you going....

To keep just the on/off status in sync For your PLEG scenes. 
Any time you have an action that turns on or off the Master switch, also turn on or off the Aux Switches.
Attached is the screen shot of the Action portion of my PLT (same syntax as PLEG) that is turning off my master light plus my two aux switches.
Note that sometimes the Aux Switch will not have the urn:upnp-org:serviceId:SwitchPower1 options listed, if not, use the urn:micasaverde-com:serviceId:HaDevice1 ToggleState command.  and trigger your PLEG.  When you have called ToggleState once or twice Vera should detect the extra capabilities of the Aux Switch and add the urn:upnp-org:serviceId:SwitchPower1 Set Target Option that you need to discretely control the LED on the AUX switch.

For Scenes, do the same thing.  When you are setting the Master switch in a scene, go into the advanced editor and add the Aux Switches to do the same action the Master switch is doing.  The Aux Switches in UI7 will only be an option for a device you can control in a scene in the advance editor, I am assuming UI5 has something similar.  Again if you don't see the SetTarget Option on your AUX switches, use the ToggleState command once or twice to get the Vera to add the additional functionality then edit the scene to use the SetTarget option.

If those don't work, or you are dealing with dimmers aux switches let me know and I can send you the more advance LUA method.  But the above is the most simple if you remember to build your scenes so that everytime to update the master you update the aux switches.

« Last Edit: May 20, 2015, 04:23:45 pm by shallowearth »

Offline jquincy

  • Full Member
  • ***
  • Posts: 138
  • Karma: +0/-0
I am dealing with dimmers. I had done similar to what you had stated and set the newTargetValue: 100 for the on scene and 0 for off. So I am ready for Plan B

Offline shallowearth

  • Hero Member
  • *****
  • Posts: 966
  • Karma: +45/-9
OH, that is your problem. 

NewTargetValue on the AUX just sets the Blue LED light level (the light level it will return to when you use the AUX button to turn on the light), it does not set the Orange on off LED.  And is probably doing something screwy when you sent it to 0, as there is no such thing as a 0 level dim setting to return to.

You need to use SetTarget instead to control the Orange LED, 1 for On 0 for Off.  You don't need to mess with the Blue LED light level (just yet).

You can probably go back to Method one (just create an "On" Scene that triggers on Master Switch Turned On, and set each AUX switch to SetTarget 1, then create an "Off" Scene that for Turned Off)  I am betting it will work when you change to using SetTarget instead.

Get the above stuff working first and if you really want the Blue Light Level to also be 100% in sync let me know.  There are two methods...

The easy but less accurate method:
If you do have a scene that is specifically changing the Dimmer level on the Master, then you can additionally add actions on the scene to set the NewTargetValue on the Aux to keep the Blue LED in sync but is way less critical in my opinion, the dim/brighten button will continue to work on the AUX even if slightly out of sync with the Master. 

So the Ground rules, if you are turning the Master switch on either by calling SetTarget and/or NewTargetValue... set Aux Set Target to 1, and optionally set NewTargetValue to the same value you set the Master to.
If you are turning the Master switch off either by calling SetTarget or NewTargetValue... set Aux Target to 0, DO NOT set NewTargetValue.
Never attempt to set the Blue LED to 0 on off, just leave NewTargetValue alone on Off scenes.

The more accurate method involved using some LUA code on a delay to deal with the RAMP issues if you need 100% accuracy.

Offline jquincy

  • Full Member
  • ***
  • Posts: 138
  • Karma: +0/-0



If you are turning the Master switch off either by calling SetTarget or NewTargetValue... set Aux Target to 0, DO NOT set NewTargetValue.
Never attempt to set the Blue LED to 0 on off, just leave NewTargetValue alone on Off scenes.



Here is what I have. When I add a auxiliary in advanced and go to SetTarget the NewTargetValue automatically populates

So I am not sure what I am doing wrong

Offline shallowearth

  • Hero Member
  • *****
  • Posts: 966
  • Karma: +45/-9
Sorry my bad, I thought you were saying you were using SetLoadLevelTarget... that is what sets the Blue LED.

One error, you have the Master Switch in your Off Scene, that might be causing a weird loop if it is being triggered by the Master Switch turning Off.

When you trigger those scene's manually do they work (turn the orange LEDs on/off)?
Looks right to me.  Was this the switch that instant status wasn't working on?  If so it might take like 30 seconds for the LEDs to sync up once the Vera polls the Master switch.

If the scene can't manually turn the LEDs on/off maybe it doesn't work with UI5, if that is the case, no amount of scripting is going to fix it.




Offline shallowearth

  • Hero Member
  • *****
  • Posts: 966
  • Karma: +45/-9
So first... verify you can modify the Orange LED using your existing scenes by running them manually?

If your Scenes are never triggering here is some code you can use to do it instead.
Create a Scene that runs every Minute or what ever your tolerance level is for the switches being out of sync.
You add this to the "run LUA" portion of your scene, and I not 100% where that is located in UI5.
Note that if you are triggers a scene from the on/off command of the master you need a three second delay in the script to allow the ramp to complete.


local light_stat = 0
local light_dstat = "100"
--light_main is master switch update the ID below
local light_main = 6
--light_aux1, 2, 3 are your Aux switches update the IDs below
local light_aux1= 7
local light_aux2 = 8
local light_aux3 = 9

--code below will upate the orange on/off LED to the master switch on the Aux switches
light_stat = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1", "Status", light_main)
luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = light_stat}, light_aux1)
luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = light_stat}, light_aux2)
luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = light_stat}, light_aux3)

--if you want to also update the blue light level LEDs on the Aux switches include the below
light_dstat = luup.variable_get("urn:upnp-org:serviceId:Dimming1", "LoadLevelStatus", light_main)
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {newLoadlevelTarget = light_dstat},  light_aux1)
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {newLoadlevelTarget = light_dstat},  light_aux2)
luup.call_action("urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", {newLoadlevelTarget = light_dstat},  light_aux3)




Offline jquincy

  • Full Member
  • ***
  • Posts: 138
  • Karma: +0/-0


One error, you have the Master Switch in your Off Scene, that might be causing a weird loop if it is being triggered by the Master Switch turning Off.


I just fixed the obvious error. I'll have to wait until I get home to see if that makes a difference.


When you trigger those scene's manually do they work (turn the orange LEDs on/off)?
Looks right to me.  Was this the switch that instant status wasn't working on?  If so it might take like 30 seconds for the LEDs to sync up once the Vera polls the Master switch.

If the scene can't manually turn the LEDs on/off maybe it doesn't work with UI5, if that is the case, no amount of scripting is going to fix it.

All three of the Auxiliary switches have syncing problems. Not 100 % of the time. Just hate to double or triple press a switch to turn a light off or on. Anyway I will see what happens when I get home tonight.

Thank you very much for your help

Offline shallowearth

  • Hero Member
  • *****
  • Posts: 966
  • Karma: +45/-9
Added some addition solutions to the original post for Parameter 10 usage for keeping switches in sync.  And using Group 255 to keep instant status working if it stops working due to using a secondary controller or scene controller on your network.

Offline jquincy

  • Full Member
  • ***
  • Posts: 138
  • Karma: +0/-0
I gave up on them and switched them to Lutron Caseta.