cannot create new scripts?  [Solved]

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

Moderator: leecollings

Post Reply
akamming
Posts: 422
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

cannot create new scripts?

Post by akamming »

Hi,

i am a happy dzvents user. But now i have a weird issue: Since a long time i created a new script and i noticed the script was not triggered. Some furhter investigation showed me the script file was not created. te reproduce the problem i tried with a sample script. So the steps

1. create new dzvents script (type device) with name 'Arnold' and the following code

Code: Select all

return {
	on = {
		devices = {
			'test'
		}
	}, 
	execute = function(domoticz, device)
		domoticz.log('Device ' .. device.name .. ' was changed', domoticz.LOG_INFO)
	end
}
2. enable the script (in my case: Set the button to 'Aan''
3. Save the script. I see the following log entries appear

Code: Select all

2019-05-10 12:13:39.651  Status: dzVents: Write file: /home/domoticz/domoticz/scripts/dzVents/generated_scripts/Appliances.lua
2019-05-10 12:13:39.652  Status: dzVents: Write file: /home/domoticz/domoticz/scripts/dzVents/generated_scripts/Rova.lua
2019-05-10 12:13:39.654  Status: dzVents: Write file: /home/domoticz/domoticz/scripts/dzVents/generated_scripts/Lights.lua
2019-05-10 12:13:39.656  Status: dzVents: Write file: /home/domoticz/domoticz/scripts/dzVents/generated_scripts/Ventilation.lua
2019-05-10 12:13:39.658  Status: dzVents: Write file: /home/domoticz/domoticz/scripts/dzVents/generated_scripts/Smoke.lua
2019-05-10 12:13:39.660  Status: dzVents: Write file: /home/domoticz/domoticz/scripts/dzVents/generated_scripts/Alarm.lua
2019-05-10 12:13:39.661  Status: dzVents: Write file: /home/domoticz/domoticz/scripts/dzVents/generated_scripts/Arnold.lua
4. if i push the button named 'test' nothing happens. (expected behaviour would be the logline 'Device test was changed'
5. i took a look at the filesystem level. And although there is a log entry (see step 3). the file Arnold.lua was not created:

Code: Select all

pi@pi:/home/domoticz/domoticz/scripts/dzVents/generated_scripts $ ls -Fla
totaal 72
drwxr-xr-x 2 pi       pi        4096 aug 29  2017 ./
drwxr-xr-x 6 pi       pi        4096 okt  8  2017 ../
-rw-r----- 1 domoticz domoticz  4559 mei 10 12:13 Alarm.lua
-rw-r----- 1 domoticz domoticz 11761 mei 10 12:13 Appliances.lua
-rw-r----- 1 domoticz domoticz  3925 mei 10 12:13 Energy.lua
-rw-r----- 1 domoticz domoticz 16081 mei 10 12:13 Lights.lua
-rw-r--r-- 1 pi       pi         189 aug 29  2017 README.md
-rw-r----- 1 domoticz domoticz  3197 mei 10 12:13 Rova.lua
-rw-r----- 1 domoticz domoticz   980 mei 10 12:13 Smoke.lua
-rw-r----- 1 domoticz domoticz 12034 mei 10 12:13 Ventilation.lua
Does anyone know what i am doing wrong?

(PS changing an existing script does work. Apparently dzVents cannot create new scripts for whatever reason)
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: cannot create new scripts?

Post by waaren »

akamming wrote: Friday 10 May 2019 12:22 ... Apparently dzVents cannot create new scripts for whatever reason.
What happens if you copy paste your script into nano, vi or another editor and try to save it to this location ?
Can you try this as the domoticz user and if that does not work using sudo ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: cannot create new scripts?

Post by emme »

could you try to post the result of:

Code: Select all

mount
and

Code: Select all

df -h
The most dangerous phrase in any language is:
"We always done this way"
akamming
Posts: 422
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: cannot create new scripts?  [Solved]

Post by akamming »

waaren wrote: Friday 10 May 2019 12:58 Can you try this as the domoticz user and if that does not work using sudo ?
I did not try this, but your anwser put me on the right track. Apparently the domoticz user was not able to create the file. I think i corrupted the permissions by doing the update to the latest stable with the pi user (instead of domoticz user).

I just reset the owner of alle dirs and files in the domoticz tree to the domoticz user and now it works again

it would be nice if the permission problem was detected in the log file..., but for now i'm happy it works again

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

Re: cannot create new scripts?

Post by waaren »

akamming wrote: Friday 10 May 2019 14:13 it would be nice if the permission problem was detected in the log file..., but for now i'm happy it works again
With latest Beta you now will receive a message if something goes wrong while writing dzVents scripts from the internal event editor to the OS file system. Still not very detailed but it's a start :)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
akamming
Posts: 422
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: cannot create new scripts?

Post by akamming »

waaren wrote: Sunday 12 May 2019 14:28 With latest Beta you now will receive a message if something goes wrong while writing dzVents scripts from the internal event editor to the OS file system. Still not very detailed but it's a start :)
tx!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest