I am a total beginner and below code is my very first LUA-attempt. I get the output "Script relay.lua loaded" from running it but absolutely nothing happens. What am I doing wrong?
Code: Select all
-- File: relay.lua local deviceManager = require 'telldus.DeviceManager' local breaker = 'Nexa ZW 1' --Nexa AN179 z-wave on/off switch function onDeviceStateChanged(device, state, stateValue) local breaker = deviceManager:findByName(breaker) if breaker == nil then print('Breaker seems lost...') return end if (breaker:state() == 'On') then breaker:command('turn off', nil, 'breaker') return end end