Author Topic: Scene luup execution speed - need for non-blocking calls  (Read 721 times)

Offline actran70

  • Newbie
  • *
  • Posts: 18
  • Karma: +3/-0
Scene luup execution speed - need for non-blocking calls
« on: September 18, 2017, 04:00:42 pm »
I have a Vera Plus.   And I have alot of scenes where I execute luup code for some custom behavior.

I noticed when I make certain calls, I feel like Vera is waiting for call for finish (blocking call) before continuing with the rest of luup script.

For example, I have the following function defined in my luup startup:

function mobile_app_alert(msg)
  luup.call_action("urn:intvelt-com:serviceId:HWPush1", "SendMessage", {Msg = msg}, 43)
end

In my scene luup script, I may call the above mobile_app_alert function to send a Homewave push alert based on some if-then-else conditions.   I get the sense that Vera is executing this function and waiting for it to complete before proceeding with rest of luup script.  I think this is called a "blocking call"?!?!   Is there anyway to tell Vera to execute a function in a non-blocking manner?


Offline RichardTSchaefer

  • Community Beta
  • Master Member
  • ******
  • Posts: 10091
  • Karma: +764/-143
Re: Scene luup execution speed - need for non-blocking calls
« Reply #1 on: September 18, 2017, 10:13:01 pm »
You can call it from a delayed function using luup.call_delay, which will return as soon as  the delayed function is scheduled.

You can use the Vera Alerts plugin for push notifications. It handles all of the alerts  asynchronously.

 

Offline actran70

  • Newbie
  • *
  • Posts: 18
  • Karma: +3/-0
Re: Scene luup execution speed - need for non-blocking calls
« Reply #2 on: September 19, 2017, 09:21:34 am »
@RichardTSchaefer  Thank you for chiming in.   I took a look at Vera Alerts http://rts-services.com/Vera/Plugin/VeraAlerts/  .   I noticed: 

   Vera Alerts Mobile (Currently Android, but IOS soon)

I use an iPhone.   Is iOS supported now?

@intvelt  My family uses Homewave to control Vera.   I trigger a Homewave push notification using the luup.call_action listed in original post.   I did some tests.   Do you know why it takes ~10 sec for the push notification to occur?   Just wondering if it's a limitation with how iOS supports notifications or is there anything I can do to improve this.  Thanks.

Offline akbooer

  • Beta Testers
  • Master Member
  • *****
  • Posts: 6343
  • Karma: +288/-70
  • "Less is more"
Re: Scene luup execution speed - need for non-blocking calls
« Reply #3 on: September 19, 2017, 09:55:51 am »
You can use Prowl to receive alerts on an iOS device.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline RichardTSchaefer

  • Community Beta
  • Master Member
  • ******
  • Posts: 10091
  • Karma: +764/-143
Re: Scene luup execution speed - need for non-blocking calls
« Reply #4 on: September 19, 2017, 01:53:55 pm »
You can use Vera Alerts plugin forwarding ... to forward to Homewave
Then when you send to Vera Alerts, it will return right away, and in the background it will send to Homewave.

I have not done the Vera Alerts Mobile for IOS. But there a few service options for IOS devices.

Offline Don Phillips

  • Hero Member
  • *****
  • Posts: 1444
  • Karma: +39/-36
Re: Scene luup execution speed - need for non-blocking calls
« Reply #5 on: September 19, 2017, 08:33:00 pm »
I use Veramate for iOS and Vera Alerts forwards notifications including those from PLEG very nicely.
Vera 3, 1.7.1030, CT101, Everspring motion sensor, GE/Jasco switch, Leviton outlet, AeonLabs sensor, NuTone garage door, Blue Iris, Sricam SP011, iPhone locator, APCUPSD, VeraMate, VeraAlerts, PLEG, House Modes, Countdown Timer, DVR, Virtual/Multi Switch, Weatherunderground, LB60Z-1 bulb, Hue, Alexa