Synchronously call a scene from luup ?

First off, I apologize in advance if I’m doing something stupid, or at least going the roundabout sort of way. I fully suspect there is an easier way to achieve what I’m after. I’ve been using Vera for a while now, but I’m only just now getting into Lua / luup. So here goes:

I have a scene that uses luup to call out to the local web service at http://127.0.0.1:3480/data_request?id=user_data (I could find no other way to get the full payload that returns from luup). It then parses the JSON, loops through all of the scenes and if they meet certain criteria either enables or disables any timers / schedules they might have. It then feeds this modified table back to ModifyUserData (at least the Scenes portion of it anyway). This works like a champ. The problem, however, is that ModifyUserData needs to reload the engine to make the changes active. So even though I may return true from this luup code, this reload operation seems to interfere with sending zwave commands to several devices while the reload is happening. What seems to happen is some get the updates, some don’t. So ideally what I’m looking for is to go, in order:

  1. change states of several devices in a scene

And after that has completed successfully…

  1. toggle schedules using my luup code

Any thoughts?

Thanks in advance!

You may want to try PLEG instead of the heroic efforts to dynamically change scenes.

…or maybe you should just put a bit more of your control logic, currently external to the scenes you’re trying to change, into the actual Lua code of those scenes.

Dynamically changing scene code (or much else) within Vera is not a recipe for success.

So I take it you’re the RTS of rts-services? This looks pretty cool, I may end up giving this a whirl.

For what it’s worth, the actual code to do what I’m doing is pretty succinct, the only hard part was the lack of documentation.

I may end up going this route, I see a lot of people use virtual switch plugin and conditional luup in their scenes. I was hoping to keep the luup code centralized, however, so that’s why I explored the option of calling ModifyUserData.

So what is your reasoning here? This is exactly what the UI does. So far, the only part that isn’t successful is that I have to have two separate scenes, one to fire off zwave commands, and another to change schedules via luup. As long as I fire them both manually and wait until one is done before firing the other, I have no issues.