Blocky script for light not working

Moderator: leecollings

Post Reply
guantolento
Posts: 129
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Italy BG
Contact:

Blocky script for light not working

Post by guantolento »

hallo, i made this 4 script blocky to work my light in day and in night.
the script A control if someone is at home. the 2 phone have the geofence installed on. work ok.
the script B tell me if the time is in night or in day mode. work ok.
the script C disable some sequence if someone at home and switch off all light and enable some sequence if nobody at home. work ok.
the script D switch on some light and switch on some sequence. but not work and i don't so why.
Attachments
C-entrata giornaliera.JPG
C-entrata giornaliera.JPG (41.58 KiB) Viewed 2408 times
B-memo giorno notte.JPG
B-memo giorno notte.JPG (56.63 KiB) Viewed 2408 times
A-Someone At Home.JPG
A-Someone At Home.JPG (57.03 KiB) Viewed 2408 times
Master (pi3) - MB sensors + Dummy + Sysfs gpio + 1 NodOn MSP-3 + 1 Aeotec DSB28 Energy Meter + 3 Danfoss RS Room + 7 Danfoss Z Thermostat + 1 Swiid Inter + 9 FGS222
Slave01 (pi2) - MB sensors + Dummy + Weather Underground + 2 FGS223 + 1 FGWPE/F
guantolento
Posts: 129
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Italy BG
Contact:

Re: Blocky script for light not working

Post by guantolento »

this is the 4th script.
Attachments
D-entrata notturna.JPG
D-entrata notturna.JPG (53.91 KiB) Viewed 2406 times
Master (pi3) - MB sensors + Dummy + Sysfs gpio + 1 NodOn MSP-3 + 1 Aeotec DSB28 Energy Meter + 3 Danfoss RS Room + 7 Danfoss Z Thermostat + 1 Swiid Inter + 9 FGS222
Slave01 (pi2) - MB sensors + Dummy + Weather Underground + 2 FGS223 + 1 FGWPE/F
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: Blocky script for light not working

Post by emme »

Ciao,
just a clarification
scirpt D should run ONLY during the neght (should be better to use Time = NightTime instead of using 1 dummy and few time test condition?... just a question :P)

I assume that Geofence will trigger the presences scripts (are they Device Events?)
in script C you set a 10sec delay to set Someone At Home -V-, so script D should run during that time... but I assume that after 10 secs... there are no geofence activation, so the scripts does not trigger....

try to put some debug messages with the status of the tested switches...
Have you also cosidered to use LUA instead?
The most dangerous phrase in any language is:
"We always done this way"
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Blocky script for light not working

Post by StanHD »

First, replace the Script D "If" Block with the "If" block without the blue "Else If" control. The control you have used will not work without an "Else If".
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
guantolento
Posts: 129
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Italy BG
Contact:

Re: Blocky script for light not working

Post by guantolento »

StanHD wrote:First, replace the Script D "If" Block with the "If" block without the blue "Else If" control. The control you have used will not work without an "Else If".
hi stanHD, i made it and the script work now. i take a big mistake. now i reply to the ather user over.
Master (pi3) - MB sensors + Dummy + Sysfs gpio + 1 NodOn MSP-3 + 1 Aeotec DSB28 Energy Meter + 3 Danfoss RS Room + 7 Danfoss Z Thermostat + 1 Swiid Inter + 9 FGS222
Slave01 (pi2) - MB sensors + Dummy + Weather Underground + 2 FGS223 + 1 FGWPE/F
guantolento
Posts: 129
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Italy BG
Contact:

Re: Blocky script for light not working

Post by guantolento »

emme wrote: scirpt D should run ONLY during the neght (should be better to use Time = NightTime instead of using 1 dummy and few time test condition?... just a question :P)
How i can made it ?
emme wrote: I assume that Geofence will trigger the presences scripts (are they Device Events?)
in script C you set a 10sec delay to set Someone At Home -V-, so script D should run during that time... but I assume that after 10 secs... there are no geofence activation, so the scripts does not trigger....
Yes it's correct for my work
emme wrote: try to put some debug messages with the status of the tested switches...
Have you also cosidered to use LUA instead
I'm new in this word... do yuo think LUA is Better ???
Master (pi3) - MB sensors + Dummy + Sysfs gpio + 1 NodOn MSP-3 + 1 Aeotec DSB28 Energy Meter + 3 Danfoss RS Room + 7 Danfoss Z Thermostat + 1 Swiid Inter + 9 FGS222
Slave01 (pi2) - MB sensors + Dummy + Weather Underground + 2 FGS223 + 1 FGWPE/F
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Blocky script for light not working

Post by Egregius »

ANY language is better than blockly ;)
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: Blocky script for light not working

Post by emme »

to use Nighttime variable (that runs from sunset to sunrise) you have to use LUA instead of blocky (...looks like it miss the parameter... should be inplemented?)

in LUA, your script will looks like:

Code: Select all

local GN = 'Memo Giorno / Notte -V-'
local GEOTOT = 'Geofence Totale -V-'
local INCASA = 'Someone At Home -V-'

commandArray = {}

    if (otherdevices[GN] = 'On' and ((otherdevices[GEOTOT] = 'On') and (otherdevices[INCASA] = 'On'))) then
    
-- Clausola IF alternativa
-- if (timeofday['Nighttime'] = true and ((otherdevices[GEOTOT] = 'On') and (otherdevices[INCASA] = 'On'))) then    

        commandArray['Cameretta Comò - S1'] = 'On'
        commandArray['Scene:Rientro Notturno Esterno'] = 'On'
        commandArray['Scene:Rientro Notturno Interno'] = 'On'
        commandArray['Group:Ronda Luci Zona Giorno'] = 'Inactive'
        commandArray['Group:Ronda Luci Zone Notte'] = 'Inactive'
    end

return commandArray
I have a doubt about multiple commandarray that should be converted in commandArray[1] = {['Updatedevice'] = '999|1|0'} but I don't know if this could be done for activatig groups and scenarios.... (maybe some LUA guru would help us :P)
The most dangerous phrase in any language is:
"We always done this way"
guantolento
Posts: 129
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Italy BG
Contact:

Re: Blocky script for light not working

Post by guantolento »

Thankyou, tomorrow i try this with some test.

Inviato dal mio GT-I9301I utilizzando Tapatalk
Master (pi3) - MB sensors + Dummy + Sysfs gpio + 1 NodOn MSP-3 + 1 Aeotec DSB28 Energy Meter + 3 Danfoss RS Room + 7 Danfoss Z Thermostat + 1 Swiid Inter + 9 FGS222
Slave01 (pi2) - MB sensors + Dummy + Weather Underground + 2 FGS223 + 1 FGWPE/F
guantolento
Posts: 129
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Italy BG
Contact:

Re: Blocky script for light not working

Post by guantolento »

i take some test with LUA same my start Blocky an now the system work with this script:

Script someone at home

Code: Select all

local A = 'Geofence Cristiano -V-'
local B = 'Geofence Chiara -V-'
local C = 'Geofence Totale -V-'
local D = 'Someone At Home -V-'

commandArray = {}

if (devicechanged[A] == 'On') or (devicechanged[B] == 'On') then
    commandArray[C] = 'On'
    commandArray[D] = 'On AFTER 12'
    commandArray['Scene:Ronda Luci Zona Giorno'] = 'Inactive'
    commandArray['Scene:Ronda Luci Zone Notte'] = 'Inactive'
    print ("Scene Ronda Luci Zone Giorno - Notte INACTIVE")
end
    
return commandArray
it's possible make the command 'Inactive AFTER 12' or not???
the script work ok, but in the log i cant' see the print line, why ?

Script Nobody at home

Code: Select all

