Variable for Blockly
Moderator: leecollings
-
Jubbes
- Posts: 33
- Joined: Wednesday 24 October 2018 14:35
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Variable for Blockly
Hello, is it possible to make a Variable that i can use in Blockly?
The variable should say 15 min. before sunset.
In Blockly then:
if time = new variable `sunset-10min` then .......
Jubbes
The variable should say 15 min. before sunset.
In Blockly then:
if time = new variable `sunset-10min` then .......
Jubbes
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Variable for Blockly
You can set the value of a User variables created in Domoticz with dzVents at the time you want (in this case 15 minutes before sunset) or when a certain event occurred. And this can trigger a Blockly like the attached when saved as to be started on UserVariable events
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
Jubbes
- Posts: 33
- Joined: Wednesday 24 October 2018 14:35
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Variable for Blockly
can you show me this script with user value in dzVents???? 15min before sunset. Thank you
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Variable for Blockly
Below how to set (and reset) the value of the domoticz user Variable named "Alarm" of type string.Jubbes wrote: Wednesday 24 October 2018 20:32 can you show me this script with user value in dzVents???? 15min before sunset. Thank you
Code: Select all
-- setvar
return {
on = { timer = { "15 minutes before sunset" }},
logging = { level = domoticz.LOG_DEBUG, -- INFO, DEBUG or ERROR
marker = "setvar" },
execute = function(dz, item)
domoticz.variables("Alarm").set("On") -- set to On
domoticz.variables("Alarm").set("Off").afterSec(60) -- set to Off after 60 seconds
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
Jubbes
- Posts: 33
- Joined: Wednesday 24 October 2018 14:35
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Variable for Blockly
and now what i do in blockly is:
if alarm = on do. set scene......... = on
korrect?
if alarm = on do. set scene......... = on
korrect?
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Variable for Blockly
That is a possibility but why should you do that ? Anything that can be done with Blockly, can be done with dzVents and a whole lot more..Jubbes wrote: Wednesday 24 October 2018 21:24 and now what i do in blockly is:
if alarm = on do. set scene......... = on
korrect?
Look at the video Danny (creator of dzVents) posted and the wiki to get an idea of the possibilities when learning this framework for using Lua with domoticz.
Last edited by waaren on Wednesday 24 October 2018 21:44, edited 1 time in total.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
Jubbes
- Posts: 33
- Joined: Wednesday 24 October 2018 14:35
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Variable for Blockly
i know, but i am a absolute beginner in domoticz, blockly and dzVents.
Thank you very very much for your help !!!!!
The value Alarm can have every name?
Thank you very very much for your help !!!!!
The value Alarm can have every name?
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Variable for Blockly
Yes it can have any name as long as you change it in domoticz, dzVents and Blockly to keep it aligned . Also have a look at my (edited) previous post. Now with links to the wiki and youtube video on dzVents.Jubbes wrote: Wednesday 24 October 2018 21:43 i know, but i am a absolute beginner in domoticz, blockly and dzVents.
Thank you very very much for your help !!!!!
The value Alarm can have every name?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
Jubbes
- Posts: 33
- Joined: Wednesday 24 October 2018 14:35
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Variable for Blockly
The script doesnt run. What must i do in more options / user variables?
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Variable for Blockly
My mistake, sorry. Should be:Jubbes wrote: Thursday 25 October 2018 21:09 The script doesnt run. What must i do in more options / user variables?
Code: Select all
-- setvar
return {
on = { timer = { "15 minutes before sunset" }},
logging = { level = domoticz.LOG_DEBUG, -- INFO, DEBUG or ERROR
marker = "setvar" },
execute = function(domoticz, item)
domoticz.variables("Alarm").set("On") -- set to On
domoticz.variables("Alarm").set("Off").afterSec(60) -- set to Off after 60 seconds
end
}Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Who is online
Users browsing this forum: No registered users and 1 guest