Page 1 of 1

lua error returned: 32256

Posted: Friday 16 January 2015 0:50
by mistreg94
Hello everybody,

I can not use the command line " os.execute" in a lua script.
I get the following error:

Code: Select all

Error: Error executing script command (/home/pi/domoticz/scripts/lua/script_device_hyperion.lua). returned: 32256
I created a virtual hardware "Equipement Virtuel" :
Image

I add a new "Manual Light/Switch" on my hardware "Equipement Virtuel" :
Image

I attached the script (script:///home/pi/domoticz/scripts/lua/script_device_hyperion.lua) on my switch Hyperion :
Image

Here are the contents of my folder "lua" :
Image

Here is the code of my script "script_device_hyperion.lua" :

Code: Select all

commandArray = {}
if (devicechanged['Hyperion'] == 'Off') then
      commandArray['Lumière Salon']='On'
      os.execute ('/home/pi/domoticz/scripts/lua/script-ssh_reboot-hyperion.sh')
end
return commandArray
Here is the code of my script "script-ssh_reboot-hyperion.sh" :

Code: Select all

#!/bin/bash
ssh root:[email protected] //storage/reboot_hyperion.sh
When I run the script "script-ssh_reboot-hyperion.sh" in a terminal, it works well :
Image

When I press my button "Hyperion," the light of my living room lights ("Lumière Salon").
But my script "script-ssh_reboot-hyperion.sh" is not executes and I get the following logs:
Image

Can you help me ???
Thank you.

misterg94

Re: lua error returned: 32256

Posted: Friday 16 January 2015 20:19
by mistreg94
I found my problem!

Domoticz uses "root" to launch scripts.

I had only generated an ssh key for "pi".

Here are the actions that I realized :

Code: Select all

1/ I chose a new password for"root"
pi@domoticzpi $ sudo passwd root

2/ I log in "root" :
pi@domoticzpi $ sudo passwd root

3/ I generate a new ssh key :
root@domoticzpi: ssh-keygen -t rsa

4/ I export this new key on my other server
Further, in my code, the ' were not good :

Code: Select all

os.execute ('/home/pi/domoticz/scripts/lua/script-ssh_reboot-hyperion.sh')

Re: lua error returned: 32256

Posted: Friday 16 January 2015 20:28
by mistreg94
I deleted "script-ssh_reboot-hyperion.sh" and I modified "script_device_hyperion.lua" like this :

Code: Select all

commandArray = {}
if (devicechanged['Hyperion'] == 'Off') then
      os.execute ('ssh root:[email protected] //storage/reboot_hyperion.sh')
end
return commandArray
problem solved

lua error returned: 32256 - solution

Posted: Saturday 15 October 2016 14:29
by ArturK
My simple solution for error 32256 is to change permission rights to the script *.sh. You don't have rights, change it to 0777 (rwxrwxrwx) and that's all.

Re: lua error returned: 32256

Posted: Sunday 02 December 2018 20:32
by ErikAtSpijk
Thanks, had the excact same two problems