Problem with Toggle Switch Script

Moderator: leecollings

Post Reply
TeamKleijn
Posts: 14
Joined: Sunday 05 January 2020 13:03
Target OS: -
Domoticz version:
Contact:

Problem with Toggle Switch Script

Post by TeamKleijn »

Hello All,

I've several KAKU switch senders wich used for switching directly Tasmota Switches and Kaku receivers ON and OFF. Even there is made a group with 6 lamps wich have to be on by pressing a button on a KAKU remotecontrol or a KAKU swich sender behind a normal swich in a wall mounted.
For single Tasmota switches i'll get it working, (Switch on the KAKU remote, Domoticz app and the wall mounted KAKU sender)
For a single KAKU receivers i'll get it working, (Switch on the KAKU remote, Domoticz app and the wall mounted KAKU sender)

But for a group i don't get it worked from the wall mounted KAKU sender (The Kaku remote works with ON and OFF)
below a working example,

Code: Select all

commandArray = {}
if (devicechanged['KL Kamer Links Schakelaar']) then
    if (otherdevices['22 Lamp Boven Tafel']=='On') then
        commandArray['22 Lamp Boven Tafel']='Off AFTER 1'
    elseif (otherdevices['22 Lamp Boven Tafel']=='Off') then
        commandArray['22 Lamp Boven Tafel']='On AFTER 1'
    end
end
return commandArray
'KL Kamer Links Schakelaar' is a KAKU sender wich sends a command In 433 Mhz to Domoticz
'22 Lamp Boven Tafel' is a KAKU receiver, wich not programmed for interacting at 'KL Kamer Links Schakelaar'
The ' AFTER 1' appending is necessary because 'KL Kamer Links Schakelaar' sends it command several time and if you don't wait a second the KAKU receiver for the lamp doesn't work because there are two commands in the 433 Mhz area atthe same time.

Below a not working example,

Code: Select all

commandArray = {}
if (devicechanged['KR Kamer Rechts Schakelaar']) then
   if (otherdevices['15 Alles Aan of Uit']=='On') then
        commandArray['15 Alles Aan of Uit']='Off AFTER 2'
    elseif (otherdevices['15 Alles Aan of Uit']=='Off') then
        commandArray['15 Alles Aan of Uit']='On AFTER 2'
    end
end
return commandArray
'KR Kamer Rechts Schakelaar' is the other switch in the same mounting, its the same KAKU sender but the command code wich send is still different.
'15 Alles Aan of Uit' is a group wich even accessable by using the KAKU remote and Domoticz App. (These options works

This script doesn't work even not if i change '15 Alles Aan of Uit' into 'Group:15 Alles Aan of Uit' or 'Scene:15 Alles Aan of Uit'' doesn't work. So ''KR Kamer Rechts Schakelaar' doesn't work...

Anyone suggestions for me to try

Thanks a lot
Rob
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Problem with Toggle Switch Script

Post by waaren »

TeamKleijn wrote: Sunday 11 October 2020 23:31 This script doesn't work even not if i change '15 Alles Aan of Uit' into 'Group:15 Alles Aan of Uit' or 'Scene:15 Alles Aan of Uit'' doesn't work. So ''KR Kamer Rechts Schakelaar' doesn't work...
For as far as I know you can set a scene to On and a group to On or Off in classic Lua but you cannot get the state of a group or scene. You will have to look at all devices in the group / scene or use dzVents

Code: Select all

print (tostring(otherdevices['15 Alles Aan of Uit']))  -- > nil
print (tostring(otherdevices['Scene:15 Alles Aan of Uit'])) -- > nil
print (tostring(otherdevices['Group:15 Alles Aan of Uit'])) -- > nil
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest