Re: Blockly examples
Posted: Wednesday 09 May 2018 17:41
Thanks, that worked very well, thanks for the unreal fast response!
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?
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 = ??:??]
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.
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.
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
}
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.
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 }
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
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 }
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
}