Page 28 of 36

Re: Blockly examples

Posted: Wednesday 09 May 2018 17:41
by SilentScreamer
Thanks, that worked very well, thanks for the unreal fast response!

Re: Blockly examples

Posted: Wednesday 20 June 2018 22:29
by shamie
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?

Re: Blockly examples

Posted: Wednesday 20 June 2018 22:48
by StanHD
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 = ??:??]

Re: Blockly examples

Posted: Thursday 21 June 2018 10:35
by cobra045
Try this
2018-06-21_10h28_03.png
2018-06-21_10h28_03.png (15.42 KiB) Viewed 4724 times

Cobra045

Re: Blockly examples

Posted: Thursday 21 June 2018 18:36
by shamie
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

Re: Blockly examples

Posted: Friday 22 June 2018 17:49
by tozzke
You'll probably have to use 'Open'/'Closed' in the If statement and 'On'/'Off' in the Do section

Re: Blockly examples

Posted: Saturday 23 June 2018 18:52
by shamie
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.

Re: Blockly examples

Posted: Wednesday 04 July 2018 19:25
by Benneton
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

Re: Blockly examples

Posted: Wednesday 04 July 2018 19:27
by Benneton
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

Re: Blockly examples

Posted: Thursday 05 July 2018 19:38
by Benneton
That did the trick :)

Re: Blockly examples

Posted: Tuesday 31 July 2018 22:49
by EdddieN
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 3911 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?

Re: Blockly examples

Posted: Thursday 02 August 2018 16:26
by henk99
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 3811 times
Version 2

Re: Blockly examples

Posted: Thursday 02 August 2018 16:30
by EdddieN
Make sure you select the right trigger event (device, time, etc...) on your blockly diagram

Re: Blockly examples

Posted: Thursday 02 August 2018 17:11
by henk99
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.

Re: Blockly examples

Posted: Thursday 02 August 2018 18:08
by waaren
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
}

Re: Blockly examples

Posted: Thursday 02 August 2018 21:41
by EdddieN
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 3785 times

Re: Blockly examples

Posted: Friday 03 August 2018 11:21
by henk99
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!

Re: Blockly examples

Posted: Monday 06 August 2018 9:50
by Hoekies
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

Re: Blockly examples

Posted: Monday 06 August 2018 13:26
by henk99
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?

Re: Blockly examples

Posted: Monday 06 August 2018 14:08
by Hoekies
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
}