However, I've got a problem which I do not really understand. I created a table representing groups of thermostats
in global_data.lua. I call the helper to set the setpoint of all thermostats in a group by calling for the helper function
switchHeatingGroup, e.g. switchHeatingGroups(domoticz, 'a', 17.0). This works, but I would like to use more meaningful
group names like for instance "Heating Living" or "All radiators". When I change the key names 'a', 'b', etc. by "Heating Living', 'All' etc.
it doesn't work anymore and I get an error message telling me that I'm trying to index a nil value.
Why can I use single characters as key names, but nog strings?
Af far as I found out in the forum LUA would accept this, so why doesn't dzVents?
Code: Select all
return {
helpers = {
switchHeatingGroup = function(domoticz, thermostatGroupName, setPoint)
local thermostat
local thermostats = domoticz.globalData.thermostatGroups[thermostatGroupName]
for i, thermostatName in pairs(thermostats) do
thermostat = domoticz.devices(thermostatName)
thermostat.updateSetPoint(setPoint)
end
end
},
data = {
groupLiving = {
initial = {'Heating Living N', 'Heating Living S', 'Heating Living W'}
},
thermostatGroups = {
initial = {
['a'] = {'Heating Living N', 'Heating Living S', 'Heating Living W'},
['b'] = {'Heating Kitchen'},
['c'] = {'Heating Victor'},
['d'] = {'Heating Tomas'},
['e'] = {'Heating Bedroom'},
['f'] = {'Heating Office'},
['g'] = {'Heating Bathroom Kids'},
['h'] = {'Heating Living N', 'Heating Living S', 'Heating Living W',
'Heating Dining Room', 'Heating Kitchen'},
['i'] = {'Heating Living N', 'Heating Living S', 'Heating Living W',
'Heating Kitchen'},
['j'] = {'Heating Living N', 'Heating Living S', 'Heating Living W',
'Heating Dining Room', 'Heating Kitchen',
'Heating Tomas', 'Heating T', 'Heating Bedroom',
'Heating Office', 'Heating Bathroom Kids'},
['k'] = {'Heating Living N', 'Heating Living S', 'Heating Living W',
'Heating Dining Room', 'Heating Kitchen',
'Heating V', 'Heating Bedroom',
'Heating Office', 'Heating Bathroom Kids'}
}
}
}
}