Fibaro RGBW control by Fibaro switch Topic is solved

For Z-Wave related questions in Domoticz

Moderator: leecollings

User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Fibaro RGBW control by Fibaro switch

Post by emme »

uh.. :(
sorry
The most dangerous phrase in any language is:
"We always done this way"
piokuc

Re: Fibaro RGBW control by Fibaro switch

Post by piokuc »

No
It no works ok. Because when i Turn OFF KINKIET for about some time it Turn ON automatical.
I dont know what is it.
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Fibaro RGBW control by Fibaro switch

Post by emme »

leave only the script and remove the secondary dependecy from devices....
The most dangerous phrase in any language is:
"We always done this way"
piokuc

Re: Fibaro RGBW control by Fibaro switch

Post by piokuc »

i have only script. But problem is in script
piokuc

Re: Fibaro RGBW control by Fibaro switch

Post by piokuc »

ok
I corrected script and now works fast and good:

Code: Select all

commandArray = {}
    if devicechanged['Kinkiet'] and otherdevices['Kinkiet'] == 'On' then
        if otherdevices['Switch2'] == 'Off' then
            commandArray['Switch2'] = 'On'
        end
    end

    if devicechanged['Kinkiet'] and otherdevices['Kinkiet'] == 'Off' then
        if otherdevices['Switch2'] == 'On' then
            commandArray['Switch2'] = 'Off'
        end
    end

    if devicechanged['Switch2'] and otherdevices['Switch2'] == 'On' then
        if otherdevices['Kinkiet'] == 'Off' then
            commandArray['Kinkiet'] = 'On'
        end
    end

    if devicechanged['Switch2'] and otherdevices['Switch2'] == 'Off' then
        if otherdevices['Kinkiet'] == 'On' then
            commandArray['Kinkiet'] = 'Off'
        end
    end
return commandArray
BTW
Problem which i post with setting SLAVE/SECONDARY device also should be repaired by developer.

@emme thanks for your HELP :)
piokuc

Re: Fibaro RGBW control by Fibaro switch

Post by piokuc »

BTW
I can use script lua to control relay by GPIO from directory /scripts to use it in GUI in menu EVENTS ?

Code: Select all

-- script_device_Zaluzje_pietro.lua
 
local sensor = 'Zaluzje pietro'
 
commandArray = {}
 
if (devicechanged[sensor] == 'On') then
print ("Odsloniecie zaluzji na pietrze przez przekaznik na GPIO 19")
os.execute ("/usr/local/bin/gpio export 19 in")
os.execute ("/usr/local/bin/gpio export 19 out")
os.execute ("sleep 0.1")
os.execute ("/usr/local/bin/gpio export 19 in")
end
 
if (devicechanged[sensor] == 'Off') then
print ("Zasloniecie zaluzji na pietrze przez przekaznik na GPIO 16")
os.execute ("/usr/local/bin/gpio export 16 in")
os.execute ("/usr/local/bin/gpio export 16 out")
os.execute ("sleep 0.1")
os.execute ("/usr/local/bin/gpio export 16 in")
end

if (devicechanged[sensor] == 'Stop') then
print ("Ustawienie zaluzji na pietrze w pozycji MY przez przekaznik na GPIO 13")
os.execute ("/usr/local/bin/gpio export 13 in")
os.execute ("/usr/local/bin/gpio export 13 out")
os.execute ("sleep 0.1")
os.execute ("/usr/local/bin/gpio export 13 in")
end
 
return commandArray
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Fibaro RGBW control by Fibaro switch

Post by emme »

GPIO needs to be exported BEFORE domoticz Start (see http://www.domoticz.com/wiki/GPIO )
then you can see them as devices
The most dangerous phrase in any language is:
"We always done this way"
piokuc

Re: Fibaro RGBW control by Fibaro switch

Post by piokuc »

yes ok but if now i use script in directory i can not exported GPIO. But if i want use scipt in event i must exported ?
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Fibaro RGBW control by Fibaro switch

Post by emme »

if you want to use GPIO it would be better to export them and configure the hardware in domoticz

Running from a script is not a good idea:
each os.execute is a different thread, so except the first, all others generate an error for missing gpio definition
by the time the os.execute finish, all the settings regard the GPIO are lost... no more output, no more input

If you have always connected a switch to a gpio... than configure it as hardware ;)
The most dangerous phrase in any language is:
"We always done this way"
piokuc

Re: Fibaro RGBW control by Fibaro switch

Post by piokuc »

but how control gpio in lua script by Events menu ?
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest