Page 1 of 1

Control Hue light with KaKu switch

Posted: Monday 18 January 2016 10:05
by Mr-Leo
I have a Hue bridge connected to my Domoticz system. I have a KaKu (AWMT-230) transmitter connected to a wall switch. This switch does not control a physical light and is only registered in Domoticz to control a Hue light.
I have made a blocky script that turns on the Hue light when the KaKu switch is on and turns it off when the switch is off.
The problem is that i also (want to) control the Hue light with a group and/or timer and/or Hue app. When i want to turn the Hue light off with the KaKu switch and the switch is in already in the OFF-position, flipping the switch will result in a ON-signal so the light stays on.

What i want:
When the light is ON, and the switch sends an OFF signal > turn OFF the light
When the light is ON, and the switch sends an ON signal > turn OFF the light
When the light is OFF, and the switch sends an ON signal > turn ON the light
When the light is OFF, and the switch sends an OFF signal > turn ON the light

or:
When then status of the switch changes, change the status of the light

Re: Control Hue light with KaKu switch

Posted: Monday 18 January 2016 12:44
by Mr-Leo
I think i got it!

Thanks to: viewtopic.php?f=11&t=1030#p70664

Re: Control Hue light with KaKu switch

Posted: Wednesday 20 January 2016 11:35
by Mr-Leo
My Lua script gives an error every minute:

2016-01-20 11:32:00.398 Error: EventSystem: [string "commandArray = {}..."]:2: attempt to index global 'devicechanged' (a nil value)

This is the script:

Code: Select all

commandArray = {}
if  (devicechanged['Eettafel_knop'] == 'On' and otherdevices['Eettafel'] == 'Off') then
    print ('Event: Eettafel lamp=On')
    commandArray['Eettafel']='On'
end

if  (devicechanged['Eettafel_knop'] == 'On' and otherdevices['Eettafel'] == 'On') then
    print ('Event: Eettafel lamp=Off')
    commandArray['Eettafel']='Off'
end

if  (devicechanged['Eettafel_knop'] == 'Off' and otherdevices['Eettafel'] == 'On') then
    print ('Event: Eettafel lamp=Off')
    commandArray['Eettafel']='Off'
end

if  (devicechanged['Eettafel_knop'] == 'Off' and otherdevices['Eettafel'] == 'Off') then
    print ('Event: Eettafel lamp=On')
    commandArray['Eettafel']='On'
end
return commandArray