Lua otherdevices help
Posted: Saturday 20 August 2016 5:35
I am having some issues with consistency in my Lua scripting. What would really help is a reference to the commands available. I've looked at a bunch of the documentation and examples but can't figure out why my script doesn't work for some devices. To get the status of a device I'm using the commands below:
The problem is that only the 'Office Desk Lamps' device actually returns any data which tells whether the switch is On or Off. The Miata Garage Distance is a distance sensor that returns a number in centimeters and the Fireplace Light Watts is a Z-Wave switch with kWh reporting capability. Both of these display data in Domoticz but in the Lua script the values are empty. I suspect I need some other command besides "otherdevices" to get this information for something that is not a simple switch but I don't know what command/function to use to get it.
Any help would be appreciated!
Code: Select all
local GarageDistance = 'Miata Garage Distance'
local FireplaceWatts = 'Fireplace Light Watts'
local OfficeDesk = 'Office Desk Lamps'
commandArray = {}
print('***** script_device_garage.lua executing *****')
print('Miata Garage Bay Distance =',otherdevices[GarageDistance])
print('Fireplace Light Watts =',otherdevices[FireplaceWatts])
print('Office Desk Lamps =',otherdevices[OfficeDesk])
if (devicechanged['Miata Garage Bay Status'] == 'Door Open' ) then
print(' - Miata Garage Bay Door Open')
elseif
(devicechanged['Miata Garage Bay Status'] == 'Door Closed' ) then
print(' - Miata Garage Bay Door Closed')
end
Any help would be appreciated!