Hello,
After writing my first dzVent scripts I notice that the Domoticz log does not inform you about (syntax) errors, the way I am used from Lua.
Do I need to look in another log system? Or is there no feedback at all?
gr,
rene
debug dzVents scripts - where is the syntax check?
Moderator: leecollings
-
randytsuch
- Posts: 90
- Joined: Sunday 20 March 2016 18:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: LA, Ca USA
- Contact:
Re: debug dzVents scripts - where is the syntax check?
I get errors ALL the time, just looking at the domoticz log.
This is the only lua compiler/system I've ever used, so I have nothing to compare it to though.
It tells you what it doesn't like, and what line the error is on. I can usually figure out what's wrong based on the error message.
Between the error messages, and adding a lot of print statements to see what's really happening, I've been able to get my scripts working.
The print statements will also show up in the log.
I'm not sure if its really checking for syntax, but I only know enough SW to be dangerous.
Randy
This is the only lua compiler/system I've ever used, so I have nothing to compare it to though.
It tells you what it doesn't like, and what line the error is on. I can usually figure out what's wrong based on the error message.
Between the error messages, and adding a lot of print statements to see what's really happening, I've been able to get my scripts working.
The print statements will also show up in the log.
I'm not sure if its really checking for syntax, but I only know enough SW to be dangerous.
Randy
Re: debug dzVents scripts - where is the syntax check?
thanks, but the question regarded dzVents, not LUA
-
dannybloe
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: debug dzVents scripts - where is the syntax check?
It's the same. dzVents is Lua and doesn't swallow any Lua errors (or at least shouldn't). It is like randytsuch said above. I see all syntax errors and runtime errors in the domoticz log.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
Re: debug dzVents scripts - where is the syntax check?
I did some testing.
You are correct regarding the 'execute' part. Errors in that part result in log messages, as soon as the function is triggered. When you make a mistake in the header, there is no feedback. (and the function is not triggered)
You are correct regarding the 'execute' part. Errors in that part result in log messages, as soon as the function is triggered. When you make a mistake in the header, there is no feedback. (and the function is not triggered)
Code: Select all
return {
active = true,
on = {
deices = {'dummy'} <--- typo, not in log
},
execute = function(domoticz, switch)
domoticz.log ('Hello???')
if (switch.state == 'On') then
domotic.log ('On') <-- typo, in log when triggered
else
domoticz.log('Off')
end
end
}
-
dannybloe
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: debug dzVents scripts - where is the syntax check?
Yes, but that's not a lua or syntax error. What you can do is turn on debug logging for dzvents in domoticz settings. That can give you more information about preprocessing your scripts. I will see if I can build in more warnings about missing parts in the on-section.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
snuiter
- Posts: 67
- Joined: Saturday 17 June 2017 12:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Contact:
Re: debug dzVents scripts - where is the syntax check?
Bear in mind that when writing scripts in the domoticz/events option there is a simple syntax check. If I make a basic typo there is a red cross in the beginning of the line. Hope this helps a bit
Who is online
Users browsing this forum: No registered users and 1 guest