How to turn a running Scene OFF ??

I know that this command works to turn a scene on;
http://ipadress:3480/data_request?id=lu_action&serviceId=urn:micasaverde-om:serviceId:HomeAutomationGateway1&action=[u]RunScene[/u]&SceneNum=

But is this a valid command to turn a scene off :
http://ipadress:3480/data_request?id=lu_action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=[u]SceneOff[/u]&SceneNum=

I found it here…

#define HAG_GET_USER_DATA “GetUserData”
#define HAG_MODIFY_USER_DATA “ModifyUserData”
#define HAG_MODIFY_GET_VARIABLE “GetVariable”
#define HAG_MODIFY_SET_VARIABLE “SetVariable”
#define HAG_MODIFY_GET_STATUS “GetStatus”
#define HAG_MODIFY_GET_ACTIONS “GetActions”
#define HAG_MODIFY_CREATE_DEVICE “CreateDevice”
#define HAG_MODIFY_DELETE_DEVICE “DeleteDevice”
#define HAG_MODIFY_CREATE_PLUGIN “CreatePlugin”
#define HAG_MODIFY_DELETE_PLUGIN “DeletePlugin”
#define HAG_MODIFY_CREATE_PLUGIN_DEVICE “CreatePluginDevice”
#define HAG_IMPORT_UPNP_DEVICE “ImportUpnpDevice”
#define HAG_PROCESS_CHILD “ProcessChildDevices”
#define HAG_RELOAD “Reload”
#define HAG_RUN_SCENE “RunScene”
#define HAG_SCENE_OFF “SceneOff”
#define HAG_RUN_LUA “RunLua”
#define HAG_LOG_IP_REQUEST “LogIpRequest”

Serious question: what do you mean by “scene off”? Scenes are instant; they run, have effects, then they finish.

Are you talking about aborting a scene that has delays in it?

@futzle,

Yes I would like to abort a scene that has many delays in it. I have searched the forum and have found many references to “RunScene” but nothing about “SceneOff”. Thought this might be a easy and simple way to terminate a scene early.

Hi jackpot,

Aborting a scene with delays is uncharted territory. Received wisdom is that you can’t, which has led to things like the Countdown Timer springing up to fill the niche.

Why don’t you do some experiments and tell the forum what you find out?

@futzle,

SUCCESS !!

Yes, this is why I was asking first before I tried it! Didn’t want to brick my Vera 3. But I ended up trying it out anyway after a full backup of course. I have a scene like I said with a bunch of delays in it ( takes about an hour before its finished) so it was the choise to try it out on. Thist is what I put in the Test Luup;

luup.call_action(“urn:micasaverde-com:serviceId:HomeAutomationGateway1”, “SceneOff”, {SceneNum=“24”}, 0)

my scene is 24

From what I can tell the scene quit executing the rest of the delays. I didn’t do anything else because I was waiting to see if the next delay would activate. None of the future delays occurred so I am going to say that “SceneOff” worked fine. I next ran the scene again without sending the “SceneOff” command and the scene completed just as normal.

Maybe someone like you or others with way more smarts than me can confirm my findings. If I’m doing a bad thing by trying this please let me know.

Hope this helps…

Good find, jackpot. And thanks for sharing your findings with the forum.

If this is true, it’s very cool and is much needed to be able to cancel a scene in progress.

You also may be simply leveraging a bug where the call you make simple causes the scene to freak out. :slight_smile:

I’d still be weary of this type of code. It may produce unexpected consequences when run repeatedly or in sequence with other scene code.

It looks like the “SceneOff” has a different purpose:

http://wiki.micasaverde.com/index.php/Luup_UPnP_Variables_and_Actions#HomeAutomationGateway1

  • Garrett

@electricessence,

Thanks for the advice. I will tread lightly on this. For now I have only used it in the “Test Luup”. I haven’t put any code in a scene using it yet. Will do some more testing tomorrow as it’s getting late here in the Northwest.

@garrettwp,

Thanks for the info.
I did a quick read of the link you posted. If I understand it correctly, it means it will turn off all Dimmable & Switch Devices contained within the scene ?

That is my understanding.

  • Garrett

@jackpot:
There are a couple of ways to control scenes in the way you want and one of them requires no code.

First off, do not schedule a delayed event unless you absolutely want it to occur. Typicallly speaking, a delay of one hour to turn off or on a light can be problematic because so much can change in an hour. Either you left the house, or don’t want the light on or off at that time.

Methods for enabling/disabling delayed events:

  1. Use scenes, triggers, countdown timers (plugin), virtual switches and possibly a combination switch (plugin) or two to start or cancel events. You can do this without writing code. But you will have a lot more devices than you started.
  2. Do it all through call_delay and comparing a global variable. This is all code, no extra devices.
  3. A mix of both code and devices to find a happy medium.

The nice thing about method (1) is that it is very transparent and you can easily manually cancel if necessary.

Get familiar with the plugins I listed, and say thank you to futzle for making them. :slight_smile:

@electricessence,

Thankyou for all of the advice you have given me on this subject. You and others on this forum have helped me out many times and I do appreciate it. I will investigate the options you have listed . I’m still going to tinker with the with the “SceneOff” command as it does seem to have a possible use. In the end I will probably use the more accepted methods to control scenes as changes in firmware ect. might cause problems as you have said earlier.

@futzle,
The plugins that you have developed are of the utmost importance to myself and I’m sure to others on this forum. Without people like you, Vera in my opinion would be black box for most of us.
Thankyou

@futzle,@electricessence,

Testing Update:

The first test I did yesterday was with a Dimmer module and it did indeed stop the future delays after entering the “SceneOff” command. I was premature in that it was only partially successful.

This time I used a Dimmer module, On/Off Outlet, and a Leviton Fan module. The only module that was affected was the Dimmer Module. The On/Off Outlet and the Leviton Fan module continued to accept future delays after the “SceneOff” command was issued. Apparently the Dimmable Module is the only module that this command affects, at least in my case. I would have thought that the On/Off Outlet would have been affected also. When issuing the “SceneOff” the Dimmable Module does not turn off. It simply stays at what ever setting it was set at prior to the SceneOff command, and any future delays in the scene have no affects on the Dimmable Module.

Not much use at least for me, thought I might have found a shortcut… not !

It looks like it does what the docs say. It turns off switches in a scene.