What I have:
Raspberry Pi 2
Linux raspberrypi 4.9.24-v7+
GNU bash, version 4.3.30(1)-release
Node v6.0.0
Domoticz V3.8153
Xiaomi Humidifier
In directories on Raspberry Pi:
I did step-by-step from this topic viewtopic.php?f=56&t=17498 about Xiaomi Humidifier.
All my commands work perfect from command line in terminal. Humidifier works correctly without Domoticz.
In Domoticz:
I did Dummy switch (selector) with name 'Humidifier'.
I made 4 selector levels - off, Silent, Medium, High.
I left empty selector actions. Am I right?
When I put Lua script in "Setup->More options->Events", I found error in log:
>Error: EventSystem: Lua script Humidifier did not return a commandArray
My code is:
Code: Select all
commandArray = {}
-- Humidifier
if devicechanged['Humidifier'] == 'Silent' then
os.execute ('screen -S humidifiertemp -d -m bash /home/pi/domoticz/scripts/humidifiercontrol.sh 192.168.1.40 on silent')
end
if devicechanged['Humidifier'] == 'Medium' then
os.execute ('screen -S humidifiertemp -d -m bash /home/pi/domoticz/scripts/humidifiercontrol.sh 192.168.1.40 on medium')
end
if devicechanged['Humidifier'] == 'High' then
os.execute ('screen -S humidifiertemp -d -m bash /home/pi/domoticz/scripts/humidifiercontrol.sh 192.168.1.40 on high')
end
if devicechanged['Humidifier'] == 'Off' then
os.execute ('screen -S humidifiertemp -d -m bash /home/pi/domoticz/scripts/humidifiercontrol.sh 192.168.1.40 off')
end
return commandArray
Nothing work from Domoticz.
Everything work perfect from command line. Where is the mistake?
PS. I found that Lua changed to dzVents, but I don't know how to adapt Lua-code for dzVents.
Please, help me!
Thank you.