Send e-mail to Domoticz to start an event
Moderators: leecollings, remb0
-
- Posts: 20
- Joined: Friday 23 October 2015 22:18
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.5974
- Location: Amsterdam, Netherlands
- Contact:
Send e-mail to Domoticz to start an event
Hi,
I'm looking for a way to start an event (i.e. blockly) or just turn on a (dummy) switch by sending an e-mail.
So I send an e-mail to a predefined e-mail address that will be delivered to Domoticz.
Then based on the subject or contents of the e-mail the activation takes place.
Been looking on the forum, but couldn't find whether or not this has been suggested already.
Thanks!
I'm looking for a way to start an event (i.e. blockly) or just turn on a (dummy) switch by sending an e-mail.
So I send an e-mail to a predefined e-mail address that will be delivered to Domoticz.
Then based on the subject or contents of the e-mail the activation takes place.
Been looking on the forum, but couldn't find whether or not this has been suggested already.
Thanks!
-----
Raspberry Pi Model 2 B w/ Domoticz 3.5974 + Monit + Pi-Hole + RaZberry Z-wave module + RFXcom 433 USB
Raspberry Pi Model 2 B w/ Domoticz 3.5974 + Monit + Pi-Hole + RaZberry Z-wave module + RFXcom 433 USB
-
- Posts: 347
- Joined: Friday 03 April 2015 17:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Send e-mail to Domoticz to start an event
Have you looked at Telegram? Have not tried it myself (yet) but with Telegram it is possible to send instructions to Domoticz. From what I've seen/read you almost can control everything in Domoticz through this interface.
- remb0
- Posts: 499
- Joined: Thursday 11 July 2013 22:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands
- Contact:
Re: Send e-mail to Domoticz to start an event
I don't understand the benefits. Is it not easier to schedule, use an app, make better events with blocky/lua etc etc?
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Send e-mail to Domoticz to start an event
What if someone finds out the emailaddress and subject etc?
-
- Posts: 20
- Joined: Friday 23 October 2015 22:18
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.5974
- Location: Amsterdam, Netherlands
- Contact:
Re: Send e-mail to Domoticz to start an event
Hi all,
thanks for the replies.
I might look into telegram, but then I still prefer e-mail.
This give a huge flexibility! You can have (autoforwarded) important e-mails in domoticz to notify you (on Kodi, turn on a lamp, doorbell, or what ever).
Or you can just send an e-mail from work.
Then you also don't need to have domoticz accessible from the internet and use an app or the website, which might be blocked.
If you make the event not critical it shouldn't be a big problem if someone finds out the address / subject combination.
The chance of that happening is also very small.
greets
thanks for the replies.
I might look into telegram, but then I still prefer e-mail.
This give a huge flexibility! You can have (autoforwarded) important e-mails in domoticz to notify you (on Kodi, turn on a lamp, doorbell, or what ever).
Or you can just send an e-mail from work.
Then you also don't need to have domoticz accessible from the internet and use an app or the website, which might be blocked.
If you make the event not critical it shouldn't be a big problem if someone finds out the address / subject combination.
The chance of that happening is also very small.
greets
-----
Raspberry Pi Model 2 B w/ Domoticz 3.5974 + Monit + Pi-Hole + RaZberry Z-wave module + RFXcom 433 USB
Raspberry Pi Model 2 B w/ Domoticz 3.5974 + Monit + Pi-Hole + RaZberry Z-wave module + RFXcom 433 USB
- gizmocuz
- Posts: 2541
- Joined: Thursday 11 July 2013 18:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Top of the world
- Contact:
Re: Send e-mail to Domoticz to start an event
or you can just login and activate the switch/scene, takes the same time as writing an email 

