I am trying to automatically reset a doorbell camera after it hangs. This happens regularly unfortunately, that is why I want to automate it.
The doorbell camera rtsp stream is recorded on my NVR, and the NVR sends an email upon detection of video loss.
I am using the following code to check if an e-mail with the right subject arrives:
sensor:
- platform: imap_email_content
server: imap.bla.com
port: 993
username: [email protected]
password: mail_pw
folder: INBOX
senders:
- [email protected]
name: videoloss_doorbird
value_template: >-
{% if 'NVR: Video Signal Lost On Channel D12' in subject %}
true
{% else %}
false
{% endif %}
So based on the sensor turning true, I could create an automation:
alias: Reset Doorbird after Video Loss
description: ""
trigger:
- platform: state
entity_id:
- sensor.videoloss_doorbird
from: "false"
to: "true"
condition: []
action:
- service: rest_command.restart_doorbird
data: {}
mode: single
and
rest_command:
restart_doorbird:
url:"http://user:[email protected]/bha-api/restart.cgi"
but that would only work once (or until a mail with a different subject arrives, but in this case that does not happen, as it is a dedicated mail account). I would want to add an action to the automation and reset the sensor to false, but since a sensor is read-only, I cannot do that.
How should I proceed here?
I am relatively new to HA, so please be gentle on me
BTW: this is a workaround for the missing Video Loss signal in the Hikvision Binary Sensor integration:
https://community.home-assistant.io/t/add-video-loss-to-hikvision-binary-sensor/554450