Page 1 of 1
Change timer of dzVents script with Telegram
Posted: Saturday 13 March 2021 12:45
by gschmidt
Hi,
I was wondering if it is possible to change/feed the timer (times/dates) of a dzVents script with Telegram?
I have a dzVents script which activates a Switch (which triggers node-red to send a google cast audio stream to a certain google home device)
We use it as a wake-up alarm
The timer in the dzVents script is currently:
Code: Select all
on =
{
timer =
{
'at 06:45 on mon,tue,wed,thu,fri',
},
},
The goal is to send a text string from Telegram to Domoticz which changes the Timer of the dzVents script:
Examples:
- 'at 06:45 on mon,tue,wed,thu,fri',
- 'at 06:45 on tue,wed,fri', 'at 08:00 on tue,thu',
Re: Change timer of dzVents script with Telegram
Posted: Saturday 13 March 2021 13:13
by waltervl
I cannot not help with this Dzvents but why not use the timer function on the switch itself to trigger node red?
https://www.domoticz.com/wiki/Managing_ ... ice_Timers
And with the API it should be possible to change a timer.
But onfortunately I cannot find the timer modify api, only some commands for scenes...
https://www.domoticz.com/wiki/Domoticz_ ... 28timer.29
Edit: there is this command that could work. Can you trigger that with a telegram message?
Update parameters for a specific schedule(timer) for Devices
Code: Select all
/json.htm?type=command¶m=updatetimer&idx=timerID&active=true&timertype=3&hour=0&min=20&randomness=true&command=0&days=12345
But @waaren will come with the right solution....

Re: Change timer of dzVents script with Telegram
Posted: Saturday 13 March 2021 13:32
by waaren
gschmidt wrote: ↑Saturday 13 March 2021 12:45
I was wondering if it is possible to change/feed the timer (times/dates) of a dzVents script with Telegram?
Yes; if you know a method to get the payload of telegram into a device, variable or can send an http to domoticz.
Re: Change timer of dzVents script with Telegram
Posted: Tuesday 16 March 2021 0:00
by gschmidt
waaren wrote: ↑Saturday 13 March 2021 13:32
gschmidt wrote: ↑Saturday 13 March 2021 12:45
I was wondering if it is possible to change/feed the timer (times/dates) of a dzVents script with Telegram?
Yes; if you know a method to get the payload of telegram into a device, variable or can send an http to domoticz.
Busy with it, using "node-red-contrib-telegrambot". I already get a raw message in Node-Red like this:
Code: Select all
{"payload":{"chatId":11875XXXXX,"messageId":9,"type":"message","content":"'at 6:45 on mon,tue,wed,thu,fri',","date":1615849045},"originalMessage":{"message_id":9,"from":{"id":11875XXXXX,"is_bot":false,"first_name":"Gerben","last_name":"Schmidt","username":"GXXXXX","language_code":"nl"},"chat":{"id":11875XXXXX,"first_name":"Gerben","last_name":"Schmidt","username":"GXXXXX","type":"private"},"date":1615849045,"text":"'at 6:45 on mon,tue,wed,thu,fri',"},"_msgid":"27272aea.2574a6"}
Re: Change timer of dzVents script with Telegram
Posted: Tuesday 16 March 2021 0:08
by waaren
gschmidt wrote: ↑Tuesday 16 March 2021 0:00
Busy with it, using "node-red-contrib-telegrambot". I already get a raw message in Node-Red like this:
Nice!
Maybe @Firewizard can help to send the relevant payload to domoticz with MQTT
with something like
Code: Select all
{"command":"customevent", "event":"changeTimer","data":"your payload"} # preferred methof
{"command": "setuservariable", "idx": 1, "value": "your payload" } # indirect via uservariable