Calling function asynchronously (not openURL)

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
Masure
Posts: 35
Joined: Sunday 22 April 2018 11:23
Target OS: Windows
Domoticz version:
Contact:

Calling function asynchronously (not openURL)

Post by Masure »

Hi,

First I want to thank the developper for the effort put in dzVents, it's a pleasure to script with.

I have a quite time consuming powershell script I want to call many times. I'm afraid doing this synchronously won't be great for the whole domoticz system.

What I'm willing to do is, on alarm system trigger, grab the jpg image from my camera and send it on my telegram notification discussion. I want to do this multiple times in a row, every few seconds for a couple of minutes.

I already have the script thats get the image and send it. The 2 http requests are done with powershell because it's very convenient to make mutipart/form-data request with it on Windows.

How can I make this ?

Regards
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Calling function asynchronously (not openURL)

Post by waaren »

Masure wrote: Thursday 17 January 2019 23:15 I have a quite time consuming powershell script I want to call many times. I'm afraid doing this synchronously won't be great for the whole domoticz system.
Did you already managed to call the powershell script with os.execute ? If so I would be interested to find out if you can also call it as a background script using the powershell Start-Job command.
Once you got that to work, it will be relatively easy to have dzVents trigger this command repeatedly, without blocking the entire domoticz eventSystem.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Masure
Posts: 35
Joined: Sunday 22 April 2018 11:23
Target OS: Windows
Domoticz version:
Contact:

Re: Calling function asynchronously (not openURL)

Post by Masure »

Hi,

I already executed powershell scripts. All that was missing is executing it a non blocking fashion.

I did not think about making the async call in the powershell part :roll:, I was trying to do this in the lua code.

Start-Job did the trick perfectly => Thank you !
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest