Her er ett eksempel på et script som ikke lenger fungerer.
Code: Select all
SCALE_POWER_VOLT = 4
VALUE_TYPE_POWER = 256
TYPE_TEMPERATURE = 1
POWER = 256
local myDevice = "Volt"
local deviceManager = require "telldus.DeviceManager"
local sensor = deviceManager:findByName(myDevice)
function onSensorValueUpdated(device, valueType, value, scale)
if device:id() == sensor:id() and valueType == TYPE_TEMPERATURE
then
sensor:setSensorValue(256, value, 4)
end
end
Console
Could not execute function onSensorValueUpdated: [string "<python>"]:11: attempt to index upvalue 'sensor' (a nil value)
Could not execute function onSensorValueUpdated: [string "<python>"]:11: attempt to index upvalue 'sensor' (a nil value)
Could not execute function onSensorValueUpdated: [string "<python>"]:11: attempt to index upvalue 'sensor' (a nil value)