Do you need to whitelist /config?
ummmmm no idea… how would I even do that?
I’m on Hass.io which is always difficult for this kind of thing.
I did find a solution though… a python script that does the same thing works.
I am also clearing out my Gmail inbox for alarm emails… I am using a python script that I can call from a button or automation, why not use python?
you might want to read the post directly above yours
Ow ok python works
Sorry, I don’t use shell scripts, not tested it
Maybe interesting below , seems you need to use the full path …
Also here, full path used in last replies…
I saw all those threads and posts before I posted. I don’t think any of them got it working.
ow ok, sorry, cant help then either
I’m using the python one I found… it’s solved but thanks for your interest.
do you have a pyton that clears the complete inbox? or can you select the folder you want to clear?
It clears the complete inbox which is what I wanted. I found a lot of examples with selective deletes.
What happens is if my alarm is triggered, my router uses one analog line to call my other line (both VoIP) and then, if the Fritz detects the call is from the VoIP number, it goes to an answering machine and forwards the email to a gmail I setup just for getting these emails. When that gmail gets an email from my email address and has the phone number in the subject, the IMAP unread email in Home Assistant sees it and does a persistent notification as well as a notification to my mobile phone and I have a conditional card in lovelace that sees there is email and opens up a card showing the unread email and gives me a button I can now use to trigger the python script to delete the emails (which just have tones in them)
Job done… So I always know if my alarm has been triggered when I’m not here.
well, in my case, i have also setup another mailbox, just for alarm mails and also mails for arm/disarm status
since my alarm since has NO integration possibilites, i use a HA Imap sensor
so, every 5 seconds i check that mailbox
if i receive a mail with arm or disamed, based on the body text keywords, i run an automation todo all lights/music on and so on… its some kind of presence detector in my case
Nice.
My alarm is 20 years old probably. I had a remote control fitted when I installed it and I just recently added a dry-contact switch so I can turn it on/off vis home assistant. It was a nightmare getting the dialer to work with VoIP… we don’t have a PSTN line anymore since we went on VDSL2 and the system was set to pulse not tone dialling and also waiting for a non-existent dialtone… So I have an automation now when I leave that closes the garage door (also retrofitted with a sonoff sv dry-contact) and sets the alarm and then an automation that checks if the state of the switches changed in the last 60 seconds and sends me a notification that the garage is closed and the alarm is set…
All this and the alerts for about $20…
Nice ideas
Script: (Edit in username/password) Save as emptyinbox.py in config directory with yaml files:
#!/usr/bin/python3
import imaplib
box = imaplib.IMAP4_SSL('imap.gmail.com', 993)
box.login("USERNAME-HERE","PASSWORD-HERE")
box.select('Inbox')
typ, data = box.search(None, 'ALL')
for num in data[0].split():
box.store(num, '+FLAGS', '\\Deleted')
box.expunge()
box.close()
box.logout()
Sensor to detect alarm triggered & Shell command to run the script.
sensor:
# Alarm Emails
- platform: imap
name: Alarm Triggers
server: imap.gmail.com
port: 993
username: !secret outlooksyncuser
password: !secret outlooksyncpass
folder: inbox
search: !secret alarmnotification
shell_command:
removealarm: python /config/emptyinbox.py
In Lovelace:
- type: horizontal-stack
cards:
- type: conditional
conditions:
- entity: sensor.alarm_triggers
state_not: "0"
- entity: sensor.alarm_triggers
state_not: "unavailable"
card:
type: entities
entities:
- entity: sensor.alarm_triggers
- type: conditional
conditions:
- entity: sensor.alarm_triggers
state_not: "0"
- entity: sensor.alarm_triggers
state_not: "unavailable"
card:
type: 'custom:button-card'
color_type: card
entity: sensor.alarm_triggers
name: Alarm Event
state:
- value: 0
operator: '>'
color: red
icon: mdi:alert
style:
- animation: blink 2s ease infinite
spin: false
- operator: default
color: green
icon: mdi:shield-check
tap_action:
action: call-service
service: shell_command.removealarm
Note it uses the custom button-card
Hope this helps.
Sorry to resume such an old topic - but I was searching for something else and came across this one. I’m really interested in understanding how you made the alarm control smart. I do have a pretty old alarm system and if there’s any chance to be able to control it remotely it would be great ! Could you share what kind of switch you bought and how you wired it to the alarm?
Is your alarm able to send mails?
no, not really. I just wanted to see how I can wire a wifi switch and control it via HA - if that’s possible.