Lua is not working anymore
Moderator: leecollings
-
- Posts: 1602
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Lua is not working anymore
Dear al i did use a external lua script [ in map scripts...]
Now i did setup my new Domoticz hardware...
And try to make the script working in the internal lua option..
Do have: Only not working anymore..
Perhaps someone see where a thing is going wrong?
Thanks for the help
Now i did setup my new Domoticz hardware...
And try to make the script working in the internal lua option..
Do have: Only not working anymore..
Perhaps someone see where a thing is going wrong?
Thanks for the help
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Re: Lua is not working anymore
When posting code, please use the Code blocks. Nobody will type over your script
- emme
- Posts: 909
- Joined: Monday 27 June 2016 11:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Milano, Italy
- Contact:
Re: Lua is not working anymore
are you sure you have NC installed into your new hardware?
The most dangerous phrase in any language is:
"We always done this way"
"We always done this way"
-
- Posts: 1602
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Lua is not working anymore
MM
NC what package???
How to install/check?
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
- emme
- Posts: 909
- Joined: Monday 27 June 2016 11:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Milano, Italy
- Contact:
Re: Lua is not working anymore
try to run it in a shell window...
what kind of hardware are you running?
what kind of hardware are you running?
The most dangerous phrase in any language is:
"We always done this way"
"We always done this way"
-
- Posts: 1602
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Lua is not working anymore
my hardware is Odriod Xu4 with dietpi
shell?
shell?
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
-
- Posts: 1602
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Lua is not working anymore
Code:
Code: Select all
commandArray = {}
--print ("D.M.: IP Port check")
function update_portalive(name,ip,port)
-- Windows https://joncraton.org/blog/46/netcat-for-windows/ untested
s = "nc -z -w 1 " .. ip .." " .. tostring(port)
if (os.execute(s) == nil) then
if (otherdevices[name] == 'On') then
commandArray[name] = 'Off'
print (name .. " Dead")
end
else
if (otherdevices[name] == 'Off') then
print (name .. " Is a Alive")
commandArray[name] = 'On'
end
end
end
-- Fill in your services here NAMEOFVIRTUALDEVICE IP PORT
update_portalive("Port: Schuurtje","192.168.5.98",552)
update_portalive("Port: Solarmeter","192.168.5.99",555)
update_portalive("Port: Dakrand","192.168.5.97",553)
update_portalive("Port: Domoticz 1","192.168.5.75",8081)
update_portalive("Port: Domoticz 3","192.168.5.3",8083)
update_portalive("Port: Domoticz 2","192.168.5.147",8082)
update_portalive("Port: Minecraft","192.168.5.147",22222)
return commandArray
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
- jvdz
- Posts: 2334
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Lua is not working anymore
So what is shown in the domoticz log file? it should show at least the text: D.M.: IP Port check
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- Posts: 1602
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Lua is not working anymore
Yep there is:
Code: Select all
2017-11-22 21:10:00.074 LUA: D.M.: IP Port check
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
- jvdz
- Posts: 2334
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Lua is not working anymore
Ok, so do as emme stated: run the command from the command prompt (shell) on the domoticz server to see what the result is.
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- Posts: 1602
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Lua is not working anymore
when i do the script on the old way..
Set a document in the script folder.
And activate it wit./name_of_script
Also in domoticz the same log.
Only no switching devices.
So i think i mis a package...
only what is NC?
Set a document in the script folder.
And activate it wit./name_of_script
Also in domoticz the same log.
Only no switching devices.
So i think i mis a package...
only what is NC?
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
- jvdz
- Posts: 2334
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Lua is not working anymore
You could have done a simple google search to check that out.
https://www.google.nl/search?q=Linux+nc ... nc+command
Jos

