PLEG State

Guys - I need some help. I am close to what I think is a way to increase the number of functions my Enerwave 7 button scene controller can control, but I am stuck.

I am not a developer, but I believe there might be a way to change the state inside of PLEG. If I can change the state of button1 to FALSE, 5 seconds after it went to true, I can then double press the same button in 20 seconds to do the opposite.

Currently, button1, when triggered, sets to true if it was false. but it never goes false again, preventing my double press from working.

I have attached a PDF showing some properties I believe may lead me to the right path, but I need some expert help ???

Page 20 of the PLEG manual says I need:

  1. the service ID - is urn:schemas-micasaverde-com:device:SceneController: I got this from the advanced tab on the scene controller. Is that right?

2)Variable name : because this is not a single device, not sure what to read here, would it be
sl_SceneActivated 1 ?

  1. device is easy , that is 121, but what scene state do I use. Button 1 would be scene 1, right, so how would that equate to a device number when device number 121 has 7 buttons ?

I will have to create some dummy scenes, and assign them for the buttons to become active, but once active, PLEG takes over.

Thanks in advance!

The three main variables on a SceneController are sl_SceneActivated, LastSceneID and LastSceneTime.

sl_SceneActivated is set to a number that represents the last button activity on the remote. It may be a simple button number but, on some remotes, it can also indicate double-click, long-click, etc. The device instructions usually explain this.

LastSceneID is set to the Vera scene number that has been configured to the last button activity. This is usually only useful if the remote supports advanced scene control.

LastSceneTime is set to the timestamp of the last button activity.

The ServiceID for all three of the variables is urn:micasaverde-com:serviceId:SceneController1

You don’t show what you are using to define the Trigger tButton1 but if it is driven from sl_SceneActivated, setting that to zero may give you the result you want.

You may also be able to detect multiple button clicks through a Device Property set to LastSceneTime. On a simple scene controller, this will change with each button click.

@Rex - Hey man, thanks for the late night Support! So here is what I learned:

If I go to the wall controller, advanced, variables, and I manually set the status to 0, all is good. Sadly, the device manual provides no clue on any configuration parameters you mentioned might do the trick :frowning:

I am stuck in PLEG, getting that variable set. I have attached a revised PDF as to how I am trying to accomplish this, but I am doing something wrong, as running the action is not resetting the status, where going into the device manually, and changing the status to 0 does work.

Yes, you are correct, tButton1 does trigger scene, not a device.

Pressing any other button than button one sets tbutton1 status to false, if that is important, I do not know, but I dont want to press buttons just to turn button 1 to false.

What am I doing wrong that is not setting the Status to 0 ?

Thanks!

EDIT:

Here is the resulting variable as showin via status:

ServiceId=urn:schemas-micasaverde-com:device:SceneController:1 VariableName=sl_SceneActivated:1 Value=0 Device=121

I have never seen a Status variable on a scene controller. That is usually only present on switches and dimmers. I suppose it could be an Enerwave special…

The chances are that the ServiceID for Status is not the normal one for scene controller variables. It is more likely to be urn:upnp-org:serviceId:SwitchPower1. To check, hover your mouse over the variable name Status on the Advanced tab. This will show you the correct ServiceID for that variable.

Your Right! I just confirmed here is what needs to be changed:

sl_SceneActivated needs to be changed to a any other number than 1 (that’s the button we want to be inactive) .

LastScenID seems not to matter.
I may have inadvertently added new variables while playing around, as I now have multiple instances of sl_SceneActivated on the variables page.

In LUUP tab, I have tried this to no avail:

Luup.variable_set(“urn:schemas-micasaverde-com:device:SceneController1”, “sl_SceneActivated”, {newTargetValue = “6”}, 121)

Is it possible to clean up variables once created? How do I know which ones not to remove?

What did I miss?

Thanks!

What did I miss?

You used the wrong Service ID and the incorrect form for a variable_set call. Try this:

luup.variable_set("urn:micasaverde-com:serviceId:SceneController1", "sl_SceneActivated", "6", 121)
Is it possible to clean up variables once created?

Unfortunately not. They will persist unless you delete and re-include the device.

@ Rex - Thanks alot!! The code was similar looking at 2 AM, I should have looked more closely. Your service ID did the trick ;D

I am still having a problem with the logic, I’ ll play with it a bit, maybe try using a virtual switch, and have the scene controller toggle the virtual switch, and have that virtual switch run the condition. Thanks again!

@Rex - Excellent! Got it working. I press the button on the scene controller, it resets the variable status of the scene using PLEG, this then triggers a virtual switch (could not figure how to toggle state using the virtual multi switch ???) toggles the state of the virtual switch, and runs the condition in PLEG. A single button now toggles the outside lights on or off.

Now I can get far more functions in a single wall controller.

Thanks, as always for your , and all the other members, for the great support from this forum!!

Without this resource, many might give up!

could not figure how to toggle state using the virtual multi switch ???

MultiSwitch toggles its state if you use an action with newStatusX=-1. E.g:

luup.call_action("urn:dcineco-com:serviceId:MSwitch1","SetStatus1",{newStatus1= -1},123)

This can also be set using PLEG’s action editor.

@ Rex - That worked, wall controller is now working well. Thanks! Karma bump coming your way :slight_smile: