Ik gebruik sinds kort de Conbee ii usb stick in combinatie met Domoticz en werkelijk wat een geweldig apparaatje.
Ik kom echter tegen een probleem aan met een van mijn wireless switches. Ik gebruik altijd Blockly waar het kan omdat ik deze taal niet ken en dus hoop ik dat iemand mij hier kan helpen.
Om precies te zijn gaat het om een Xiaomi Wireless round switch
Ik gebruik normaal via de Gateway van Xiaomi dit script om met de switch andere apparaten aan of uit te schakelen.
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  | return {
   on = { devices = { 123 }},        -- idx of your button
               
   execute = function(dz, item )
        if item.state == "Click" then
            dz.devices(456).toggleSwitch()    -- idx of your Yeelight
        elseif item.state == "Double Click" then
            dz.devices(789).toggleSwitch()    -- idx of your other light
        elseif item.state == "Long Click" then
            -- Just as an example; this will dump all attributes and dzVents functions for this device to the domoticz log
            dz.devices(456).dump()          -- idx of your Yeelight
        else 
            dz.log("state of " .. item.name .. " is now Off")
        end
   end | 
 
Nummers respectievelijk gewijzigd naar de apparaten uiteraard alsook de Schakel namen van Click, Double Click gewijzigd naar B1 B2 B3 ....
Nu is het zo wanneer ik dit script (aangepast) gebruik en druk op de wireless switch dat hij de volgende melding geeft in domoticz:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  | return {
   on = { devices = { 64 }},        -- idx of your button
               
   execute = function(dz, item )
        if item.state == "B1" then
            dz.devices(51).toggleSwitch()    -- idx of your Yeelight
        elseif item.state == "B3" then
            dz.devices(6).toggleSwitch()    -- idx of your other light
        elseif item.state == "B2" then
            -- Just as an example; this will dump all attributes and dzVents functions for this device to the domoticz log
            dz.devices(7).dump()          -- idx of your Yeelight
        else 
            dz.log("state of " .. item.name .. " is now Off")
        end
   end
} | 
 
2020-10-20 17:12:13.112 Error: EventSystem: Lua script Wireless Round Switch did not return a commandArray
Wat gaat hier fout en hoe los ik dit op?
Edit:
Na wat googlen ben ik er uit gekomen.
Als je een selector switch hebt moet jij bij de Level action een Json invoeren, bijv om een lamp te aan/uit te schakelen voor je het volgende in:
http://IP:PORT/json.htm?type=command¶m=switchlight&idx=99&switchcmd=Toggle
                                                
[
                        Voor 5% gewijzigd door
                                                     wou5er                                                 op 20-10-2020 19:02
                                            ]