Set Timer Active/Inactive script [Solved]
Moderator: leecollings
-
- Posts: 200
- Joined: Thursday 20 December 2018 11:03
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Set Timer Active/Inactive script
Hi,
I have a set a timer on a virtual switch (every weekday at 7.00 AM)
The switch triggers a node-red-contrib-castv2 node which sends a media stream to my google home mini's.
I use it as an media alarm to wake up.
But I also want to trigger the timer's active/inactive state with a second virtual switch (to voice control the Alarm to be active/inactive)
Is that possible with dzVents?
I have a set a timer on a virtual switch (every weekday at 7.00 AM)
The switch triggers a node-red-contrib-castv2 node which sends a media stream to my google home mini's.
I use it as an media alarm to wake up.
But I also want to trigger the timer's active/inactive state with a second virtual switch (to voice control the Alarm to be active/inactive)
Is that possible with dzVents?
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Set Timer Active/Inactive script
You could try and use a openURL like (
Code: Select all
domoticz.openURL(<domoticz ip:domoticz port>/json.htm?active=true&command=0&days=128&hour=0&idx=3&level=100&min=0¶m=updatetimer&randomness=false&timertype=0&type=command)
My approach would be to remove the timer of the switch and use the timer = trigger in dzVents for that.
It could look like.
Code: Select all
return
{
on =
{
timer =
{
'at 07:00',
},
},
logging =
{
level = domoticz.LOG_DEBUG,
marker = 'alarming',
},
execute = function(dz)
if dz.devices('second virtual switch').active then
dz.devices('virtual switch').switchOn()
else
dz.log('No alarm needed today',dz.LOG_DEBUG)
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
-
- Posts: 112
- Joined: Monday 26 June 2017 21:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Spain
- Contact:
Re: Set Timer Active/Inactive script
Wouldn't it be better to use the alarm function on google home?
-
- Posts: 200
- Joined: Thursday 20 December 2018 11:03
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Set Timer Active/Inactive script
Well I have tried a simple blockly script to activate/deactivate the timer of the virtual switch with a JSON http request (described on the wiki page)waaren wrote: ↑Thursday 12 March 2020 10:18 You could try and use a openURL like (or something similar but it is quite complicated to find the right parms for this openURL.Code: Select all
domoticz.openURL(<domoticz ip:domoticz port>/json.htm?active=true&command=0&days=128&hour=0&idx=3&level=100&min=0¶m=updatetimer&randomness=false&timertype=0&type=command)
Code: Select all
http://127.0.0.1:9090/json.htm?type=command¶m=disabletimer&idx=243
http://127.0.0.1:9090/json.htm?type=command¶m=enabletimer&idx=243
But I keep the error of opening the URL
I will try your script this weekendMy approach would be to remove the timer of the switch and use the timer = trigger in dzVents for that.
It could look like.
Code: Select all
return { on = { timer = { 'at 07:00', }, }, logging = { level = domoticz.LOG_DEBUG, marker = 'alarming', }, execute = function(dz) if dz.devices('second virtual switch').active then dz.devices('virtual switch').switchOn() else dz.log('No alarm needed today',dz.LOG_DEBUG) end end }
Last edited by gschmidt on Friday 13 March 2020 8:41, edited 1 time in total.
-
- Posts: 200
- Joined: Thursday 20 December 2018 11:03
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Set Timer Active/Inactive script
In Dutch language it is not possible yet to set an Music Alarm for only weekdayssalvacalatayud wrote: ↑Thursday 12 March 2020 10:25 Wouldn't it be better to use the alarm function on google home?
-
- Posts: 112
- Joined: Monday 26 June 2017 21:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Spain
- Contact:
Re: Set Timer Active/Inactive script
I have my google mini in both spanish and english, if I need a function that is not possible in spanish I speak in english.
-
- Posts: 200
- Joined: Thursday 20 December 2018 11:03
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Set Timer Active/Inactive script
I know it is possible but the timer options in domoticz are more flexible to my needs....7.00 AM was just an examplesalvacalatayud wrote: ↑Friday 13 March 2020 9:25 I have my google mini in both spanish and english, if I need a function that is not possible in spanish I speak in english.
-
- Posts: 200
- Joined: Thursday 20 December 2018 11:03
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Set Timer Active/Inactive script [Solved]
It is working...Thanx!gschmidt wrote: ↑Friday 13 March 2020 8:29I will try your script this weekendwaaren wrote: ↑Thursday 12 March 2020 10:18 My approach would be to remove the timer of the switch and use the timer = trigger in dzVents for that.
It could look like.
Code: Select all
return { on = { timer = { 'at 07:00', }, }, logging = { level = domoticz.LOG_DEBUG, marker = 'alarming', }, execute = function(dz) if dz.devices('second virtual switch').active then dz.devices('virtual switch').switchOn() else dz.log('No alarm needed today',dz.LOG_DEBUG) end end }
Who is online
Users browsing this forum: No registered users and 1 guest