Lua scripts not called

Moderator: leecollings

Post Reply
User avatar
mwpnl
Posts: 4
Joined: Sunday 15 November 2015 21:09
Target OS: Linux
Domoticz version: 2.3598
Location: Netherlands
Contact:

Lua scripts not called

Post by mwpnl »

Hi,

I'm running domoticz v2.3598 on CentOs 7.1. I've just started exploring the functionality of lua scripts, but am running into a problem: the lua script doesn't seem to be called.

I've created the following file: /opt/domoticz/scripts/lua/script_time_blaat.lua with the following content:

Code: Select all

print('script loaded')
commandArray = {}
return commandArray
My expectation was that, every minute, a log entry in domoticz would appear (Setup->Log). But this is not the case, the only lines related to the EventSystem are the following:

Code: Select all

2015-11-15 21:07:01.972 EventSystem: reset all device statuses...
2015-11-15 21:07:01.972 EventSystem: Started
Am I missing something trivial here?
I've checked the permissions on both the file and underlying folders, but can't seem to find anything out of the ordinary (owned by the daemon user+group, -rwxr--r--)
User avatar
jvdz
Posts: 2333
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Lua scripts not called

Post by jvdz »

That is indeed what should happen.
You do have the option in Setup/Setting/Other for EventSystem (Lua/Blockly/Scripts): Disabled: deselected?

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
mwpnl
Posts: 4
Joined: Sunday 15 November 2015 21:09
Target OS: Linux
Domoticz version: 2.3598
Location: Netherlands
Contact:

Re: Lua scripts not called

Post by mwpnl »

jvdz wrote:That is indeed what should happen.
You do have the option in Setup/Setting/Other for EventSystem (Lua/Blockly/Scripts): Disabled: deselected?

Jos
Yeah, sorry, I indeed have that checkbox unchecked in the settings dialog. Apart from that, I couldn't find any place with instructions.
I've also renamed the lua file to _device_, to see what would happen. But nothing happens then either, no matter how many switches I push :lol:
User avatar
jvdz
Posts: 2333
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Lua scripts not called

Post by jvdz »

Have you tried just to run the script from a console session to ensure lua is properly installed?

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
mwpnl
Posts: 4
Joined: Sunday 15 November 2015 21:09
Target OS: Linux
Domoticz version: 2.3598
Location: Netherlands
Contact:

Re: Lua scripts not called

Post by mwpnl »

Affirmative. Running the script (lua script_time_blaat.lua) from the user-context (su domoticz) prints the line of text perfectly in the command-line.
User avatar
jvdz
Posts: 2333
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Lua scripts not called

Post by jvdz »

All sounds like it should be. Remember one member having issues with this as well and to fix it for him he had to locate the scripts is:
/volume1/@appstore/domoticz/var/scripts/lua/

Maybe something to check, but other that that I am out of ideas.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
mwpnl
Posts: 4
Joined: Sunday 15 November 2015 21:09
Target OS: Linux
Domoticz version: 2.3598
Location: Netherlands
Contact:

Re: Lua scripts not called

Post by mwpnl »

I've just did some debugging on the EventSystem.cpp file, and discovered what was wrong.

I'm using the XFS filesystem, and as it turns out, d_type never returns the correct value with XFS (source).
Since the d_type is used in EventSystem.cpp to differentiate between real files and directories, all valid lua-files are ignored.

I've made a few changes into the EventSystem.cpp, to use stat instead of d_type, and now it works like a charm!

Thanks so much for your help Jos!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest