Blockly examples
Moderator: leecollings
-
- Posts: 2
- Joined: Wednesday 09 May 2018 17:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
Thanks, that worked very well, thanks for the unreal fast response!
-
- Posts: 8
- Joined: Wednesday 20 June 2018 22:22
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
I cannot figure out why my blockly isnt working, i hope you guys can give me some advice..
i want to close my suncreen (zonnescherm) when it's in state of Open and when its 22:00 (in case i am not home and i forget to close the screen by myself.)
when it closes i want it to send out an message to Kodi and an e-mail and mentioned in the log.
what is wrong here?
i want to close my suncreen (zonnescherm) when it's in state of Open and when its 22:00 (in case i am not home and i forget to close the screen by myself.)
when it closes i want it to send out an message to Kodi and an e-mail and mentioned in the log.
what is wrong here?
- StanHD
- Posts: 347
- Joined: Friday 12 July 2013 16:09
- Target OS: Windows
- Domoticz version:
- Location: East Sussex, UK
- Contact:
Re: Blockly examples
Try formating like this:-shamie wrote:I cannot figure out why my blockly isnt working, i hope you guys can give me some advice..
i want to close my suncreen (zonnescherm) when it's in state of Open and when its 22:00 (in case i am not home and i forget to close the screen by myself.)
when it closes i want it to send out an message to Kodi and an e-mail and mentioned in the log.
what is wrong here?
If [Switch = State] and [Time = ??:??]
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
-
- Posts: 46
- Joined: Friday 12 February 2016 20:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.4834
- Contact:
Re: Blockly examples
Try this
Cobra045
Cobra045
-
- Posts: 8
- Joined: Wednesday 20 June 2018 22:22
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
StanHD wrote: ↑Wednesday 20 June 2018 22:48Try formating like this:-shamie wrote:I cannot figure out why my blockly isnt working, i hope you guys can give me some advice..
i want to close my suncreen (zonnescherm) when it's in state of Open and when its 22:00 (in case i am not home and i forget to close the screen by myself.)
when it closes i want it to send out an message to Kodi and an e-mail and mentioned in the log.
what is wrong here?
If [Switch = State] and [Time = ??:??]
Thank you both, that helped me out a lot, its a logical thing after all
it didn't work for the first time, the sunscreen didnt go up, but i did get a mail, sow the part before "Do" worked.
after some testing i decided to use the group where the sunscreen belongs to.
so now i have this working:
i don't understand why the suncreen goes to "close" but turning the group to "off" works
-
- Posts: 135
- Joined: Friday 02 January 2015 9:22
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: Netherlands
- Contact:
Re: Blockly examples
You'll probably have to use 'Open'/'Closed' in the If statement and 'On'/'Off' in the Do section
-
- Posts: 111
- Joined: Thursday 08 December 2016 9:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
Hi,
Working on similar script, to have my screens closed when it is after 07:30 and before 18:00.
Script checks if screen is open, then time check followed by actual status of light sensor. when bigger then 1100lux screen to close.
This is what I made of it:
It works for the part that the screen needs to close.
I also have a script that opens the screen at 19:00 hours.
When screens are closed the script opens them. Problem is that the script to close the screens then closes them and I get looped in open /close.
It appears that the time statement is not working in the screens_neer script.
Below what I made to open the screens
Any ideas what I am overlooking or not understanding correctly?
Help much appreciated.
Bernard
Working on similar script, to have my screens closed when it is after 07:30 and before 18:00.
Script checks if screen is open, then time check followed by actual status of light sensor. when bigger then 1100lux screen to close.
This is what I made of it:
It works for the part that the screen needs to close.
I also have a script that opens the screen at 19:00 hours.
When screens are closed the script opens them. Problem is that the script to close the screens then closes them and I get looped in open /close.
It appears that the time statement is not working in the screens_neer script.
Below what I made to open the screens
Any ideas what I am overlooking or not understanding correctly?
Help much appreciated.
Bernard
-
- Posts: 111
- Joined: Thursday 08 December 2016 9:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
Looking at it I believe I have worked it out.
In the time statement it sould be AND instead of OR.
Will change and see if it works tomorrow.
Bernard
In the time statement it sould be AND instead of OR.
Will change and see if it works tomorrow.
Bernard
-
- Posts: 111
- Joined: Thursday 08 December 2016 9:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
That did the trick
- EdddieN
- Posts: 510
- Joined: Wednesday 16 November 2016 11:31
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9700
- Location: Scotland
- Contact:
Re: Blockly examples
Has anyone got read power working?
I'm trying to do this: I have a wall tablet with an inline aeon smart relay. When the tablet is charging, it usually charges over 10 Watts. I want to disconnect the power of the power supply after 1h when its power consumption drops below 10 Watts (about getting fully charged).
I have this tablet always on and charging, and I'm having problems with it I think due to overheating (always powered to the power supply).
The first part of it: if power < 10 does not seem to work in blockly for me, is there a way to get the power reading?
I'm trying to do this: I have a wall tablet with an inline aeon smart relay. When the tablet is charging, it usually charges over 10 Watts. I want to disconnect the power of the power supply after 1h when its power consumption drops below 10 Watts (about getting fully charged).
I have this tablet always on and charging, and I'm having problems with it I think due to overheating (always powered to the power supply).
The first part of it: if power < 10 does not seem to work in blockly for me, is there a way to get the power reading?
11101101 - www.machinon.com
-
- Posts: 28
- Joined: Thursday 02 March 2017 11:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
I'm trying blocky to have domoticz send me a notification when the outside temperature gets below the temperature inside the house, so I have to start opening doors and windows. I'm using blocky as I have no idea how to program in Lua. However, I can't get it to work properly.
I have setup a virtual switch (Woonkamer_Temp) that is set to ON when outside_temp < livingroom_temp AND time is between 18.00-2330 hrs
In the virtual switch (Woonkamer_Temp) I have setup a notification when it switches to ON
The switching part works like a charm, however I keep getting notification every minute or so. I can see in the log that the 'Woonkamer_Temp' switch is polled all the time, hence sending a new notification every time. How can I prevent domoticz from doing that? I just want to have a notification one time. Can't get it to work in blocky.
Version 1 Version 2
I have setup a virtual switch (Woonkamer_Temp) that is set to ON when outside_temp < livingroom_temp AND time is between 18.00-2330 hrs
In the virtual switch (Woonkamer_Temp) I have setup a notification when it switches to ON
The switching part works like a charm, however I keep getting notification every minute or so. I can see in the log that the 'Woonkamer_Temp' switch is polled all the time, hence sending a new notification every time. How can I prevent domoticz from doing that? I just want to have a notification one time. Can't get it to work in blocky.
Version 1 Version 2
- Attachments
-
- Blocky3.JPG (47.2 KiB) Viewed 3694 times
-
- Blocky2.JPG (38.46 KiB) Viewed 3694 times
Last edited by henk99 on Thursday 02 August 2018 16:50, edited 4 times in total.
- EdddieN
- Posts: 510
- Joined: Wednesday 16 November 2016 11:31
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9700
- Location: Scotland
- Contact:
Re: Blockly examples
Make sure you select the right trigger event (device, time, etc...) on your blockly diagram
11101101 - www.machinon.com
-
- Posts: 28
- Joined: Thursday 02 March 2017 11:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
I'm sorry, can you elaborate? I'm fairly new to this. What I would like doesn't seem too difficult in my mind, but the blockys I made don't work. They keep repeating. I just want domoticz to send me one notification...it sounds so simple, and in Lua it is perhaps, but I can't figure out programming like that, i'm sorry. So, I'm either hoping for someone to show me what is wrong in my blocky or someone that can show me a lua script for me to figure out.
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Blockly examples
Your blockly does switch your notification triggerdevice every time the temperature condition evaluates to true.henk99 wrote: ↑Thursday 02 August 2018 16:26 I'm trying blocky to have domoticz send me a notification when the outside temperature gets below the temperature inside the house, so I have to start opening doors and windows. I'm using blocky as I have no idea how to program in Lua. However, I can't get it to work properly.
I have setup a virtual switch (Woonkamer_Temp) that is set to ON when outside_temp < livingroom_temp AND time is between 18.00-2330 hrs
In the virtual switch (Woonkamer_Temp) I have setup a notification when it switches to ON
The switching part works like a charm, however I keep getting notification every minute or so. I can see in the log that the 'Woonkamer_Temp' switch is polled all the time, hence sending a new notification every time. How can I prevent domoticz from doing that? I just want to have a notification one time. Can't get it to work in blocky.
Using the checkFirst option in dzVents you can prevent that . This small dzVents script should do the job.
Code: Select all
-- activateNotificationSwitch.lua
return {
on = { timer = {"every minute between 16:00 and 23:30 on 15/4-15/9"}}, -- during spring and summer
execute = function(domoticz)
if domoticz.time.matchesRule("at 16:00-23:28") then
if domoticz.devices("Buiten temperatuur").temperature <= domoticz.devices("Woonkamer").temperature then
domoticz.devices("Woonkamer_Temp").switchOn().checkFirst()
end
else
domoticz.devices("Woonkamer_Temp").switchOff().checkFirst()
end
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
- EdddieN
- Posts: 510
- Joined: Wednesday 16 November 2016 11:31
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9700
- Location: Scotland
- Contact:
Re: Blockly examples
No worries! Here, under blockly you have many options there how to trigger the eventhenk99 wrote: ↑Thursday 02 August 2018 17:11I'm sorry, can you elaborate? I'm fairly new to this. What I would like doesn't seem too difficult in my mind, but the blockys I made don't work. They keep repeating. I just want domoticz to send me one notification...it sounds so simple, and in Lua it is perhaps, but I can't figure out programming like that, i'm sorry. So, I'm either hoping for someone to show me what is wrong in my blocky or someone that can show me a lua script for me to figure out.
11101101 - www.machinon.com
-
- Posts: 28
- Joined: Thursday 02 March 2017 11:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
Hi Waaren. thank you so much! I have implemented it in my domoticz and it worked like a charm. Very happy with this!waaren wrote: ↑Thursday 02 August 2018 18:08 Your blockly does switch your notification triggerdevice every time the temperature condition evaluates to true.
Using the checkFirst option in dzVents you can prevent that . This small dzVents script should do the job.Code: Select all
-- activateNotificationSwitch.lua return { on = { timer = {"every minute between 16:00 and 23:30 on 15/4-15/9"}}, -- during spring and summer execute = function(domoticz) if domoticz.time.matchesRule("at 16:00-23:28") then if domoticz.devices("Buiten temperatuur").temperature <= domoticz.devices("Woonkamer").temperature then domoticz.devices("Woonkamer_Temp").switchOn().checkFirst() end else domoticz.devices("Woonkamer_Temp").switchOff().checkFirst() end end }
-
- Posts: 5
- Joined: Wednesday 13 January 2016 15:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Netherlands
- Contact:
Re: Blockly examples
Is the last piece of the code not. The else is for the temperature check,henk99 wrote: ↑Friday 03 August 2018 11:21 Your blockly does switch your notification triggerdevice every time the temperature condition evaluates to true.
Using the checkFirst option in dzVents you can prevent that . This small dzVents script should do the job.Code: Select all
-- activateNotificationSwitch.lua return { on = { timer = {"every minute between 16:00 and 23:30 on 15/4-15/9"}}, -- during spring and summer execute = function(domoticz) if domoticz.time.matchesRule("at 16:00-23:28") then if domoticz.devices("Buiten temperatuur").temperature <= domoticz.devices("Woonkamer").temperature then domoticz.devices("Woonkamer_Temp").switchOn().checkFirst() end else domoticz.devices("Woonkamer_Temp").switchOff().checkFirst() end end }
Code: Select all
if domoticz.devices("Buiten temperatuur").temperature <= domoticz.devices("Woonkamer").temperature then
domoticz.devices("Woonkamer_Temp").switchOn().checkFirst()
else
domoticz.devices("Woonkamer_Temp").switchOff().checkFirst()
end
end
end
-
- Posts: 28
- Joined: Thursday 02 March 2017 11:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Blockly examples
One question/request on this. As this script is setting a virtual switch, I found out it remains switched on until I switch it off manually. I didn't know this, which results in the script thinking that it has already sent me the message. Is there a way that this script switches off the switch at midnight so it's off again the next day?waaren wrote: ↑Thursday 02 August 2018 18:08Your blockly does switch your notification triggerdevice every time the temperature condition evaluates to true.henk99 wrote: ↑Thursday 02 August 2018 16:26 I'm trying blocky to have domoticz send me a notification when the outside temperature gets below the temperature inside the house, so I have to start opening doors and windows. I'm using blocky as I have no idea how to program in Lua. However, I can't get it to work properly.
I have setup a virtual switch (Woonkamer_Temp) that is set to ON when outside_temp < livingroom_temp AND time is between 18.00-2330 hrs
In the virtual switch (Woonkamer_Temp) I have setup a notification when it switches to ON
The switching part works like a charm, however I keep getting notification every minute or so. I can see in the log that the 'Woonkamer_Temp' switch is polled all the time, hence sending a new notification every time. How can I prevent domoticz from doing that? I just want to have a notification one time. Can't get it to work in blocky.
Using the checkFirst option in dzVents you can prevent that . This small dzVents script should do the job.Code: Select all
-- activateNotificationSwitch.lua return { on = { timer = {"every minute between 16:00 and 23:30 on 15/4-15/9"}}, -- during spring and summer execute = function(domoticz) if domoticz.time.matchesRule("at 16:00-23:28") then if domoticz.devices("Buiten temperatuur").temperature <= domoticz.devices("Woonkamer").temperature then domoticz.devices("Woonkamer_Temp").switchOn().checkFirst() end else domoticz.devices("Woonkamer_Temp").switchOff().checkFirst() end end }
-
- Posts: 5
- Joined: Wednesday 13 January 2016 15:58
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Netherlands
- Contact:
Re: Blockly examples
Place the end before the else statement behind the statement. Then the problem is solved.henk99 wrote: ↑Monday 06 August 2018 13:26One question/request on this. As this script is setting a virtual switch, I found out it remains switched on until I switch it off manually. I didn't know this, which results in the script thinking that it has already sent me the message. Is there a way that this script switches off the switch at midnight so it's off again the next day?waaren wrote: ↑Thursday 02 August 2018 18:08Your blockly does switch your notification triggerdevice every time the temperature condition evaluates to true.henk99 wrote: ↑Thursday 02 August 2018 16:26 I'm trying blocky to have domoticz send me a notification when the outside temperature gets below the temperature inside the house, so I have to start opening doors and windows. I'm using blocky as I have no idea how to program in Lua. However, I can't get it to work properly.
I have setup a virtual switch (Woonkamer_Temp) that is set to ON when outside_temp < livingroom_temp AND time is between 18.00-2330 hrs
In the virtual switch (Woonkamer_Temp) I have setup a notification when it switches to ON
The switching part works like a charm, however I keep getting notification every minute or so. I can see in the log that the 'Woonkamer_Temp' switch is polled all the time, hence sending a new notification every time. How can I prevent domoticz from doing that? I just want to have a notification one time. Can't get it to work in blocky.
Using the checkFirst option in dzVents you can prevent that . This small dzVents script should do the job.Code: Select all
-- activateNotificationSwitch.lua return { on = { timer = {"every minute between 16:00 and 23:30 on 15/4-15/9"}}, -- during spring and summer execute = function(domoticz) if domoticz.time.matchesRule("at 16:00-23:28") then if domoticz.devices("Buiten temperatuur").temperature <= domoticz.devices("Woonkamer").temperature then domoticz.devices("Woonkamer_Temp").switchOn().checkFirst() end else domoticz.devices("Woonkamer_Temp").switchOff().checkFirst() end end }
Code: Select all
-- activateNotificationSwitch.lua
return {
on = { timer = {"every minute between 16:00 and 23:30 on 15/4-15/9"}}, -- during spring and summer
execute = function(domoticz)
if domoticz.time.matchesRule("at 16:00-23:28") then
if domoticz.devices("Buiten temperatuur").temperature <= domoticz.devices("Woonkamer").temperature then
domoticz.devices("Woonkamer_Temp").switchOn().checkFirst()
else
domoticz.devices("Woonkamer_Temp").switchOff().checkFirst()
end
end
end
}
Who is online
Users browsing this forum: No registered users and 1 guest