Hello, I am a newbe in lua. I have a time script in which I want to ask the status of a dummy-switch.
As a test I tried:
if (otherdevices('Alarm_Aan_Uit') == 'On') then
print('Aan')
else
print('Uit')
end
In the log I find:
2022-09-17 10:28:00.488 Error: EventSystem: in /home/pi/domoticz/scripts/lua/script_time_PIRs.lua: /home/pi/domoticz/scripts/lua/script_time_PIRs.lua:37: attempt to call a table value (global 'otherdevices')
What is my error?
Switch status in time script
Moderator: leecollings
-
- Posts: 28
- Joined: Monday 19 July 2021 11:17
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Hellevoetsluis (NL)
- Contact:
-
- Posts: 28
- Joined: Monday 19 July 2021 11:17
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Hellevoetsluis (NL)
- Contact:
Re: Switch status in time script
I found my own error! Use [] instead of (). Does somebody know a complet description of lua syntax and domoticz functions?
- psubiaco
- Posts: 222
- Joined: Monday 20 August 2018 9:38
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Italy
- Contact:
Re: Switch status in time script
LUA is a standard scripting language: you can find manuals in the web, https://www.lua.org
To write scripts for Domoticz, you can find several example in the Domoticz wiki https://www.domoticz.com/wiki and github: you can find many scripts at https://github.com/CreasolTech/domoticz_lua_scripts
To write scripts for Domoticz, you can find several example in the Domoticz wiki https://www.domoticz.com/wiki and github: you can find many scripts at https://github.com/CreasolTech/domoticz_lua_scripts
Paolo
--
I use DomBus modules to charge EV car, get a full alarm system, control heat pump, fire alarm detection, lights and much more. Video
Facebook page - Youtube channel
--
I use DomBus modules to charge EV car, get a full alarm system, control heat pump, fire alarm detection, lights and much more. Video
Facebook page - Youtube channel
Who is online
Users browsing this forum: No registered users and 1 guest