Blockly examples

Moderator: leecollings

salopette
Posts: 187
Joined: Tuesday 07 March 2017 21:03
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Germany
Contact:

Re: Blockly examples

Post by salopette »

I can do it, how can I convert it to a code like you did above?
tozzke
Posts: 135
Joined: Friday 02 January 2015 9:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Blockly examples

Post 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
salopette
Posts: 187
Joined: Tuesday 07 March 2017 21:03
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Germany
Contact:

Re: Blockly examples

Post by salopette »

This is my Blokly export

https://pastebin.com/bRiJSYLS
Attachments
sshot-2019-05-07-[1].jpg
sshot-2019-05-07-[1].jpg (112.64 KiB) Viewed 5662 times
Mrtn83
Posts: 11
Joined: Friday 25 October 2019 22:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Vlaardingen
Contact:

Re: Blockly examples

Post 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?

Image
salopette
Posts: 187
Joined: Tuesday 07 March 2017 21:03
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Germany
Contact:

Re: Blockly examples

Post by salopette »

Which values does the heater still have? Only on and off, or even temperature?
Mrtn83
Posts: 11
Joined: Friday 25 October 2019 22:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Vlaardingen
Contact:

Re: Blockly examples

Post 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.
salopette
Posts: 187
Joined: Tuesday 07 March 2017 21:03
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Germany
Contact:

Re: Blockly examples

Post 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
mpx2
Posts: 70
Joined: Friday 21 September 2018 18:28
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Contact:

Re: Blockly examples

Post 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.
DaniKojnok
Posts: 3
Joined: Friday 05 April 2019 21:05
Target OS: -
Domoticz version:
Contact:

Re: Blockly examples

Post 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?
Geitje
Posts: 170
Joined: Monday 22 January 2018 21:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post 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?).
Attachments
blocky.png
blocky.png (71.74 KiB) Viewed 3994 times
Domoticz beta, on Raspberry Pi 3B, Raspian Buster
Zwave, Zigate, RFlink etc.
DaniKojnok
Posts: 3
Joined: Friday 05 April 2019 21:05
Target OS: -
Domoticz version:
Contact:

Re: Blockly examples

Post 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.
Devious
Posts: 20
Joined: Sunday 30 December 2018 19:02
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Oss NL
Contact:

Re: Blockly examples

Post by Devious »

is it possible in blockly to trigger on user variables?

if i make a example:
Alarm.png
Alarm.png (41.45 KiB) Viewed 3845 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.
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 »

Devious wrote: Friday 03 January 2020 20:13 is it possible in blockly to trigger on user variables?
Yes
Blockly.png
Blockly.png (17.12 KiB) Viewed 3838 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
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
mosjonathan
Posts: 40
Joined: Friday 24 February 2017 21:20
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Blockly examples

Post 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
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 »

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
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
mosjonathan
Posts: 40
Joined: Friday 24 February 2017 21:20
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Blockly examples

Post 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
Devious
Posts: 20
Joined: Sunday 30 December 2018 19:02
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Oss NL
Contact:

Re: Blockly examples

Post 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)
Franzie
Posts: 30
Joined: Wednesday 09 January 2019 17:10
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Nederland
Contact:

Re: Blockly examples

Post 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
D70D53BD-CFFE-401A-9FE6-B7E8F2038C33.jpeg (85.4 KiB) Viewed 3740 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 :oops:

Can someone help me please.
Geitje
Posts: 170
Joined: Monday 22 January 2018 21:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post 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...
Domoticz beta, on Raspberry Pi 3B, Raspian Buster
Zwave, Zigate, RFlink etc.
Franzie
Posts: 30
Joined: Wednesday 09 January 2019 17:10
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Nederland
Contact:

Re: Blockly examples

Post 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?
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests