Blockly examples

Moderator: leecollings

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

Re: Blockly examples

Post by waaren »

rolandtwilt wrote: Thursday 04 March 2021 13:36 I understand what you mean and I have adjusted this. but unfortunately the script still doesn't work
Can you try this one (import code block in event editor and change device ID's to names)
schijnwerper.png
schijnwerper.png (169.77 KiB) Viewed 5479 times

Code: Select all

<xml xmlns="http://www.w3.org/1999/xhtml"><block type="domoticzcontrols_ifelseif" id="2K$G[sT^I,Ke2-LU{3?)" x="-601" y="238"><mutation elseif="4"></mutation><value name="IF0"><block type="logic_operation" id="LY2J+I2odJz|@j][+jl]"><field name="OP">AND</field><value name="A"><block type="logic_operation" id="z?Bu3w(_1z+$Mw.-A0SA"><field name="OP">AND</field><value name="A"><block type="logic_compare" id="N.kE,xqA9WyRg|8F*7($"><field name="OP">EQ</field><value name="A"><block type="switchvariablesAF" id="(E77M$43KTQS-z(srWSB"><field name="Switch">3520</field></block></value><value name="B"><block type="logic_states" id="$QAI`r2|B7;bn}Hr2Rl$"><field name="State">On</field></block></value></block></value><value name="B"><block type="logic_compare" id="v15X^ZWxN|+J;(5|+0@3"><field name="OP">EQ</field><value name="A"><block type="switchvariablesAF" id="PwNlm:FVZSA;OA+aBCJ#"><field name="Switch">3519</field></block></value><value name="B"><block type="logic_states" id="|Rqic~2y|W2uOtHFKj6!"><field name="State">On</field></block></value></block></value></block></value><value name="B"><block type="logic_compare" id="?f4*5K?m3*zyTc}p;^q)"><field name="OP">EQ</field><value name="A"><block type="switchvariablesSZ" id="`cC6gAzkrn5K*ZM(,8q="><field name="Switch">3521</field></block></value><value name="B"><block type="logic_states" id="D,5p+m^3=M1SoU+2@h!P"><field name="State">Off</field></block></value></block></value></block></value><statement name="DO0"><block type="writetolog" id="+d`WM_3k][?eIoH${)%D"><value name="writeToLog"><block type="text" id="9aNd1tCXm]16oqs1-7:d"><field name="TEXT">All conditions true; switching schijnwerper on for 1 minute.</field></block></value><next><block type="logic_setdelayed" id="eIF^{X!royl~6}IDVY2J"><value name="A"><block type="switchvariablesSZ" id="sUz]k*wPQ`*V42qX-~f("><field name="Switch">3521</field></block></value><value name="B"><block type="logic_states" id="5y@ryJ9/)W}t0L?,_:;;"><field name="State">On</field></block></value><value name="C"><block type="math_number" id="mlQ?J]ixflRG=fDq7-D2"><field name="NUM">1</field></block></value></block></next></block></statement><value name="IF1"><block type="logic_operation" id=".`Os6DS@g$8FlCDmk6!="><field name="OP">AND</field><value name="A"><block type="logic_compare" id="2w]=))Kko6rb!Cx,@#;5"><field name="OP">EQ</field><value name="A"><block type="switchvariablesAF" id=",9%Cfm0w9nxitrGxei-*"><field name="Switch">3520</field></block></value><value name="B"><block type="logic_states" id="HsiM*`_xkRp*q-BJ]Jx{"><field name="State">On</field></block></value></block></value><value name="B"><block type="logic_compare" id="3{Mgdhel1:gmxsOAiDKW"><field name="OP">EQ</field><value name="A"><block type="switchvariablesAF" id="$0ps4Ct^I#Z3?hrqDQrQ"><field name="Switch">3519</field></block></value><value name="B"><block type="logic_states" id="^KS8]{x]Xz:NVd!@^886"><field name="State">On</field></block></value></block></value></block></value><statement name="DO1"><block type="writetolog" id="G{Tc`k`dv-;u#Pj0Z,Dj"><value name="writeToLog"><block type="text" id="+6}6UYulQvs^EIuO{MLB"><field name="TEXT">Motion and time conditions true; schijnwerper already on</field></block></value></block></statement><value name="IF2"><block type="logic_operation" id="J4`h0j^5RK;6$.6}?V:/"><field name="OP">AND</field><value name="A"><block type="logic_compare" id="*`K7EgfkY#SIR)`ouFJ,"><field name="OP">EQ</field><value name="A"><block type="switchvariablesAF" id="M?xlPdbjm*emj@IXO1]Q"><field name="Switch">3520</field></block></value><value name="B"><block type="logic_states" id="|IDu@Y5Ii|q.Z1NCe6P/"><field name="State">On</field></block></value></block></value><value name="B"><block type="logic_compare" id="%nqLXAYjOP]YPuOE)E|C"><field name="OP">EQ</field><value name="A"><block type="switchvariablesAF" id="]e,OQmGBw]nrjk/u{Xs#"><field name="Switch">3519</field></block></value><value name="B"><block type="logic_states" id="Bx+@rrgWQb$@!1TtpkmV"><field name="State">Off</field></block></value></block></value></block></value><statement name="DO2"><block type="writetolog" id="7)w(~BwIU1e?rvHLQ,5%"><value name="writeToLog"><block type="text" id="xS(V.F6e--:wpc:hQ~Nt"><field name="TEXT">Time condition true but no motion detected; no action needed</field></block></value></block></statement><value name="IF3"><block type="logic_operation" id="Kz,.$Ei|AGJ,?IO=;DZA"><field name="OP">AND</field><value name="A"><block type="logic_compare" id="~MN.-Kw{%[eW[yal2Ep;"><field name="OP">EQ</field><value name="A"><block type="switchvariablesAF" id="fzrHFIE:tHz:!oVDg,#="><field name="Switch">3520</field></block></value><value name="B"><block type="logic_states" id="ctTjnWT|T!_h82OV|aBF"><field name="State">Off</field></block></value></block></value><value name="B"><block type="logic_compare" id="AUwEB7[lzk#g@%=Q?93*"><field name="OP">EQ</field><value name="A"><block type="switchvariablesAF" id="1p4mTA|~KK$a-7mX5yWV"><field name="Switch">3519</field></block></value><value name="B"><block type="logic_states" id="qXo/zDpZ=1}=TZ8N@1O#"><field name="State">On</field></block></value></block></value></block></value><statement name="DO3"><block type="writetolog" id="S~r1n]fbtM=u3Pm${;{X"><value name="writeToLog"><block type="text" id="S7dxLHC1R1e;MOa}qWxT"><field name="TEXT">Motion active but time condition false; no action needed</field></block></value></block></statement><value name="IF4"><block type="logic_operation" id="qXv68U}hr*UAj|}C*9DW"><field name="OP">AND</field><value name="A"><block type="logic_compare" id="+g7AFJ2mm@E}aQy55aFm"><field name="OP">EQ</field><value name="A"><block type="switchvariablesAF" id="cYW2HEDMIs{@GOnPL+;Q"><field name="Switch">3520</field></block></value><value name="B"><block type="logic_states" id="N|TF=h5JUW|,,6s3!O]~"><field name="State">Off</field></block></value></block></value><value name="B"><block type="logic_compare" id="n0pP+30R`*C{heM^t17!"><field name="OP">EQ</field><value name="A"><block type="switchvariablesAF" id="jwMb2P4~a9NGQOV.a{!="><field name="Switch">3519</field></block></value><value name="B"><block type="logic_states" id="^-H]*]$~#@:7Q5?UFO^d"><field name="State">Off</field></block></value></block></value></block></value><statement name="DO4"><block type="writetolog" id="Z8Xu3c,Ow#XNQ^N8[z~4"><value name="writeToLog"><block type="text" id="-f?#)6TtNG~}p7bTo0~`"><field name="TEXT">All conditions false; no action needed</field></block></value></block></statement></block></xml>
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
rolandtwilt
Posts: 74
Joined: Monday 05 October 2020 18:55
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by rolandtwilt »

thanks i'm going to try
User avatar
rolandtwilt
Posts: 74
Joined: Monday 05 October 2020 18:55
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by rolandtwilt »

It functions! sometimes with quite a bit of delay, but it works. thanks!
MikeyMan
Posts: 237
Joined: Wednesday 17 October 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by MikeyMan »

Hi all,

Thought i had a simple idea to set the dim level dependent of time with blockly.
But somehow its not working as i thought.

I created this one:
blockly.png
blockly.png (23.8 KiB) Viewed 4702 times
However, this is not doing anything. I'm not even seeing something happening in the logs. What have i done wrong?
Ron
Posts: 82
Joined: Friday 27 December 2013 23:29
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.2284
Location: Nederland, Den Bosch
Contact:

Re: Blockly examples

Post by Ron »

This worked for me:
The "Nacht" (night) function was added just to turn the light on only during the day.
The "Sensor 2 beweging" is a Fibaro sensor which has to turn on the light on movement.

The code, you can import this in Blocky:

Code: Select all

<xml xmlns="http://www.w3.org/1999/xhtml"><block type="domoticzcontrols_ifelseif" id="4s5jSAl2.Dmx*RK!{^V}" x="-659" y="-83"><mutation elseif="4"></mutation><value name="IF0"><block type="logic_operation" id="O8M4?(Tf;fa!a)Gk!^;/"><field name="OP">AND</field><value name="A"><block type="logic_compare" id="/;U`^60P/)W-3z7:~Kq]"><field name="OP">EQ</field><value name="A"><block type="switchvariablesSZ" id="6L#iDdAS|^_E)0wNH%{7"><field name="Switch">10927</field></block></value><value name="B"><block type="logic_states" id="ng6$[Z]l(dQWO||uE)iE"><field name="State">On</field></block></value></block></value><value name="B"><block type="logic_compare" id="t)r$et~iVtHljE`UQ$$p"><field name="OP">EQ</field><value name="A"><block type="switchvariablesAF" id="wUMEI1wvSyn$VF]0*ZxO"><field name="Switch">10949</field></block></value><value name="B"><block type="logic_states" id="I%WTcm][%!zZZO9nS4S["><field name="State">Off</field></block></value></block></value></block></value><statement name="DO0"><block type="logic_setdelayed" id="^int*+Uz^/tJBstgWrQJ"><value name="A"><block type="switchvariablesAF" id="wnX-$G%!afGTZiTwYACe"><field name="Switch">10949</field></block></value><value name="B"><block type="logic_states" id="4?M14TEf(wAW/.2u]p)z"><field name="State">On</field></block></value><value name="C"><block type="logic_timevalue" id="KXA!A61CCwXR:a]4D%Um"><field name="TEXT">5:00</field></block></value></block></statement><value name="IF1"><block type="logic_operation" id="I[C~8hQ{r;VTFHT@aP!="><field name="OP">AND</field><value name="A"><block type="logic_compare" id="1?KWn4J9;YH!8_|az#[Q"><field name="OP">EQ</field><value name="A"><block type="switchvariablesSZ" id="|OS|e4_.taDj.CZ~{m#T"><field name="Switch">10927</field></block></value><value name="B"><block type="logic_states" id="G54)la1^M|p0,v(Rw:Vl"><field name="State">On</field></block></value></block></value><value name="B"><block type="logic_compare" id="Sn72v:!x_qqAjvj?`Dxz"><field name="OP">EQ</field><value name="A"><block type="switchvariablesAF" id="VG5IZuqXW]d2`LS;lM)m"><field name="Switch">10949</field></block></value><value name="B"><block type="logic_states" id="`wp[p[JV}KcP!f?j9xc5"><field name="State">On</field></block></value></block></value></block></value><statement name="DO1"><block type="logic_setdelayed" id="n:5SooS8mQ2:-NTSFl.^"><value name="A"><block type="switchvariablesAF" id="JU}18=NYVI5bGU4/9~2?"><field name="Switch">10948</field></block></value><value name="B"><block type="logic_states" id="%,(JfKv#7U/a4S6fa7#n"><field name="State">On</field></block></value><value name="C"><block type="logic_timevalue" id="TPS~9YcxY2eSY|U!ws,%"><field name="TEXT">3:00</field></block></value><next><block type="logic_set" id="PP#8q/[R/aNi4@WJu=@G"><value name="A"><block type="switchvariablesAF" id="/6fyk(}Cn0A]aqeS}8}W"><field name="Switch">10949</field></block></value><value name="B"><block type="logic_states" id="m20dlaek!_+H_yEXY-@{"><field name="State">Off</field></block></value></block></next></block></statement><value name="IF2"><block type="logic_operation" id="*6squ60MES(U(?v_At%9"><field name="OP">AND</field><value name="A"><block type="logic_operation" id="t!WmAH91ij5[H%3~y?9_"><field name="OP">OR</field><value name="A"><block type="logic_compare" id="wAJrYECW%;=3w-8yL6B}"><field name="OP">EQ</field><value name="A"><block type="switchvariablesAF" id="rLsqoQHUwRg|g46jR[X)"><field name="Switch">10949</field></block></value><value name="B"><block type="logic_states" id="oW,(4i~_IeFwds|~n!/2"><field name="State">On</field></block></value></block></value><value name="B"><block type="logic_compare" id="MwR^1!gB9[gOcU(ITXY@"><field name="OP">EQ</field><value name="A"><block type="switchvariablesAF" id="6ck3wb+DY,75joF)_[;i"><field name="Switch">10948</field></block></value><value name="B"><block type="logic_states" id="A.*D!1{1ku`1E[BTLyKx"><field name="State">On</field></block></value></block></value></block></value><value name="B"><block type="logic_operation" id="%n.aqJ;_UK[GB_4{9168"><field name="OP">AND</field><value name="A"><block type="logic_compare" id="OWv!|i6(-ZyCKDV-?![T"><field name="OP">EQ</field><value name="A"><block type="switchvariablesAF" id="+*]f{-;-%2%`K:?4}L^E"><field name="Switch">70</field></block></value><value name="B"><block type="logic_states" id="qt5vV!cJuxRRwT[p9dkT"><field name="State">On</field></block></value></block></value><value name="B"><block type="logic_compare" id="#B@_6:i+XFK?l$1cu/iZ"><field name="OP">EQ</field><value name="A"><block type="switchvariablesMR" id="Lz![Ck(gLCsl7Q58=FRX"><field name="Switch">71</field></block></value><value name="B"><block type="logic_states" id="xOmfnmPEy|JQ2;aPe$,i"><field name="State">Off</field></block></value></block></value></block></value></block></value><statement name="DO2"><block type="logic_set" id="^[5)Yc8EDRmM.9z.=@)9"><value name="A"><block type="switchvariablesAF" id="vY^RMsZyjb;/+6AeboDR"><field name="Switch">8541</field></block></value><value name="B"><block type="logic_setlevel" id="}P:c8qxIurV[I7pY}i+9"><field name="NUM">25</field></block></value><next><block type="writetolog" id="vK=x.{P{|C=_,,T/qmCX"><value name="writeToLog"><block type="text" id="E=s$wRssB!s4$;u}1i[O"><field name="TEXT">Badkamer verlichting aan 25%</field></block></value></block></next></block></statement><value name="IF3"><block type="logic_operation" id="E%actva}=weelpl1`t[]"><field name="OP">AND</field><value name="A"><block type="logic_operation" id="n:]Mzo{p68Q3;f5ZjGk~"><field name="OP">OR</field><value name="A"><block type="logic_compare" id="|FWOT#S/|)y;o@:@r5%6"><field name="OP">EQ</field><value name="A"><block type="switchvariablesAF" id="=8Gu(!UOl/T6PQD,XGgr"><field name="Switch">10949</field></block></value><value name="B"><block type="logic_states" id="OT_M|9wMVy3f+)`(jkSG"><field name="State">On</field></block></value></block></value><value name="B"><block type="logic_compare" id="NqXU/hvy3{(dIRkw;Ir:"><field name="OP">EQ</field><value name="A"><block type="switchvariablesAF" id="mgMmkF11s2?_EyM1qvps"><field name="Switch">10948</field></block></value><value name="B"><block type="logic_states" id="m@dx!nR!~y~pl_|K/ga}"><field name="State">On</field></block></value></block></value></block></value><value name="B"><block type="logic_operation" id="B6-GG_vPWhGbu(~P[My:"><field name="OP">AND</field><value name="A"><block type="logic_compare" id="43SrkeM3ES6@j7;0w]CD"><field name="OP">EQ</field><value name="A"><block type="switchvariablesAF" id="$e-%CjQu26i~[~Mg1Z)a"><field name="Switch">70</field></block></value><value name="B"><block type="logic_states" id="e@[i#3.|E`4ABf`)Nzo:"><field name="State">Off</field></block></value></block></value><value name="B"><block type="logic_compare" id="]*JK4KDlp7({tfyWp=b{"><field name="OP">EQ</field><value name="A"><block type="switchvariablesMR" id="WqZeb7?-[{NA~f:HTf~s"><field name="Switch">71</field></block></value><value name="B"><block type="logic_states" id="H,~B+.q;E-^8p$P/WdjQ"><field name="State">Off</field></block></value></block></value></block></value></block></value><statement name="DO3"><block type="logic_set" id="/c9|d{aU?LFD0M(E[hS@"><value name="A"><block type="switchvariablesAF" id="fF:hI8b3C/.Z37Tb+IRY"><field name="Switch">8541</field></block></value><value name="B"><block type="logic_setlevel" id="XOIAv5^Dku;Hf-AY6(y-"><field name="NUM">45</field></block></value><next><block type="writetolog" id="Z{@~HbINzIEh%|?b8GJK"><value name="writeToLog"><block type="text" id="W$PO1F86GHJ8KHE4?om:"><field name="TEXT">Badkamer verlichting aan 45%</field></block></value></block></next></block></statement><value name="IF4"><block type="logic_operation" id="*_OLXjIDF+@s;%k7MrfF"><field name="OP">AND</field><value name="A"><block type="logic_compare" id="4tE-(OMu{L`I[Cb;aWhT"><field name="OP">EQ</field><value name="A"><block type="switchvariablesAF" id="fG%.8rWE5m`9;qY`Dcf$"><field name="Switch">10949</field></block></value><value name="B"><block type="logic_states" id="|Jdma#c/1?2yfNgBS5rf"><field name="State">Off</field></block></value></block></value><value name="B"><block type="logic_compare" id="h%V/YpN/1=!^n%Ee:})E"><field name="OP">EQ</field><value name="A"><block type="switchvariablesAF" id="Vt|Sjj.j%#4H5arjwXSf"><field name="Switch">10948</field></block></value><value name="B"><block type="logic_states" id="07uv!QN~UG%h;/1@=l4!"><field name="State">Off</field></block></value></block></value></block></value><statement name="DO4"><block type="logic_set" id=":htCCR6pwq)`KpVKKc7R"><value name="A"><block type="switchvariablesAF" id="?xtFBXXy;2+c6pUUMu#K"><field name="Switch">8541</field></block></value><value name="B"><block type="logic_states" id="3W^.A6SM#Y;DAm/7=Pg)"><field name="State">Off</field></block></value><next><block type="writetolog" id="?=-;LfkuH,6{uj,;vYi."><value name="writeToLog"><block type="text" id="k)9%EjTW59y(*}|MFnhl"><field name="TEXT">Badkamer verlichting uit</field></block></value></block></next></block></statement></block></xml>
Image
Attachments
Knipsel.JPG
Knipsel.JPG (131.01 KiB) Viewed 4696 times
Benneton
Posts: 111
Joined: Thursday 08 December 2016 9:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by Benneton »

Hi,

In the first if statement it should be or instead of and as this is not on the same day (at least that is how I have it).

Bernard
MikeyMan
Posts: 237
Joined: Wednesday 17 October 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by MikeyMan »

Tried it the other way around, and it sometimes works... However, not stable:
blockly2.png
blockly2.png (41.83 KiB) Viewed 4691 times
Benneton
Posts: 111
Joined: Thursday 08 December 2016 9:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by Benneton »

HI

Does the write to log function work? I tried this a while back to get some details on what is going on but nothing got written to log.
In my blocky's I always have the device = on (or off) then the time I want it to do a time specific thing.
MikeyMan
Posts: 237
Joined: Wednesday 17 October 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by MikeyMan »

Benneton wrote: Thursday 09 December 2021 14:06 HI

Does the write to log function work? I tried this a while back to get some details on what is going on but nothing got written to log.
In my blocky's I always have the device = on (or off) then the time I want it to do a time specific thing.
When I use a time triggered event it does. In the script above it doesn't though.
User avatar
Treve
Posts: 107
Joined: Thursday 05 November 2015 10:37
Target OS: Raspberry Pi / ODroid
Domoticz version: v4.11474
Location: Rotterdam, NL
Contact:

Re: Blockly examples

Post by Treve »

I think te the problem could be the first time comparison “20:00 and 8:00” this passed midnight ’00:00’.
- RFXtrx433E,
- AEON Labs ZW090 Z-Stick Gen5 EU
- Hue v2.1
- Raspberry Pi 3 Model B, Raspbian Stretch Full on USB-Stick.
- Domoticz 4.11474
Devices: KaKu, Z-Wave, Hue.

for testing:
Raspberry 4, 2GB, SSD
Domoticz 2022.1
Ikea Hub, Fyrtur curtain
MikeyMan
Posts: 237
Joined: Wednesday 17 October 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by MikeyMan »

Treve wrote: Thursday 09 December 2021 14:22 I think te the problem could be the first time comparison “20:00 and 8:00” this passed midnight ’00:00’.
Tried an even simpler one:
blockly3.png
blockly3.png (26.2 KiB) Viewed 4687 times
No luck

Even this one is not working:
blockly4.png
blockly4.png (14.37 KiB) Viewed 4687 times
User avatar
Treve
Posts: 107
Joined: Thursday 05 November 2015 10:37
Target OS: Raspberry Pi / ODroid
Domoticz version: v4.11474
Location: Rotterdam, NL
Contact:

Re: Blockly examples

Post by Treve »

The use in one ‘if-then’ of two same “badkamer” cause the problem.
If badkamer is on, then set badkamer 30% and switch badkamer to something else because is not on anymore.
- RFXtrx433E,
- AEON Labs ZW090 Z-Stick Gen5 EU
- Hue v2.1
- Raspberry Pi 3 Model B, Raspbian Stretch Full on USB-Stick.
- Domoticz 4.11474
Devices: KaKu, Z-Wave, Hue.

for testing:
Raspberry 4, 2GB, SSD
Domoticz 2022.1
Ikea Hub, Fyrtur curtain
Benneton
Posts: 111
Joined: Thursday 08 December 2016 9:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by Benneton »

To set different levels for different events I have created dummy switches which get turned on.
MikeyMan
Posts: 237
Joined: Wednesday 17 October 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by MikeyMan »

blockly5.png
blockly5.png (11.21 KiB) Viewed 4686 times
Somehow this only returns logging on the off switch.

Even though the switch is set:
2021-12-09 14:53:25.480 Status: User: Admin (IP: 10.0.0.32) initiated a switch command (211/Badkamer/Off)
2021-12-09 14:53:28.792 Status: User: Admin (IP: 10.0.0.32) initiated a switch command (211/Badkamer/On)
2021-12-09 14:53:34.267 Status: User: Admin (IP: 10.0.0.32) initiated a switch command (211/Badkamer/Off)
2021-12-09 14:54:09.548 Status: User: Admin (IP: 10.0.0.32) initiated a switch command (211/Badkamer/On)
2021-12-09 14:54:12.455 Status: User: Admin (IP: 10.0.0.32) initiated a switch command (211/Badkamer/Off)
2021-12-09 14:56:17.426 Status: User: Admin (IP: 10.0.0.32) initiated a switch command (211/Badkamer/On)
Same if i do it the other way around.
blockly6.png
blockly6.png (11.26 KiB) Viewed 4683 times
Somehow the "on" command doesnt trigger anything.
rrozema
Posts: 470
Joined: Thursday 26 October 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Delft
Contact:

Re: Blockly examples

Post by rrozema »

MikeyMan wrote: Thursday 09 December 2021 14:28
Treve wrote: Thursday 09 December 2021 14:22 I think te the problem could be the first time comparison “20:00 and 8:00” this passed midnight ’00:00’.
Tried an even simpler one:

blockly3.png

No luck

Even this one is not working:
blockly4.png
I shouldn't be answering this here, as this thread is meant to post examples, not discuss problems with one that doesn't work for you. So if you could move this discussion into a new thread that would be very welcome.

I don't know what exactly causes the behavior you're seeing, or how to fix it. But I do know that you are creating an endless loop here: For a dimmer everything above 0 is considered "On", so once you switch the badkamer light to anything but "Off", you're having Domoticz set the level to 30%, which is a command to switch the badkamer "On", which triggers your script, which ....

So I don't think this is the way to achieve what you want. Others have tried the same thing before and I don't think I've seen a solution that actually works, other than having two separate devices -one being a switch and the other the dimmer- then only have the switch controlled by the 'user' and have a script trigger control the dimmer based on the switches state. The problem is that once your script gets the trigger for the "On" state change, the light is already on; at whatever percentage the dimmer starts (usually the last brightness it was set to). The dimmer doesn't have separate level and state attirbutes, they both control the same property of the dimmer. This the nature of how z-wave dimmers are implemented. The only way I know to avoid that problem is to have a separate switch and you can set the dimmer to whichever level you like when the switch gets toggled like i described above.
MikeyMan
Posts: 237
Joined: Wednesday 17 October 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by MikeyMan »

It's working!
blockly7.png
blockly7.png (74.03 KiB) Viewed 4611 times
User avatar
Treve
Posts: 107
Joined: Thursday 05 November 2015 10:37
Target OS: Raspberry Pi / ODroid
Domoticz version: v4.11474
Location: Rotterdam, NL
Contact:

Re: Blockly examples

Post by Treve »

MikeyMan wrote:It's working!
blockly7.png
What is the function of the Variable?
- RFXtrx433E,
- AEON Labs ZW090 Z-Stick Gen5 EU
- Hue v2.1
- Raspberry Pi 3 Model B, Raspbian Stretch Full on USB-Stick.
- Domoticz 4.11474
Devices: KaKu, Z-Wave, Hue.

for testing:
Raspberry 4, 2GB, SSD
Domoticz 2022.1
Ikea Hub, Fyrtur curtain
MikeyMan
Posts: 237
Joined: Wednesday 17 October 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by MikeyMan »

Treve wrote: Saturday 11 December 2021 16:18
MikeyMan wrote:It's working!

blockly7.png
What is the function of the Variable?
Making sure it won't continuously trigger.
Allows to use the wall switch to dim.
User avatar
Treve
Posts: 107
Joined: Thursday 05 November 2015 10:37
Target OS: Raspberry Pi / ODroid
Domoticz version: v4.11474
Location: Rotterdam, NL
Contact:

Re: Blockly examples

Post by Treve »

Ok, I didn’t noticed the unequal sign.
- RFXtrx433E,
- AEON Labs ZW090 Z-Stick Gen5 EU
- Hue v2.1
- Raspberry Pi 3 Model B, Raspbian Stretch Full on USB-Stick.
- Domoticz 4.11474
Devices: KaKu, Z-Wave, Hue.

for testing:
Raspberry 4, 2GB, SSD
Domoticz 2022.1
Ikea Hub, Fyrtur curtain
BennY
Posts: 20
Joined: Tuesday 27 February 2018 8:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by BennY »

This is a Blockly i'm using for my lights.
You need two Dummy Switches: "Trigger" and "Delay".
In this case there is one Motion Sensor ("Bewegung"), two Door Contact ("Tür"), one bright light ("Beleuchtung") and one low light "Richtbeleuchtung".

The light ist switching on if a door is open or motion is detected, and stays on until no motion is detected and the delay is over.
It only send a Z-Wave Signal once to switch on the low light, to keep the network traffic low.
Unbenannt.jpg
Unbenannt.jpg (63.07 KiB) Viewed 4533 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest