When you disable the script, do you still have the delay with your espeasy, when manually triggered?
My first doorbell configuration was like this
Doorbell button --> to domoticz --> activating scripts --> command to espeasy (chime)
Domoticz reaction was fast, that was not the problem. But espeasy was slow in reaction. This was with sending a http command to espeasy. When you send it as a mqtt command, then it is fast.
But the thing that i didn't like, that something happens with domoticz, the doorbell/chime didn't work.
Therefor i made my own program and modified a byron chime. Put and esp12f inside which triggers the chime and sends a command to domoticz.
Now the condiguration is like this
Doorbell button --> esp12f (chime, own code) --> domoticz --> activating scripts
When domoticz is in maintenance or some other things the doorbell/chime still work. The esp12f is triggered by a http command, my doorbell can post a http command, not mqtt.
Is there a delay, yes unfortunally there is. I can't measure how long, because it is that short. But i can hear the doorbell play a sound and a little later the chime plays its sound. But with that i find it good enough
What you can try is to put the espeasy trigger in the same script as the telegram photo. But put it above the part where the telegram stuff starts. Then domoticz first activates your chime and then starts working with telegram. The os.execute parts will delay other things in domoticz, but this could be a work around. Otherwise i would advice to have a look at .sh files to send a telegram message. These can run in the background and will not delay domoticz
Telegram snapshots Topic is solved
Moderator: leecollings
-
- Posts: 531
- Joined: Saturday 02 June 2018 11:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V2022.1
- Location: Echt, Netherlands
- Contact:
Re: Telegram snapshots
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
-
- Posts: 9
- Joined: Monday 02 May 2022 7:31
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022-1
- Contact:
Re: Telegram snapshots
Thanks. I had more or less abandoned the project, but I'm now picking it up again because I can't stand it when things don't do what I want them to do.
I'm pretty sure I don't have an issue with the espeasy side. And indeed, I had placed the espeasy command in the script:
That did not make much difference.
Anyway, it now looks like the permissions to write a snapshot in the filesystem seems still to be the problem (can't find a jpg on the sd), and could be the reason for the script to wait (to long) before chiming.
Anyway, thanks for answers and hints. Going into trial and error mode

I'm pretty sure I don't have an issue with the espeasy side. And indeed, I had placed the espeasy command in the script:
Code: Select all
os.execute('curl -s -X POST "http://192.168.178.137/control?cmd=event,T2"')
Anyway, it now looks like the permissions to write a snapshot in the filesystem seems still to be the problem (can't find a jpg on the sd), and could be the reason for the script to wait (to long) before chiming.
Anyway, thanks for answers and hints. Going into trial and error mode

-
- Posts: 9
- Joined: Monday 02 May 2022 7:31
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022-1
- Contact:
Re: Telegram snapshots
Trial and error led me to another script that works most of the time (for me anyway) with the doorbell unit on a tasmota ESP32 cam firmware.
Most of the time meaning that sometimes still the second last snapshot is being send to telegram....
Could be a timing issue with Domoticz or the raspberry pi 4 it's running on, or my remove command does nothing
(posting the Event is a signal to an espeasy unit with a mp3 player attached)
Update: grabbing a snapshot from the cam did lead to old snapshots being shown. It seems not the raspberry or the script to be at fault but the esp32. In the new script 4 snapshots are taken and the last one is being send to telegram. This works 100%. Don't ask me why.
Most of the time meaning that sometimes still the second last snapshot is being send to telegram....
Could be a timing issue with Domoticz or the raspberry pi 4 it's running on, or my remove command does nothing

(posting the Event is a signal to an espeasy unit with a mp3 player attached)
Code: Select all
return {
on = {
devices = {'doorbell'},
},
execute = function(domoticz, device)
local Cam = domoticz.devices("doorbell") -- Actief
if(device.state == 'On') then
os.remove "/var/tmp/camsnapshot.jpg"
local teleTok = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
local chatId = 'xxxxxxxxxxxxxxxxxxxxxxxx'
local captiontxt = 'Er staat iemand voor de deur. Bekijk de bezoeker!'
local captiontxt2 = 'Er staat iemand voor de deur, maar je zal wel zelf moeten gaan kijken wie!'
local cameraname = 'doorbell'
if domoticz.devices(cameraname).state == 'On' then
os.execute('wget http://192.168.178.xxx:80/snapshot.jpg?idx=1 && sudo mv snapshot.jpg?idx=1 /var/tmp/camsnapshot.jpg ')
os.execute('curl -s -X POST "https://api.telegram.org/bot'..teleTok..'/sendPhoto" -F chat_id='..chatId..' -F photo="@/var/tmp/camsnapshot.jpg" -F caption="'.. captiontxt ..'"')
os.execute('curl -s -X POST "http://192.168.178.xxx/control?cmd=event,T2"')
else
os.execute('curl -s -X POST "https://api.telegram.org/bot'..teleTok..'/sendMessage?chat_id='..chatId..'&text='..captiontxt2 ..'"')
os.execute('curl -s -X POST "http://192.168.178.xxx/control?cmd=event,T2"')
end
end
end
}
Code: Select all
return {
on = {
devices = {'doorbell'},
},
execute = function(domoticz, device)
local Cam = domoticz.devices("doorbell") -- Actief
if(device.state == 'On') then
local teleTok = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
local chatId = 'xxxxxxxxxxxxxxxxx'
local captiontxt = 'Er staat iemand voor de deur. Bekijk de bezoeker!'
local captiontxt2 = 'Er staat iemand voor de deur, maar je zal wel zelf moeten gaan kijken wie!'
local cameraname = 'doorbell'
if domoticz.devices(cameraname).state == 'On' then
os.execute('wget --no-cache http://192.168.178.xxx:80/snapshot.jpg?idx=1 && sudo mv snapshot.jpg?idx=1 /home/pi/Pictures/camsnapshot.jpg ')
os.execute('wget --no-cache http://192.168.178.xxx:80/snapshot.jpg?idx=1 && sudo mv snapshot.jpg?idx=1 /home/pi/Pictures/camsnapshot1.jpg ')
os.execute('wget --no-cache http://192.168.178.xxx:80/snapshot.jpg?idx=1 && sudo mv snapshot.jpg?idx=1 /home/pi/Pictures/camsnapshot2.jpg ')
os.execute('wget --no-cache http://192.168.178.xxx:80/snapshot.jpg?idx=1 && sudo mv snapshot.jpg?idx=1 /home/pi/Pictures/camsnapshot3.jpg ')
os.execute('curl -s -X POST "https://api.telegram.org/bot'..teleTok..'/sendPhoto" -F chat_id='..chatId..' -F photo="@/home/pi/Pictures/camsnapshot3.jpg" -F caption="'.. captiontxt ..'"')
os.execute('curl -s -X POST "http://192.168.178.xxx/control?cmd=event,T2"')
else
os.execute('curl -s -X POST "https://api.telegram.org/bot'..teleTok..'/sendMessage?chat_id='..chatId..'&text='..captiontxt2 ..'"')
os.execute('curl -s -X POST "http://192.168.178.xxx/control?cmd=event,T2"')
end
end
os.execute('rm /home/pi/Pictures/camsnapshot3.jpg')
os.execute('rm /home/pi/Pictures/camsnapshot2.jpg')
os.execute('rm /home/pi/Pictures/camsnapshot1.jpg')
os.execute('rm /home/pi/Pictures/camsnapshot.jpg')
end
-
- Posts: 7
- Joined: Sunday 03 July 2016 22:19
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Telegram snapshots
Hello, I also used the script u made i have a question; witch type of switch are u using to trigger the event?
I have been trying the on off switch and then I get the problem domoticz gets really slow and is sending an image multiple times.
It looks like it is repeating until i press the on/off switch off again .
I also tried using the Doorbell switch but then nothing happens.
BTW respect for all the coders I'm really copying lots of code and the most of them work really well!
Thnx BTW!
I have been trying the on off switch and then I get the problem domoticz gets really slow and is sending an image multiple times.
It looks like it is repeating until i press the on/off switch off again .
I also tried using the Doorbell switch but then nothing happens.
BTW respect for all the coders I'm really copying lots of code and the most of them work really well!
Thnx BTW!
- QNTL
- Posts: 59
- Joined: Sunday 19 January 2020 11:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Telegram snapshots
Hi,
I've been using an extra script to turn off the device that triggers the script. So the device that triggers the script, never stays on longer then the script needs to run.
Very simple blockly code.
If device x is on, turn device x off after y seconds.
I've been using an extra script to turn off the device that triggers the script. So the device that triggers the script, never stays on longer then the script needs to run.
Very simple blockly code.
If device x is on, turn device x off after y seconds.
-
- Posts: 7
- Joined: Sunday 03 July 2016 22:19
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Telegram snapshots
Yea I also tried that but Domoticz becomes really slow if i trigger the switch, did you also try the doorbell switch on it?
you should think the doorbell switch is some kind of momentary switch but in the log you only get to see the on command no off after it.
you should think the doorbell switch is some kind of momentary switch but in the log you only get to see the on command no off after it.
-
- Posts: 7
- Joined: Sunday 03 July 2016 22:19
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Telegram snapshots
finch666 wrote: ↑Saturday 07 May 2022 16:08 Thanks, but today I also noted a significant delay in triggering the actual chime (a command from domoticz to trigger an event on a espeasy device), and I can't have that with a doorbell. So in my configuration reliability is an issue, somehow. Could be domoticz has a lot of other things to do, leading to unwanted delays.
Have you found a solution yet?
- QNTL
- Posts: 59
- Joined: Sunday 19 January 2020 11:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Telegram snapshots
Since the camera I bought isn't compatible with Domoticz, I used an .sh script ever since. So when the device is triggered, the script from my Pi runs. It never doubles, unless someone presses the doorbell twice of course.
-
- Posts: 9
- Joined: Monday 02 May 2022 7:31
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022-1
- Contact:
Re: Telegram snapshots
Yes, see: viewtopic.php?p=289957#p289957Jgue wrote: ↑Friday 10 June 2022 23:53finch666 wrote: ↑Saturday 07 May 2022 16:08 Thanks, but today I also noted a significant delay in triggering the actual chime (a command from domoticz to trigger an event on a espeasy device), and I can't have that with a doorbell. So in my configuration reliability is an issue, somehow. Could be domoticz has a lot of other things to do, leading to unwanted delays.
Have you found a solution yet?
No lags, no dropouts; working like a charm. Also linked the camera to my synology NAS to catch motion.
Who is online
Users browsing this forum: Desolator and 1 guest