Quality outlives Quantity!
-
- Posts: 20
- Joined: Friday 23 October 2015 22:18
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.5974
- Location: Amsterdam, Netherlands
- Contact:
Re: Send e-mail to Domoticz to start an event
I mainly would like to use it for e-mail forwarding from specific persons or systems (for example stock notifications, external server monitoring tools, etc)
-----
Raspberry Pi Model 2 B w/ Domoticz 3.5974 + Monit + Pi-Hole + RaZberry Z-wave module + RFXcom 433 USB
Raspberry Pi Model 2 B w/ Domoticz 3.5974 + Monit + Pi-Hole + RaZberry Z-wave module + RFXcom 433 USB
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Send e-mail to Domoticz to start an event
To get a notification of a mail? Isn't that one of the reason they invinted smartphones?
-
- Posts: 20
- Joined: Friday 23 October 2015 22:18
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.5974
- Location: Amsterdam, Netherlands
- Contact:
Re: Send e-mail to Domoticz to start an event
Egregius,
When I'm home I don't constantly walk around with my phone to check e-mails... it's mostly lying around in some room.
But when I'm home and receive an important e-mail I could auto-forward it to domoticz.
Then it could send a notification on Kodi, while watching a movie, ring one of my doorbells (i have 2).
The possibilities are huge, because you can connect e-mail to domoticz. E-mail is used lot of things, like motion detection on camera's, online monitoring tools, stock alerts, etc, etc ,etc.
And I don't have to open up ports on my router to have remote access to domoticz. functionalities.
greetz
When I'm home I don't constantly walk around with my phone to check e-mails... it's mostly lying around in some room.
But when I'm home and receive an important e-mail I could auto-forward it to domoticz.
Then it could send a notification on Kodi, while watching a movie, ring one of my doorbells (i have 2).
The possibilities are huge, because you can connect e-mail to domoticz. E-mail is used lot of things, like motion detection on camera's, online monitoring tools, stock alerts, etc, etc ,etc.
And I don't have to open up ports on my router to have remote access to domoticz. functionalities.
greetz
-----
Raspberry Pi Model 2 B w/ Domoticz 3.5974 + Monit + Pi-Hole + RaZberry Z-wave module + RFXcom 433 USB
Raspberry Pi Model 2 B w/ Domoticz 3.5974 + Monit + Pi-Hole + RaZberry Z-wave module + RFXcom 433 USB
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Send e-mail to Domoticz to start an event
There are possibilities...
I just managed to have a PHP script executed upon arrival of an email.
But...
That requires a mailserver where you have access to the aliasses file.
You could install postfix on the Rpi but still then you would need a domainname and MX record.
There are also some command line mail clients, maybe something is possible with those.
My guess is that it would be a huge development to put this in Domoticz and there is maybe no userbase for it.
I just managed to have a PHP script executed upon arrival of an email.
But...
That requires a mailserver where you have access to the aliasses file.
You could install postfix on the Rpi but still then you would need a domainname and MX record.
There are also some command line mail clients, maybe something is possible with those.
My guess is that it would be a huge development to put this in Domoticz and there is maybe no userbase for it.
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Send e-mail to Domoticz to start an event
Funny how you sometimes come up with ideas...
Receiving a telegram when a mail arrives with the sender and subject in it
In the aliases table of postfix add , |/path/to/script/mail.php
mail.php
The last lines sent it to telegram. You can use the variables $from and $subject to secure it and define actions.
Don't know yet how to post to Domoticz, except to a virtual text switch but don't know if you can trigger stuf on that. Unless you trigger the switch with a JSON call.
Receiving a telegram when a mail arrives with the sender and subject in it

In the aliases table of postfix add , |/path/to/script/mail.php
mail.php
Code: Select all
#!/usr/bin/php -q
<?php
// start output buffering
ob_start();
// read from stdin
$fd = fopen("php://stdin", "r");
$email = "";
while (!feof($fd)) {
$email .= fread($fd, 1024);
}
fclose($fd);
// handle email
$lines = explode("\n", $email);
// empty vars
$from = "";
$subject = "";
$headers = "";
$message = "";
$splittingheaders = true;
for($i=0; $i<count($lines); $i++) {
if($splittingheaders) {
// this is a header
$headers .= $lines[$i]."\n";
// look out for special headers
if(preg_match("/^Subject: (.*)/", $lines[$i], $matches)) {
$subject = $matches[1];
}
if(preg_match("/^From: (.*)/", $lines[$i], $matches)) {
$from = $matches[1];
}
} else {
// not a header, but message
$message .= $lines[$i]."\n";
}
if(trim($lines[$i])=="") {
// empty line, header section has ended
$splittingheaders = false;
}
}
// clean the output
ob_end_clean();
$url = 'https://api.telegram.org/bot123456789:Axxxyyyzzz/sendMessage';
$data = array('chat_id' => '123456789', 'text' => $from.":".$subject);
$options = array(
'http' => array(
'method' => 'POST',
'header' => "Content-Type: application/x-www-form-urlencoded\r\n",
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
Don't know yet how to post to Domoticz, except to a virtual text switch but don't know if you can trigger stuf on that. Unless you trigger the switch with a JSON call.
-
- Posts: 20
- Joined: Friday 23 October 2015 22:18
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.5974
- Location: Amsterdam, Netherlands
- Contact:
Re: Send e-mail to Domoticz to start an event
I already figured out a workaround concept for my own wish!
Haven't tried/implemented it yet but it's basically like this:
1 e-mail arrives to my personal inbox
2 based on a filter it auto-forwards to a special e-mail address
3.i have outlook 2010 running on my server, that receives the e-mail
4. within outlook I create a filter for all e-mail received from my personal e-mail
4.1 the action could be, move to subfolder, but i choose for 'run a program'
5. I'll create an html-file (or .bat file that opens the html, not sure if i can open directly) that has the url to control the value of an dummy-device in domoticz.
I was playing around with updating values, but haven't tried the on/off button yet; i guess thats possible.
http://192.168.0.110:8080/json.htm?type ... svalue=130
6. I use blockly to do what i want to do in domoticz based on the dummy device.
Haven't tried/implemented it yet but it's basically like this:
1 e-mail arrives to my personal inbox
2 based on a filter it auto-forwards to a special e-mail address
3.i have outlook 2010 running on my server, that receives the e-mail
4. within outlook I create a filter for all e-mail received from my personal e-mail
4.1 the action could be, move to subfolder, but i choose for 'run a program'
5. I'll create an html-file (or .bat file that opens the html, not sure if i can open directly) that has the url to control the value of an dummy-device in domoticz.
I was playing around with updating values, but haven't tried the on/off button yet; i guess thats possible.
http://192.168.0.110:8080/json.htm?type ... svalue=130
6. I use blockly to do what i want to do in domoticz based on the dummy device.
-----
Raspberry Pi Model 2 B w/ Domoticz 3.5974 + Monit + Pi-Hole + RaZberry Z-wave module + RFXcom 433 USB
Raspberry Pi Model 2 B w/ Domoticz 3.5974 + Monit + Pi-Hole + RaZberry Z-wave module + RFXcom 433 USB
-
- Posts: 110
- Joined: Friday 20 September 2013 18:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2.3530
- Location: Finland
- Contact:
Re: Send e-mail to Domoticz to start an event
Why dont use Android tablet or phone with Tasker to send commands to Domoticz?
-
- Posts: 562
- Joined: Sunday 11 December 2016 13:51
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Send e-mail to Domoticz to start an event
i also wonder if its possible to trigger an switch in domoticz with an email in my hotmail.
i have a ipcamera that sends emails if something trigger it, with this email would like to trigger an switch to turn on or off.
can this be done?
i have a ipcamera that sends emails if something trigger it, with this email would like to trigger an switch to turn on or off.
can this be done?
-
- Posts: 562
- Joined: Sunday 11 December 2016 13:51
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Send e-mail to Domoticz to start an event
i also wonder if its possible to trigger an switch in domoticz with an email in my hotmail.
i have a ipcamera that sends emails if something trigger it, with this email would like to trigger an switch to turn on or off.
can this be done?
i have a ipcamera that sends emails if something trigger it, with this email would like to trigger an switch to turn on or off.
can this be done?
-
- Posts: 660
- Joined: Thursday 10 November 2016 9:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Send e-mail to Domoticz to start an event
Why using the mail sent by camera to the outside world to (always?) trigger a switch inside Domoticz?
Best option would be a camera able to send a configurable frame directly to Domoticz on internal events like captures/motion, able to trigger a switch (using http/json API), but that's usually not possible.
But most IP cams are able to send snapshots/short video on captures to a FTP server. So, after installing a FTP server on the machine that hosts Domoticz, you may monitor configured FTP server directory for file creation & trigger a (virtual) switch in Domoticz?
This may be done using inotify for instance:
https://unix.stackexchange.com/question ... -new-files
-
- Posts: 562
- Joined: Sunday 11 December 2016 13:51
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Send e-mail to Domoticz to start an event
i use cheap Tapo cameras, they do not have any ftp upload possibilities, not what i know anyway.
these cameras can send an email alert or push to my android phone if something is registered in the camera,
so the only link i can think of is to get the email from my camera to trigger a switch in domoticz, but is it possible to do it, thats the question?
these cameras can send an email alert or push to my android phone if something is registered in the camera,
so the only link i can think of is to get the email from my camera to trigger a switch in domoticz, but is it possible to do it, thats the question?
Who is online
Users browsing this forum: No registered users and 1 guest