Vielleicht kannst du helfen

, ich habe einen kleinen Fehler:
2025-02-19 22:40:00.579 Error: EventSystem: in LCD Falownik Lua all: [string "commandArray = {} ..."]:4: bad argument #1 to 'pairs' (table expected, got nil)
2025-02-19 22:41:00.471 Fehler: EventSystem: in LCD Inverter Lua all: [string "commandArray = {} ..."]:4: bad argument #1 to 'pairs' (table expected, got nil)
2025-02-19 22:42:00.522 Fehler: EventSystem: in LCD Inverter Lua all: [string "commandArray = {} ..."]:4: bad argument #1 to 'pairs' (table expected, got nil)
2025-02-19 22:43:00.544 Error: EventSystem: in LCD Inverter Lua all: [string "commandArray = {} ..."]:4: bad argument #1 to 'pairs' (table expected, got nil)
Worum geht es mit Paare, Tabelle?
Ich habe ein Skript erstellt, um Daten vom Sensor an den ESP an das Display zu senden. Das Skript funktioniert, es zeigt an, was es auf dem Display anzeigen soll.
mein Skript:
commandArray = {}
-- loop through all the changed devices
for deviceName,deviceValue in pairs(devicechanged) do
if (deviceName=='L123FW') then
commandArray['OpenURL']='http://192.168.0.113/control?cmd=LCD,1,1,'..tostring(deviceValue)..'_W'
end
if (deviceName=='L123FkWh') then
commandArray['OpenURL']='http://192.168.0.113/control?cmd=LCD,2,1,'..tostring(deviceValue)..'_kWh'
end
end
return commandArray
und so sieht das Skript LUA all Anweisung aus:
commandArray = {}
print ("All based event fired");
-- loop through all the devices
for deviceName,deviceValue in pairs(otherdevices) do
-- if (deviceName=='myDevice') then
-- if deviceValue == "On" then
-- print("Device is On")
-- elseif deviceValue == "Off" then
-- commandArray['a device name'] = "On"
-- commandArray['Scene:MyScene'] = "Off"
-- end
-- end
end
-- loop through all the variables
for variableName,variableValue in pairs(uservariables) do
-- if (variableName=='myVariable') then
-- if variableValue == 1 then
-- commandArray['a device name'] = "On"
-- commandArray['Group:My Group'] = "Off AFTER 30"
-- end
-- end
end