Is there any plugin that allows to activate or deactivate a scene? Like a Vitual Switch to disable or enable scenes.
If you use PLEG, you can have the scene fire only when a virtual switch is on and when your conditions are met.
There isn’t as far as I am aware, but you could use a virtual switch or multi switch together with PLEG. Have PLEG check to see if the switch is enabled, and only run the scene when the switch is enabled (or disabled depending on your needs)
So basically you create a condition or trigger which triggers the scene, then have a condition which checks if both are true, the condition and your multi switch. If both are true you create a action which then runs your scene. Fairly easy to set up
Thanks,
Using the new possibility in UI7 to enable and disable scenes, I wanted to use a virtual switch to enable or disable several scenes simultaneously.
Which new possibility in UI7?
You can base it on mode and you can use lua code.
If you don’t want to go to PLEG you can of course check the state of a virtual switch using lua code. You can use the same code in every scene you want to control or use different virtual switches for each. Naming the virtual switch as ‘scenename-on’ will help.
I want: instead of putting enable 10 scenes, one by one, wanted to use a virtual switch or another scene to put 10 enable scenes simultaneously.
Just use one virtual switch but use it as a condition for each of the controlled scenes. You have to add the code to each scene but it is only copy paste.
Hi, I found that disabling the scene by adding a schedule that is always off is the best way to do it. But I am wondering if there is a way to reprogram the schedule of a scene with a lua code?
For example, create a virtual switch that when it’s ON runs a lua code that make scene #17 to be never.
And when the virtual switch is OFF, always with a lua code, that make scene #17 to be executed 24/7
Regards,
Alexandre Beaulieu
Disclaimer: I haven’t tried this, so it’s just educated guessing.
You should be able to read the user_data in order to get the scene info. You’ll have to parse returned json to get the scene you want to modify. You’ll get a scene definition that looks similar to this (formatted for easier reading):
{
"name": "Example Scene",
"triggers_operator": "OR",
"groups": [
{
"delay": 0,
"actions": [
{
"device": "94",
"service": "urn:upnp-org:serviceId:SwitchPower1",
"action": "SetTarget",
"arguments": [
{
"name": "newTargetValue",
"value": "0"
} ]
} ]
} ],
"triggers": [ ],
"timers": [ ],
"users": "",
"modeStatus": "0",
"id": 85,
"Timestamp": 1474988987,
"room": 0
}
You’ll want to change the json to add ‘“paused”: 1,’ to the top level of the scene, so you get something like this:
{
"name": "Example Scene",
"triggers_operator": "OR",
"groups": [
{
"delay": 0,
"actions": [
{
"device": "94",
"service": "urn:upnp-org:serviceId:SwitchPower1",
"action": "SetTarget",
"arguments": [
{
"name": "newTargetValue",
"value": "0"
} ]
} ]
} ],
"triggers": [ ],
"timers": [ ],
"users": "",
"modeStatus": "0",
"id": 85,
"paused": 1,
"Timestamp": 1474988987,
"room": 0
}
I know that there are ways to get and write userdata using luup.call_action, but they’re not well-documented (I know how to write it, but not read it). Using the HTTP calls is much better documented, such as here: http://forum.micasaverde.com/index.php?topic=6277.0
I’ll repeat the warning in that thread: Be very careful, as messing with userdata directly can screw up your system. Have backups.
Modifying user_data is like juggling Nitroglycerine … leave it to the experts!
You really should look at PLEG for your control … much safer and easier to use.
[quote=“RichardTSchaefer, post:10, topic:187620”]Modifying user_data is like juggling Nitroglycerine … leave it to the experts!
You really should look at PLEG for your control … much safer and easier to use.[/quote]
Yup! Dangerous and easy to screw up. I believe that PLEG currently doesn’t do what he wants to do, which is to toggle/modify the “paused” value of a scene. Do you plan to add that?
PLEG allows you control conditions in the PLEG based on the status of the Virtual Switches (and/or schedules and or device properties, and/or device triggers, and or counters, and/or house modes)
You can drop the scenes altogether or if you really want to keep the scenes you can have PLEG run the scenes conditionally.
The only reason to keep the scene is if you want to run in manually.
@Richard
Is there a way to toggle native Vera Scenes on/off with PLEG? Or do you plan to add it?
It would be useful to toggle using PLEG - there are good reasons to use native Vera Scenes (already have many deeply integrated, easier to use UI for simple scenes, etc) but there might be situations you want to conditionally disable/enable.
Simple example: Coffee machine on in morning, off 3 hours later. Would like to disable this, using PLEG, when in Traveling or Vacation mode (virtual switch tracks these states) .
I was using LUA code in each scene to stop the scene from running but since the rest of my ‘house mode’ logic is in PLEG, I’d like to move it there… and there is less issues with Vera Startup and reduces startup time by removing the in-scene LUA code.
thanks
@Richard
Is there a way to toggle native Vera Scenes on/off with PLEG? Or do you plan to add it?
It would be useful to toggle using PLEG - there are good reasons to use native Vera Scenes (already have many deeply integrated, easier to use UI for simple scenes, etc) but there might be situations you want to conditionally disable/enable.
Simple example: Coffee machine on in morning, off 3 hours later. Would like to disable this, using PLEG, when in Traveling or Vacation mode (virtual switch tracks these states) .
I was using LUA code in each scene to stop the scene from running but since the rest of my ‘house mode’ logic is in PLEG, I’d like to move it there… and there is less issues with Vera Startup and reduces startup time by removing the in-scene LUA code.
thanks[/quote]
I have a wall outlet that is only used to plug in the Christmas Tree lights, with a simple action. The outlet is on only during Home mode. It is off in Away, Night, and Vacation. It is also tied to a schedule beginning 11/20 and ending 1/5. Right now, the outlet is off and will stay off until 11/20. It will then only come on in the morning if one of us is home, turn off if we are both gone, and turns off at night when it is time for bed. All done in PLEG.
I used to have it in 2 scenes and I used to manually disable it after Christmas, until discovering PLEG.