local A = 'Geofence Cristiano -V-'
local B = 'Geofence Chiara -V-'
local C = 'Geofence Totale -V-'
local D = 'Someone At Home -V-'

commandArray = {}

if (otherdevices[A] == 'Off') and (devicechanged[B] == 'Off') or (devicechanged[A] == 'Off') and (otherdevices[B] == 'Off')  then
    commandArray[C] = 'Off'
    commandArray[D] = 'Off AFTER 120'
    commandArray['Scene:Spegni Luci Zona Giorno'] = 'On AFTER 120'
    commandArray['Scene:Spegni Luci Zona Notte'] = 'On AFTER 120'
    commandArray['Scene:Ronda Luci Zona Giorno'] = 'Active'
    commandArray['Scene:Ronda Luci Zone Notte'] = 'Active'
    print ("Scene Ronda Luci Zone Giorno - Notte ACTIVE")
end

return commandArray
the script work ok, but in the log i cant' see the print line, why ?

thankyou all, good morning.
Master (pi3) - MB sensors + Dummy + Sysfs gpio + 1 NodOn MSP-3 + 1 Aeotec DSB28 Energy Meter + 3 Danfoss RS Room + 7 Danfoss Z Thermostat + 1 Swiid Inter + 9 FGS222
Slave01 (pi2) - MB sensors + Dummy + Weather Underground + 2 FGS223 + 1 FGWPE/F
guantolento
Posts: 129
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: LastBeta
Location: Italy BG
Contact:

Re: RE: Re: Blocky script for light not working

Post by guantolento »

guantolento wrote:i take some test with LUA same my start Blocky an now the system work with this script:

Script someone at home

Code: Select all

local A = 'Geofence Cristiano -V-'
local B = 'Geofence Chiara -V-'
local C = 'Geofence Totale -V-'
local D = 'Someone At Home -V-'

commandArray = {}

if (devicechanged[A] == 'On') or (devicechanged[B] == 'On') then
    commandArray[C] = 'On'
    commandArray[D] = 'On AFTER 12'
    commandArray['Scene:Ronda Luci Zona Giorno'] = 'Inactive'
    commandArray['Scene:Ronda Luci Zone Notte'] = 'Inactive'
    print ("Scene Ronda Luci Zone Giorno - Notte INACTIVE")
end
    
return commandArray
it's possible make the command 'Inactive AFTER 12' or not???
the script work ok, but in the log i cant' see the print line, why ?

Script Nobody at home

Code: Select all

local A = 'Geofence Cristiano -V-'
local B = 'Geofence Chiara -V-'
local C = 'Geofence Totale -V-'
local D = 'Someone At Home -V-'

commandArray = {}

if (otherdevices[A] == 'Off') and (devicechanged[B] == 'Off') or (devicechanged[A] == 'Off') and (otherdevices[B] == 'Off')  then
    commandArray[C] = 'Off'
    commandArray[D] = 'Off AFTER 120'
    commandArray['Scene:Spegni Luci Zona Giorno'] = 'On AFTER 120'
    commandArray['Scene:Spegni Luci Zona Notte'] = 'On AFTER 120'
    commandArray['Scene:Ronda Luci Zona Giorno'] = 'Active'
    commandArray['Scene:Ronda Luci Zone Notte'] = 'Active'
    print ("Scene Ronda Luci Zone Giorno - Notte ACTIVE")
end

return commandArray
the script work ok, but in the log i cant' see the print line, why ?

thankyou all, good morning.
I take a mistake watching in the log tab.
The print its ok.

Inviato dal mio GT-I9301I utilizzando Tapatalk
Master (pi3) - MB sensors + Dummy + Sysfs gpio + 1 NodOn MSP-3 + 1 Aeotec DSB28 Energy Meter + 3 Danfoss RS Room + 7 Danfoss Z Thermostat + 1 Swiid Inter + 9 FGS222
Slave01 (pi2) - MB sensors + Dummy + Weather Underground + 2 FGS223 + 1 FGWPE/F
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest