Page 33 of 36
Re: Blockly examples
Posted: Tuesday 07 May 2019 5:17
by salopette
I can do it, how can I convert it to a code like you did above?
Re: Blockly examples
Posted: Tuesday 07 May 2019 6:05
by tozzke
salopette wrote: ↑Tuesday 07 May 2019 5:17
I can do it, how can I convert it to a code like you did above?
don't, just make a screenshot. I made the blockly "in code" because I don't have your devices
Re: Blockly examples
Posted: Tuesday 07 May 2019 15:50
by salopette
Re: Blockly examples
Posted: Friday 25 October 2019 22:49
by Mrtn83
I am just getting started using blockly and i need some help.
I want to turn-off the heater when the door is open for longer than 30 seconds.
If the door is closed I would like the heater to return to the state that it was in before opening the door.
There is an option On / Off but no resume. What can I do?

Re: Blockly examples
Posted: Saturday 26 October 2019 8:00
by salopette
Which values does the heater still have? Only on and off, or even temperature?
Re: Blockly examples
Posted: Saturday 26 October 2019 15:05
by Mrtn83
Only on or off, maybe a temperature. I would like to use the automation year round. During the summer the heater is off and shoud stay off.
But during the winter the heater should resume what it is doing.
Re: Blockly examples
Posted: Saturday 26 October 2019 19:03
by salopette
You can try to create a Virtual Thermostat.
There you can enter the IDX for schlater and temperature.
https://www.domoticz.com/wiki/Plugins/S ... ostat.html
Re: Blockly examples
Posted: Sunday 24 November 2019 17:06
by mpx2
How to use Push off button in Blocky.
I have two on/off buttons which work. I have a remote with All Off button. This off button is "Type: Light/Switch, AC, Push Off Button" in Domoticz. If I press All Off on remote or Push Off button in Domoticz swhitches turn off but the state in Domoticz is still on.
How Can I use that Push Off button to whitch off also the switches in Domoticz? I have tries if that Push off Button is off, on, 1 and 0 but nothing happens.
Re: Blockly examples
Posted: Monday 09 December 2019 19:55
by DaniKojnok
Hi, I am trying to resolve a task with blockly: If a PIR is off FOR some time do action. Is it just me finding this impossible to solve?
Re: Blockly examples
Posted: Monday 09 December 2019 23:12
by Geitje
I use this plugin for that purpose:
https://www.domoticz.com/forum/viewtopic.php?t=23813
Countdown is triggered by my PIR sensor. If countdown is still counting, and PIR is going on, countdown is starting over again (I think this is different from using a switch with delay?).
Re: Blockly examples
Posted: Sunday 15 December 2019 18:34
by DaniKojnok
Geitje wrote: ↑Monday 09 December 2019 23:12
I use this plugin for that purpose:
https://www.domoticz.com/forum/viewtopic.php?t=23813
Countdown is triggered by my PIR sensor. If countdown is still counting, and PIR is going on, countdown is starting over again (I think this is different from using a switch with delay?).
Thank you, seems to be addressing the task, not an easy to resolve in blockly otherwise.
Re: Blockly examples
Posted: Friday 03 January 2020 20:13
by Devious
is it possible in blockly to trigger on user variables?
if i make a example:

- Alarm.png (41.45 KiB) Viewed 4479 times
The Alarm variable changes to 1.
But the alarm switch stays off, and the variable doesn't change back to 0.
even if i split up the 2 parts en set the trigger of the second part to "User variable"
The second part doesn't seem to be triggered.
Re: Blockly examples
Posted: Saturday 04 January 2020 1:57
by waaren
Devious wrote: ↑Friday 03 January 2020 20:13
is it possible in blockly to trigger on user variables?
Yes

- Blockly.png (17.12 KiB) Viewed 4472 times
Loglines
Code: Select all
2020-01-04 01:55:46.157 EventSystem: Event triggered: Blockly uservariable_1
2020-01-04 01:55:46.157 Status: Variable triggered
Re: Blockly examples
Posted: Saturday 04 January 2020 8:33
by mosjonathan
That does not work.
Blokly and lua and dzVents wil not trigger in a variable that is changed via scripts of blockly.
They will only trigger if the variable is changed via the web interface of via json.
That is to prevent loops
Re: Blockly examples
Posted: Saturday 04 January 2020 10:17
by waaren
mosjonathan wrote: ↑Saturday 04 January 2020 8:33
That does not work.
Blockly and lua and dzVents wil not trigger in a variable that is changed via scripts of blockly.
Sorry but your information is not correct for dzVents.
This dzVents script changes the content of a variable and is triggered by that change.
Code: Select all
return {
on = {
variables = {
'my(integer)UserVariable'
}
},
execute = function(dz, item)
dz.log('Variable ' .. item.name .. ' is now: ' .. item.value)
item.set(item.value + 1).afterSec(10)
end
}
The resulting log
- Spoiler: show
Code: Select all
2020-01-04 10:10:23.374 Status: dzVents: Info: Handling variable-events for: "my(integer)UserVariable", value: "1"
2020-01-04 10:10:23.374 Status: dzVents: Info: ------ Start internal script: dz uservariable: Variable: "my(integer)UserVariable" Index: 16
2020-01-04 10:10:23.375 Status: dzVents: Info: Variable my(integer)UserVariable is now: 1
2020-01-04 10:10:23.375 Status: dzVents: Info: ------ Finished dz uservariable
2020-01-04 10:10:33.398 Status: Set UserVariable my(integer)UserVariable = 2
2020-01-04 10:10:33.516 Status: dzVents: Info: Handling variable-events for: "my(integer)UserVariable", value: "2"
2020-01-04 10:10:33.517 Status: dzVents: Info: ------ Start internal script: dz uservariable: Variable: "my(integer)UserVariable" Index: 16
2020-01-04 10:10:33.518 Status: dzVents: Info: Variable my(integer)UserVariable is now: 2
2020-01-04 10:10:33.519 Status: dzVents: Info: ------ Finished dz uservariable
2020-01-04 10:10:43.539 Status: Set UserVariable my(integer)UserVariable = 3
2020-01-04 10:10:43.593 Status: dzVents: Info: Handling variable-events for: "my(integer)UserVariable", value: "3"
2020-01-04 10:10:43.593 Status: dzVents: Info: ------ Start internal script: dz uservariable: Variable: "my(integer)UserVariable" Index: 16
2020-01-04 10:10:43.593 Status: dzVents: Info: Variable my(integer)UserVariable is now: 3
2020-01-04 10:10:43.594 Status: dzVents: Info: ------ Finished dz uservariable
2020-01-04 10:10:43.594 Status: EventSystem: Script event triggered: /opt/domoticz/dzVents/runtime/dzVents.lua
2020-01-04 10:10:53.599 Status: Set UserVariable my(integer)UserVariable = 4
2020-01-04 10:10:53.652 Status: dzVents: Info: Handling variable-events for: "my(integer)UserVariable", value: "4"
2020-01-04 10:10:53.652 Status: dzVents: Info: ------ Start internal script: dz uservariable: Variable: "my(integer)UserVariable" Index: 16
2020-01-04 10:10:53.652 Status: dzVents: Info: Variable my(integer)UserVariable is now: 4
2020-01-04 10:10:53.653 Status: dzVents: Info: ------ Finished dz uservariable
2020-01-04 10:11:03.659 Status: Set UserVariable my(integer)UserVariable = 5
2020-01-04 10:11:03.757 Status: dzVents: Info: Handling variable-events for: "my(integer)UserVariable", value: "5"
2020-01-04 10:11:03.757 Status: dzVents: Info: ------ Start internal script: dz uservariable: Variable: "my(integer)UserVariable" Index: 16
2020-01-04 10:11:03.758 Status: dzVents: Info: Variable my(integer)UserVariable is now: 5
2020-01-04 10:11:03.760 Status: dzVents: Info: ------ Finished dz uservariable
2020-01-04 10:11:03.761 Status: EventSystem: Script event triggered: /opt/domoticz/dzVents/runtime/dzVents.lua
2020-01-04 10:11:13.800 Status: Set UserVariable my(integer)UserVariable = 6
2020-01-04 10:11:13.853 Status: dzVents: Info: Handling variable-events for: "my(integer)UserVariable", value: "6"
2020-01-04 10:11:13.853 Status: dzVents: Info: ------ Start internal script: dz uservariable: Variable: "my(integer)UserVariable" Index: 16
2020-01-04 10:11:13.854 Status: dzVents: Info: Variable my(integer)UserVariable is now: 6
2020-01-04 10:11:13.854 Status: dzVents: Info: ------ Finished dz uservariable
..etc
Re: Blockly examples
Posted: Saturday 04 January 2020 11:38
by mosjonathan
Hi waaren i did not know that dzVents triggered on user variabels changed in scripts.
Is that changed somewhere along the line?
Now i can make Some scripts simpler
Thanks for the correction
Re: Blockly examples
Posted: Saturday 04 January 2020 18:46
by Devious
so not possible in Blockly, but possible in dzVents.
other option in Blockly is using virtual switches instead of user variables. (functional but not clean)
Re: Blockly examples
Posted: Wednesday 15 January 2020 12:54
by Franzie
Hi there, need some help with Blockly.
I made a script that when Me and my wife (phones) leave the building all the switches must turn off.
That works fine, thanks to iDetect.

- D70D53BD-CFFE-401A-9FE6-B7E8F2038C33.jpeg (85.4 KiB) Viewed 4374 times
But. Every evening my UniFi Switch "does not see" my phones for 2 or 3 seconds once or twice an evening and then it gets dark.
I tried to change the script so that there is a timer countdown 10 seconds and then check again if the phones are off but I don't know anymore how to make a timer which is counting off
Can someone help me please.
Re: Blockly examples
Posted: Wednesday 15 January 2020 20:19
by Geitje
I think you need to change some settings in your iDetect plugin. Make the grace period longer and/or more polls in the grace period. It will prevent false negatives...
Re: Blockly examples
Posted: Thursday 16 January 2020 16:19
by Franzie
Geitje wrote: ↑Wednesday 15 January 2020 20:19
I think you need to change some settings in your iDetect plugin. Make the grace period longer and/or more polls in the grace period. It will prevent false negatives...
Thank you Geitje
My grace/poll period is now 30/15; you mean to increase to 60/15 or even 60/30?