I have the following automation and script. Sometimes I receive two mqtt ‘Capture!’ payloads in very rapid succession (less than a second) and it triggers the script twice, but I only want to run the script on the first trigger. How to limit the rate of trigger? Place a sleep condition in the automation?
Automation:
- alias: Doorbell_pressed_automation
trigger:
platform: mqtt
topic: dev/test
payload: 'Capture!'
action:
service: script.turn_on
entity_id: script.doorbell_pressed_script
Script:
doorbell_pressed_script:
sequence:
- service: notify.Telegram
data:
title: Home Assistant Notification
message: --Doorbell Pressed--
data:
photo:
- url: http://192.168.0.21/images/image.jpg
caption: Doorbell View
Error:
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/notify/telegram.py", line 156, in send_photo
chat_id=self._chat_id, photo=photo, caption=caption)
File "/home/homeassistant/.homeassistant/deps/telegram/bot.py", line 125, in decorator
result = func(self, *args, **kwargs)
File "/home/homeassistant/.homeassistant/deps/telegram/bot.py", line 151, in decorator
result = self._request.post(url, data, timeout=kwargs.get('timeout'))
File "/home/homeassistant/.homeassistant/deps/telegram/utils/request.py", line 199, in post
result = self._request_wrapper('POST', url, body=data.to_form(), headers=data.headers)
File "/home/homeassistant/.homeassistant/deps/telegram/utils/request.py", line 138, in _request_wrapper
raise NetworkError('urllib3 HTTPError {0}'.format(error))
telegram.error.NetworkError: urllib3 HTTPError ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))