How to call scripts created in internal Ace Editor

Moderator: leecollings

Post Reply
bertbigb
Posts: 147
Joined: Thursday 13 August 2015 13:36
Target OS: NAS (Synology & others)
Domoticz version: beta
Location: Netherlands
Contact:

How to call scripts created in internal Ace Editor

Post by bertbigb »

Hello,

I hope someone can help me. I'm using the internal Domoticz Ace Editor to create my scripts.
As far as I could find out these scripts are stored in the database. So far so good.

At Switches, Groups and Scenes you can couple script actions.

I create my scripts with:
Ace editor.png
Ace editor.png (99.2 KiB) Viewed 2272 times


My question is how I can call these scripts because I do not know what to enter at:
script call.png
script call.png (17.68 KiB) Viewed 2272 times
I tried to put in the name but that doesn't work.

help would be appreciated
Best regards Bert

Synology DS1517+ - DSM 6.2
Raspberry PI2-B, Raspberry Nano - Raspberry PI3 - model B
Xiaomi Gateway - Philips HUE Lights - Zwave - RFXCom(E) with KaKu and other 433MHz devices - Yeelight Lights - Toon
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: How to call scripts created in internal Ace Editor

Post by deennoo »

First off all :
Change choice under LUA for device and record.

You made a device script.

He will run each time your switch who is call "Hue Test" will turn ON
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
bertbigb
Posts: 147
Joined: Thursday 13 August 2015 13:36
Target OS: NAS (Synology & others)
Domoticz version: beta
Location: Netherlands
Contact:

Re: How to call scripts created in internal Ace Editor

Post by bertbigb »

Hi Deennoo,

Thanks for your answer.
I put you on the wrong leg. The script is just an example to show in which editor I make my scripts in.
I would like to know how i can call such a created script.

Do you know how to do this?

So lets assume I make a script and I call it bert in the editor
Then i would like that that script runs when I activate a scene
I doesn't work when I then call On Action: script://bert
I hope you or someone else know the answer.
Best regards Bert

Synology DS1517+ - DSM 6.2
Raspberry PI2-B, Raspberry Nano - Raspberry PI3 - model B
Xiaomi Gateway - Philips HUE Lights - Zwave - RFXCom(E) with KaKu and other 433MHz devices - Yeelight Lights - Toon
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: How to call scripts created in internal Ace Editor

Post by Egregius »

If you specify it as device script it'll run on every device update.
bertbigb
Posts: 147
Joined: Thursday 13 August 2015 13:36
Target OS: NAS (Synology & others)
Domoticz version: beta
Location: Netherlands
Contact:

Re: How to call scripts created in internal Ace Editor

Post by bertbigb »

Everyone thanks for the answers. Probably my question is not clear enough.

From a Group or Scene you can call a script for a On or Off action. There you have to fill in the path to the script.

When you use the script editor within domoticz the script is stored into the database.

The question is how you can call a script which is in the database for the On or Off action within a Group or Scene?
script call.png
script call.png (17.68 KiB) Viewed 2220 times
I hope I have made myself more clear with the above.
Best regards Bert

Synology DS1517+ - DSM 6.2
Raspberry PI2-B, Raspberry Nano - Raspberry PI3 - model B
Xiaomi Gateway - Philips HUE Lights - Zwave - RFXCom(E) with KaKu and other 433MHz devices - Yeelight Lights - Toon
dutchdevil83
Posts: 130
Joined: Monday 31 October 2016 19:34
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Netherlands
Contact:

Re: How to call scripts created in internal Ace Editor

Post by dutchdevil83 »

script://script_device_HUE-LAMP.lua
Hardware
1x Raspberry Pi
1x Razberry Z-Wave
1x RFXtrx433E
1x Toon
1x GoodWe Solarpanels
2x FGSD-002 Smoke Detector
1x FGBS-001 Binaire Sensor (RFID lezer)
7x FGMS-001 Motion Sensor
3x ZW089 Verzonken Deursensor
7x NC Wallplug
&lots of KaKu stuff
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: How to call scripts created in internal Ace Editor

Post by simonrg »

bertbigb wrote:Everyone thanks for the answers. Probably my question is not clear enough.

From a Group or Scene you can call a script for a On or Off action. There you have to fill in the path to the script.

When you use the script editor within domoticz the script is stored into the database.

The question is how you can call a script which is in the database for the On or Off action within a Group or Scene?

script call.png

I hope I have made myself more clear with the above.
You can't access the scripts within the database using the On / Off parameters for a Group, these expect either a path to a file or a web path.

I think the best way to do what you want is to include a dummy on/off device in your Group (scenes can only be turned on / not off, groups can be turned on and off).

Then create a script which activates when the device is changed by the group being turned on or off, just ignore the On / Off actions in the Group / Scene settings.

So device called "Scene Dummy" then create a device script:

Code: Select all

commandArray = {}
if devicechanged["Scene Dummy"] == 'On' then
    -- place your on code here
 else
    -- place your off code here
 end
 
 return commandArray
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
bertbigb
Posts: 147
Joined: Thursday 13 August 2015 13:36
Target OS: NAS (Synology & others)
Domoticz version: beta
Location: Netherlands
Contact:

Re: How to call scripts created in internal Ace Editor

Post by bertbigb »

Thanks for your answers. It helps me further!
Best regards Bert

Synology DS1517+ - DSM 6.2
Raspberry PI2-B, Raspberry Nano - Raspberry PI3 - model B
Xiaomi Gateway - Philips HUE Lights - Zwave - RFXCom(E) with KaKu and other 433MHz devices - Yeelight Lights - Toon
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest