Author Topic: Redirecting Notications  (Read 1699 times)

Offline ruhtra

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
Redirecting Notications
« on: May 31, 2011, 09:44:53 pm »
I had turned off RA but still got a notification email when I toggled it on for my mios account.  I logged in via ssh and confirmed that the RA tunnel didn't get enabled.  I decided to look into how things work.  I hope I don't get blacklisted for this.

First the users.  Connecting to mothership (aka mios) updates the /etc/cmh/users.conf file where users are listed, one per line, with the account type (admin=1, notificationonly=3, and I'm guessing guest=2) following by a vertical bar character and then the mios user id.  The gui will show toggle boxes for user of type 1 and 3.

Once a notification is triggered, Vera does an http GET operation (ie a simple navigation to a web address).  It looks like this:<redacted for security>&HW_Key=<edited_by_admin>&FK_Device=12&Time=2011-05-28%2022:32:15&Value=1&Event=FrontLight&Users=51572&Comments=

When I tried the URL from a browser it returned:


The number changes with repeated calls but I don't know the significance.

I run my own DNS/DHCP server (dnsmasq) so it was trivial to redirect both hostnames and to some other IP address.  The Vera logs show it trying several times before giving up.

I then resolved the hostnames to my  web server and found that Vera does not appear to be picky about the validity of SSL certs.  There's good and bad points to this but it's good for me.  It's easier to impersonate the events notification server.  :-)

I have no ill will to the MCV folks but it seemed a bit annoying to add Lua code for every event I wanted to send notifications for when the gui lets you manage it quite nicely.

It's probably possible to cobble together a email sending solution that runs on Vera itself:
1) Enable the Vera's web server for SSL
2) Change the .php extension to invoke Lua (so I don't have to install PHP)
3) Implement the log_notification2.php script in Lua to send email notifications via your outbound smtp.
4) Add entries in /etc/hosts to resolve the evt1 and evt2 hostnames to Vera (

I won't be implementing it because I've got my intranet web server running outside of Vera already and don't feel like patching my Vera after every new firmware release.

But I thought others might find it useful.

« Last Edit: June 08, 2012, 04:51:31 am by mcvflorin »