Disabled dzvents scripts

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

Moderator: leecollings

Post Reply
HvdW
Posts: 615
Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:

Disabled dzvents scripts

Post by HvdW »

I want to make a copy of my scripts. The're placed in: ~/domoticz/scripts/dzVents/generated_scripts/
Where can I find the disabled scripts?
A search with sudo find ~/domoticz/ -name 'name of script.lua' didn't show the disabled script nor a search for '*.lua' helped.
Bugs bug me.
FlyingDomotic
Posts: 383
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Disabled dzvents scripts

Post by FlyingDomotic »

Scripts are stored in database, in Event master table.

Here's a quick and dirty python script to put in the same folder than a backup of Domoticz's database to get all scripts extracted and stored in the same folder as database.

Code: Select all

#!/usr/bin/python3
#   Extracts scripts from Domoticz database into the same folder as it is
#   V1.0.0

import os
import pathlib
import sqlite3
import glob

def extractScripts(db):
    print('Working for '+db)
    connection = sqlite3.connect(db)
    cursor = connection.cursor()
    cursor.execute('select Name, Interpreter, XMLStatement from EventMaster')
    for row in cursor.fetchall():
        print('Writing '+row[0]+'.lua')
        outStream = open('./'+row[0]+'.lua', 'wt')
        outStream.write(row[2])
        outStream.close()
    connection.close()

# Set current working directory to this python file folder
currentPath = pathlib.Path(__file__).parent.resolve()
currentCommandFile = pathlib.Path(__file__).stem
os.chdir(currentPath)
print('Scanning '+str(currentPath))

for db in glob.glob('Domoticz*.db'):
    extractScripts(db)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest