Hello everyone
I start in the LUA coding, I have a contact to which I try a code it is to display a text in a virtual device, I simply copied the following code:
- Lighting Entry Light.
commandArray = {}
if (devicechanged ['tank']) then
commandArray [ 'tank'] = 'On'
print ('Ignition')
http: //192.168.X.XX: 8080 / json.htm type = command & param = udevice & idx = 4 & sValue ignition =
end
return commandArray
what is incredible is when I remove the line "http ........." I have the text "ignition" which displays in the domoticz log and when I place the line "http .. ......... "in the program I have the error:
2018-02-21 19: 53: 02.118 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_device_on.lua: /home/pi/domoticz/scripts/lua/script_device_on.lua:4: expected near ' / '
and I no longer have "ignition" in the Log
I have no null password, for the virtual sensor I chose as sensor type "TEXT"
if a charitable soul can help me, or if someone has already had this problem because I will crack
Thanks for your help
impossible execution code LUA
Moderator: leecollings
- jvdz
- Posts: 2445
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: impossible execution code LUA
Is that first line the actual code? if so then it makes perfect sense you get an error as that is invalid syntax.figaro wrote: Wednesday 21 February 2018 22:19 http: //192.168.X.XX: 8080 / json.htm type = command & param = udevice & idx = 4 & sValue ignition =
n /home/pi/domoticz/scripts/lua/script_device_on.lua: /home/pi/domoticz/scripts/lua/script_device_on.lua:4: expected near ' / '
Look at UrlOpen in the EventSystem wiki page for the proper syntax. The end of the url also looks wrong by the way:
Something like this should be close:
Code: Select all
commandArray['OpenURL']='http://192.168.X.XX:8080/json.htm?type=command¶m=udevice&idx=4&sValue=ignition'
Jos
-
figaro
- Posts: 2
- Joined: Wednesday 21 February 2018 22:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: impossible execution code LUA
Hello
I thank you for this answer I will try, I think your explanation will be enough for it to work
Thank you again for your help
I thank you for this answer I will try, I think your explanation will be enough for it to work
Thank you again for your help
Who is online
Users browsing this forum: No registered users and 1 guest