https://www.google.nl/search?q=Linux+nc ... nc+command
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- Posts: 1602
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Lua is not working anymore
yep google is always your friend...
Only i do not understand nc...?
And now i see
So i am a bricklayer not a linux epxert...
Only i do not understand nc...?
And now i see
Code: Select all
Ongeveer 556.000 resultaten (0,80 seconden)
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
- jvdz
- Posts: 2334
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Lua is not working anymore
... but it seems you want to learn as you are participating in an English spoken Domoticz opensource community where one is expected to have an DIY approach.
I know it is easy for me to state this as I am working all my life in IT, so sorry for that, but when I started with Domoticz I had zero Raspberry knowledge and solely worked with big IBM Mainframes and any flavor of Microsoft OS. This meant for me to do a shitload of research on linux, domoticz, lua ESPEASY and took me around a year to get comfortable doing all the programming in LUA myself.
Just keep smiling and digging away and one day you get there.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- Posts: 1602
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Lua is not working anymore
I know...
I can use espeasy rpi openwrt autocad solidworks sketchup odriod domoticz minecraftserver windows office html etc..
Only lua i do not understand...
Like is say... runs for a few years..
A new setup, and not working any more...
when i run from putty:
So thanks for all te support...
I can use espeasy rpi openwrt autocad solidworks sketchup odriod domoticz minecraftserver windows office html etc..
Only lua i do not understand...
Like is say... runs for a few years..
A new setup, and not working any more...
when i run from putty:
Code: Select all
root@DietPi:/home/domoticz/scripts/lua# ./script_time_portcheck.lua
./script_time_portcheck.lua: regel 1: commandArray: opdracht niet gevonden
./script_time_portcheck.lua: regel 3: syntaxfout nabij onverwacht symbool '"D.M.: IP Port check"'
./script_time_portcheck.lua: regel 3: ` print ("D.M.: IP Port check")'
root@DietPi:/home/domoticz/scripts/lua#
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
- jvdz
- Posts: 2334
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Lua is not working anymore
You can't run the script from the command prompt as the eventsystem tables are missing when not shelled from the eventsystem.
Just add some more debug print() statements in the script in an effort to debug the whole script.
what does this script return in the logfile?:
Jos
Just add some more debug print() statements in the script in an effort to debug the whole script.
what does this script return in the logfile?:
Code: Select all
commandArray = {}
--print ("D.M.: IP Port check")
function update_portalive(name, ip, port)
-- Windows https://joncraton.org/blog/46/netcat-for-windows/ untested
s = "nc -z -w 1 " .. ip .." " .. tostring(port)
print("debug:"..s)
if (os.execute(s) == nil) then
print("debug: nil returned. status of "..name.."="otherdevices[name])
if (otherdevices[name] == 'On') then
commandArray[name] = 'Off'
print(name .. " Dead")
end
else
print("debug: Not nil returned. status of "..name.."="otherdevices[name])
if (otherdevices[name] == 'Off') then
print(name .. " Is a Alive")
commandArray[name] = 'On'
end
end
end
-- Fill in your services here NAMEOFVIRTUALDEVICE IP PORT
update_portalive("Port: Schuurtje", "192.168.5.98", 552)
update_portalive("Port: Solarmeter", "192.168.5.99", 555)
update_portalive("Port: Dakrand", "192.168.5.97", 553)
update_portalive("Port: Domoticz 1", "192.168.5.75", 8081)
update_portalive("Port: Domoticz 3", "192.168.5.3", 8083)
update_portalive("Port: Domoticz 2", "192.168.5.147", 8082)
update_portalive("Port: Minecraft", "192.168.5.147", 22222)
return commandArray
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- Posts: 1602
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Lua is not working anymore
This is all:
Code: Select all
2017-11-23 23:57:00.171 LUA: D.M.: IP Port check
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
- jvdz
- Posts: 2334
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Lua is not working anymore
That isn't possible with the script I posted as that line is commented out on line 3!
Do you have multiple version of the script or double check the update worked.
Jos
Do you have multiple version of the script or double check the update worked.
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- Posts: 1602
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Lua is not working anymore
sorry did not see the update..
Now this is the update:
Just a error
Now this is the update:
Code: Select all
2017-11-24 19:52:00.648 Error: EventSystem: in Port test: [string "commandArray = {} ..."]:12: ')' expected near 'otherdevices'
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
- jvdz
- Posts: 2334
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Lua is not working anymore
Understand as I made a typo in the print() debug lines.
This script is tested and working for me on my test domoticz setup:
Hope this will work for you too.
Jos
This script is tested and working for me on my test domoticz setup:
Code: Select all
commandArray = {}
print ("debug: D.M.: IP Port check")
function update_portalive(name, ip, port)
-- Windows https://joncraton.org/blog/46/netcat-for-windows/ untested
s = "nc -z -w 1 " .. ip .." " .. tostring(port)
print("debug:"..s)
if (os.execute(s) == nil) then
print("debug: nil returned. status of "..name.."="..otherdevices[name])
if (otherdevices[name] == 'On') then
commandArray[name] = 'Off'
print(name .. " Dead")
end
else
print("debug: Not nil returned. status of "..name.."="..otherdevices[name])
if (otherdevices[name] == 'Off') then
print(name .. " Is a Alive")
commandArray[name] = 'On'
end
end
end
-- Fill in your services here NAMEOFVIRTUALDEVICE IP PORT
update_portalive("Port: Schuurtje", "192.168.5.98", 552)
--update_portalive("Port: Solarmeter", "192.168.5.99", 555)
--update_portalive("Port: Dakrand", "192.168.5.97", 553)
--update_portalive("Port: Domoticz 1", "192.168.5.75", 8081)
--update_portalive("Port: Domoticz 3", "192.168.5.3", 8083)
--update_portalive("Port: Domoticz 2", "192.168.5.147", 8082)
--update_portalive("Port: Minecraft", "192.168.5.147", 22222)
return commandArray
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Who is online
Users browsing this forum: No registered users and 1 guest