Page 27 of 36
Re: Blockly examples
Posted: Thursday 07 December 2017 19:39
by denman091
He,
i have one virtual switch for my smartphone and one for my wifes smartphone. if one of us is at home (connect with the wifi) the virtual switch turns on.
Now i want a variable that goes to "1" if one of the two virtual switches is on. and when both virtual switches are off (so we are not at home) the variable need to change to "0".
I made a user variable with type: Float and name "Thuis".
i made the following event:
But the variable is not change.
I want to to use the variable state for other events.
Why is this not working?
Re: Blockly examples
Posted: Sunday 10 December 2017 19:51
by Lolo
Termostato virtual con Blockly.
Hola, este es mi termostato virtual con Blockly, la temperatura es tomada con un DHT22 conectado en un ESP8266, el radiador está conectado a un enchufe “Aeon Labs Smart Switch 6”, el termostato es “virtual”, en realidad son dos termostatos virtuales, uno para regular la temperatura mínima, y otro para regular la temperatura máxima.
Es muy sencillo de configurar, con un dedo desde el móvil eliges el rango de temperatura que quieras en cada momento del día, sin complicaciones de scripts en Lua.
Funcionamiento:
Cuando el interruptor Virtual “termostato Desvan” está en “On”, el enchufe "Frigo On/Off" se encenderá y apagara conforme a la temperatura mínima y máxima configuradas en los termostatos virtuales “Termostato Desvan –“ (minimo) y “Termostato Desvan +” (máximo).
Cuando el interruptor Virtual “termostato Desvan” está en “Off”, el enchufe "Frigo On/Off" NO será regulado por los termostatos virtuales “Termostato Desvan –“ (minimo) y “Termostato Desvan +” (máximo).
Translation:
Virtual thermostat with Blockly.
Hello, this is my virtual thermostat with Blockly, the temperature is taken with a DHT22 connected to an ESP8266, the radiator is connected to a socket "Aeon Labs Smart Switch 6", the thermostat is "virtual", they are actually two virtual thermostats , one to regulate the minimum temperature, and another to regulate the maximum temperature.
It is very simple to configure, with a finger from the mobile you choose the temperature range you want at each moment of the day, without complications of Lua scripts.
Functioning:
When the Virtual switch “termostato Desvan” is "On", the "Frigo On/Off" plug will turn on and off according to the minimum and maximum temperature set in the virtual thermostats " Termostato Desvan –" (minimum) and " Termostato Desvan +" (maximum).
When the Virtual Switch " termostato Desvan " is set to "Off", the "Frigo On/Off" plug will NOT be regulated by the virtual thermostats " Termostato Desvan –" (minimum) and " Termostato Desvan +" (maximum).
Re: Blockly examples
Posted: Saturday 16 December 2017 18:28
by Spitfire
denman091 wrote: ↑Thursday 07 December 2017 19:39
He,
i have one virtual switch for my smartphone and one for my wifes smartphone. if one of us is at home (connect with the wifi) the virtual switch turns on.
Now i want a variable that goes to "1" if one of the two virtual switches is on. and when both virtual switches are off (so we are not at home) the variable need to change to "0".
I made a user variable with type: Float and name "Thuis".
i made the following event:
But the variable is not change.
I want to to use the variable state for other events.
Why is this not working?
I think its safe to say that ”Else if” in Blocky does not work as any other implementations of it in ANY language. It’s just a stack of if:s...so...DO NOT USE IT! I would not be suprised if it’s the most asked about issue on this board. So much trouble would have been saved if this was fixed.
Re: Blockly examples
Posted: Wednesday 20 December 2017 1:31
by BullFrog
What is the method to Turn ON/OFF with the same command? For example I want to turn off the lights with Cube shake, and also wanna turn on the lights when they are off with the same command, cube shake. If Do and Else IF does nothing.
Re: Blockly examples
Posted: Thursday 18 January 2018 17:13
by blauwebuis
The new Aurora theme has a blockly
import and export feature. That might be useful for the people in this thread
viewtopic.php?f=8&t=20960
Re: Blockly examples
Posted: Saturday 10 February 2018 16:02
by Xztraz
Made a Blockly section in the Wiki.
www.domoticz.com/wiki/Blockly
Good place to collect experiences with blockly and it's rather own behavior.
Re: Blockly examples
Posted: Sunday 18 February 2018 16:22
by blauwebuis
nice work! Could you explain a bit more how the trigger function works? I still don't quite understand what that does
Re: Blockly examples
Posted: Wednesday 28 February 2018 20:32
by Xztraz
blauwebuis wrote: ↑Sunday 18 February 2018 16:22
Could you explain a bit more how the trigger function works?
Did fill in a bit more. a bit unsure about the ones i haven't tried so much yet.
Re: Blockly examples
Posted: Tuesday 13 March 2018 23:43
by thazand
I've created this blockly to act as an alarm clock / wake up light. It's not a dimmer so it just switches on at a certain time.
I haven't found a way yet to read the time set in the iOS alarm and use that, so I have to set my alarm twice at night. However when I have to wake up multiple days in a row at the same time, there's no issue. I have to set the 'light alarm' separately as a virtual switch now.
I've added al these manual switches to a separate 'Alarm' room in the Home app.
Any suggestions om how to make this better / easier?
Re: Blockly examples
Posted: Monday 26 March 2018 12:58
by CLEMENT99
I made two events to turns on the light when a door is opened and turns off if no motion.
The first event turns on the light and the motion (type Blocky, DEVICE)
- Capture11.JPG (27.24 KiB) Viewed 8836 times
The second event turns off the light if no motion (type Blocky, ALL)
- Capture22.JPG (13.28 KiB) Viewed 8835 times
The problem is when the door stays open, the light does not turn off
I thought that a blocky device event only changed when a state change occurred.
Here, many times the door stays open and unfortunately also the lights.
Re: Blockly examples
Posted: Friday 30 March 2018 10:52
by CLEMENT99
CLEMENT99 wrote: ↑Monday 26 March 2018 12:58
I made two events to turns on the light when a door is opened and turns off if no motion.
The first event turns on the light and the motion (type Blocky, DEVICE)
Capture11.JPG
The second event turns off the light if no motion (type Blocky, ALL)
Capture22.JPG
The problem is when the door stays open, the light does not turn off
I thought that a blocky device event only changed when a state change occurred.
Here, many times the door stays open and unfortunately also the lights.
Well, the problem seems to be that the second blocky with the "xiaomi human sensor"=OFF does not work.
I tried with "xiaomi human sensor" NOT EQUAL motion but it's also not working.
Re: Blockly examples
Posted: Monday 02 April 2018 10:54
by Ragdag
I'm pretty new to Domoticz and trying to accomplish something that should be fairly simple in my mind with Blocky but for the life of me I can't figure it out.
The idea is that at sunset I want to enable some lights for a duration of 4 hours but I want to randomly start them within 20 minutes. It seems that the combination of limited time and random start are not possible.
Re: Blockly examples
Posted: Friday 06 April 2018 17:54
by tozzke
Ragdag wrote: ↑Monday 02 April 2018 10:54
I'm pretty new to Domoticz and trying to accomplish something that should be fairly simple in my mind with Blocky but for the life of me I can't figure it out.
The idea is that at sunset I want to enable some lights for a duration of 4 hours but I want to randomly start them within 20 minutes. It seems that the combination of limited time and random start are not possible.
This is perfectly doable but perhaps a bit tricky. First of all, make it a time blockly and add a variable (integer with valua 0) for each light you'd like to control.
With 2 lights it becomes something like this:
I think this'll do pretty much what you describe
Re: Blockly examples
Posted: Saturday 07 April 2018 10:43
by Ragdag
tozzke wrote: ↑Friday 06 April 2018 17:54
Ragdag wrote: ↑Monday 02 April 2018 10:54
I'm pretty new to Domoticz and trying to accomplish something that should be fairly simple in my mind with Blocky but for the life of me I can't figure it out.
The idea is that at sunset I want to enable some lights for a duration of 4 hours but I want to randomly start them within 20 minutes. It seems that the combination of limited time and random start are not possible.
This is perfectly doable but perhaps a bit tricky. First of all, make it a time blockly and add a variable (integer with valua 0) for each light you'd like to control.
With 2 lights it becomes something like this:
I think this'll do pretty much what you describe
Wow, thank you.
I think I understand what you're doing. You use the variable to work around the limitation of Domoticz to allow an extra evaluation.
Re: Blockly examples
Posted: Saturday 07 April 2018 11:15
by tozzke
I'm using the variables to switch instantly and prevent retriggering. If I won't be using the variables but the switch itself like 'if [Time = [Sunset]] and [TEST lamp 1] = [Off]', it would be triggering every minute because the light is still off the next minute and perhaps the next 19 minutes.
Re: Blockly examples
Posted: Friday 04 May 2018 22:32
by arek156
Hello
Recently, I've been interested in domoticz, but there is a problem that I can not deal with. I count on the help of forum users. I built a script that verifies the garage door. If after 21:00 the system checks that it is open, it sends a pushover notification. Everything is ok but notifications are given every minute. Is it possible to set that open gate notifications appear every 15 minutes or every 30 minutes.
Re: Blockly examples
Posted: Saturday 05 May 2018 0:05
by tozzke
that is possible using blockly by adding a variable so that you'll get something like:
If [Brama Anita] = [Open] and [Time > [21:00]] and [variable] = [0]
Do [Set [variable] = [1]]
[Send notification...]
[Set [variable] = [0] After [900] seconds]
Re: Blockly examples
Posted: Saturday 05 May 2018 9:30
by arek156
@tozzke
thank you very much for your help, in fact after adding the variables everything works perfectly.
Re: Blockly examples
Posted: Wednesday 09 May 2018 17:36
by SilentScreamer
I do not understand why my script does not work, i guess something goes wrong with the nested or function.
What I want is: If one of the four devices pings, and it is sunset (now i specified a specific time for testing), I want to turn on the four lights.
Does someone understand what is happening?
Thanks in advance!
Re: Blockly examples
Posted: Wednesday 09 May 2018 17:39
by tozzke
SilentScreamer wrote: ↑Wednesday 09 May 2018 17:36
I do not understand why my script does not work, i guess something goes wrong with the nested or function.
What I want is: If one of the four devices pings, and it is sunset (now i specified a specific time for testing), I want to turn on the four lights.
Does someone understand what is happening?
Thanks in advance!
You'll have to change it to:
If [Time] = [17:10] and [ [Jip Z5] = [On] or [Lenovo Jip] = [On] or [Z1 Sally] = [On] or [Lenovo Sally] = [On] ]