Blockly examples

SilentScreamer
Posts: 3
Joined: Wednesday 09 May 2018 17:33
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by SilentScreamer » Wednesday 09 May 2018 17:41

Thanks, that worked very well, thanks for the unreal fast response!

shamie
Posts: 5
Joined: Wednesday 20 June 2018 22:22
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by shamie » Wednesday 20 June 2018 22:29

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.

Image

what is wrong here?

User avatar
StanHD
Posts: 588
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Blockly examples

Post by StanHD » Wednesday 20 June 2018 22:48

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.

Image

what is wrong here?
Try formating like this:-

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
Domoticz Slave - Asrock Ion - Linux, Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa

cobra045
Posts: 36
Joined: Friday 12 February 2016 21:58
Target OS: Raspberry Pi
Domoticz version: 3.4834
Contact:

Re: Blockly examples

Post by cobra045 » Thursday 21 June 2018 10:35

Try this
2018-06-21_10h28_03.png
2018-06-21_10h28_03.png (15.42 KiB) Viewed 2084 times

Cobra045

shamie
Posts: 5
Joined: Wednesday 20 June 2018 22:22
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by shamie » Thursday 21 June 2018 18:36

StanHD wrote:
Wednesday 20 June 2018 22:48
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.

Image

what is wrong here?
Try formating like this:-

If [Switch = State] and [Time = ??:??]
cobra045 wrote:
Thursday 21 June 2018 10:35
Try this

2018-06-21_10h28_03.png


Cobra045

Thank you both, that helped me out a lot, its a logical thing after all 8-)
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:
Image

i don't understand why the suncreen goes to "close" but turning the group to "off" works :D

tozzke
Posts: 134
Joined: Friday 02 January 2015 10:22
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Blockly examples

Post by tozzke » Friday 22 June 2018 17:49

You'll probably have to use 'Open'/'Closed' in the If statement and 'On'/'Off' in the Do section

shamie
Posts: 5
Joined: Wednesday 20 June 2018 22:22
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by shamie » Saturday 23 June 2018 18:52

tozzke wrote:
Friday 22 June 2018 17:49
You'll probably have to use 'Open'/'Closed' in the If statement and 'On'/'Off' in the Do section
yeah maybe i will give that a shot as well.

Benneton
Posts: 30
Joined: Thursday 08 December 2016 10:46
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by Benneton » Wednesday 04 July 2018 19:25

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:

Image

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
Image

Any ideas what I am overlooking or not understanding correctly?
Help much appreciated.

Bernard

Benneton
Posts: 30
Joined: Thursday 08 December 2016 10:46
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by Benneton » Wednesday 04 July 2018 19:27

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

Benneton
Posts: 30
Joined: Thursday 08 December 2016 10:46
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by Benneton » Thursday 05 July 2018 19:38

That did the trick :)

User avatar
EdddieN
Posts: 535
Joined: Wednesday 16 November 2016 12:31
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Scotland
Contact:

Re: Blockly examples

Post by EdddieN » Tuesday 31 July 2018 22:49

Has anyone got read power working?
I'm trying to do this:
Screen Shot 2018-07-31 at 21.46.03.png
Screen Shot 2018-07-31 at 21.46.03.png (29.71 KiB) Viewed 1271 times
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

henk99
Posts: 22
Joined: Thursday 02 March 2017 12:36
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by henk99 » 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.

Version 1
B.JPG
B.JPG (57.73 KiB) Viewed 1171 times
Version 2
Attachments
Blocky3.JPG
Blocky3.JPG (47.2 KiB) Viewed 1170 times
Blocky2.JPG
Blocky2.JPG (38.46 KiB) Viewed 1170 times
Last edited by henk99 on Thursday 02 August 2018 16:50, edited 4 times in total.

User avatar
EdddieN
Posts: 535
Joined: Wednesday 16 November 2016 12:31
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Scotland
Contact:

Re: Blockly examples

Post by EdddieN » Thursday 02 August 2018 16:30

Make sure you select the right trigger event (device, time, etc...) on your blockly diagram
11101101 - www.machinon.com

henk99
Posts: 22
Joined: Thursday 02 March 2017 12:36
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by henk99 » Thursday 02 August 2018 17:11

EdddieN wrote:
Thursday 02 August 2018 16:30
Make sure you select the right trigger event (device, time, etc...) on your blockly diagram
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.

User avatar
waaren
Posts: 1079
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Blockly examples

Post by waaren » Thursday 02 August 2018 18:08

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.
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
}
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

User avatar
EdddieN
Posts: 535
Joined: Wednesday 16 November 2016 12:31
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Scotland
Contact:

Re: Blockly examples

Post by EdddieN » Thursday 02 August 2018 21:41

henk99 wrote:
Thursday 02 August 2018 17:11
EdddieN wrote:
Thursday 02 August 2018 16:30
Make sure you select the right trigger event (device, time, etc...) on your blockly diagram
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.
No worries! Here, under blockly you have many options there how to trigger the event
Screen Shot 2018-08-02 at 20.41.09.png
Screen Shot 2018-08-02 at 20.41.09.png (53.65 KiB) Viewed 1145 times
11101101 - www.machinon.com

henk99
Posts: 22
Joined: Thursday 02 March 2017 12:36
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by henk99 » Friday 03 August 2018 11:21

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
}
Hi Waaren. thank you so much! I have implemented it in my domoticz and it worked like a charm. Very happy with this!

Hoekies
Posts: 5
Joined: Wednesday 13 January 2016 16:58
Target OS: Raspberry Pi
Domoticz version:
Location: Netherlands
Contact:

Re: Blockly examples

Post by Hoekies » Monday 06 August 2018 9:50

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
}
Is the last piece of the code not. The else is for the temperature check,

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

henk99
Posts: 22
Joined: Thursday 02 March 2017 12:36
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Post by henk99 » Monday 06 August 2018 13:26

waaren wrote:
Thursday 02 August 2018 18:08
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.
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
}
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?

Hoekies
Posts: 5
Joined: Wednesday 13 January 2016 16:58
Target OS: Raspberry Pi
Domoticz version:
Location: Netherlands
Contact:

Re: Blockly examples

Post by Hoekies » Monday 06 August 2018 14:08

henk99 wrote:
Monday 06 August 2018 13:26
waaren wrote:
Thursday 02 August 2018 18:08
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.
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
}
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?
Place the end before the else statement behind the statement. Then the problem is solved.

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
}

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests