can Domoticz check incoming mail?

All kinds of 'OS' scripts

Moderator: leecollings

Post Reply
willemd
Posts: 621
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

can Domoticz check incoming mail?

Post by willemd »

Does domoticz already have a facility to check for incoming email and then execute a task as result of that? Hardware? A plugin?

I want to check for incoming mail on a certain gmail address and then set the thermostat as result of that incoming mail.

On a different system I just use a python program to do that and in that way I am feeding our cat when we are away, measuring how much food it received and ate, taking pictures etc so I know how to do it with python. I am just wondering whether Domoticz already has something similar available before installing that same functionality on my domoticz system.

I prefer to use email because it is so simple and available everywhere. I would rather not install an app or something like that. (although I used IFTTT to have voice control to feed the cat, I hardly used it)
thomasbaetge
Posts: 153
Joined: Wednesday 02 October 2019 11:47
Target OS: Linux
Domoticz version: 2023.1
Location: DE / BY / LT
Contact:

Re: can Domoticz check incoming mail?

Post by thomasbaetge »

Node-Red can do that for you.
Very simple to set up and you can then trigger <whatever> using MQTT.

(just wondering what will happen if someone else starts to send random emails there....)
willemd
Posts: 621
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: can Domoticz check incoming mail?

Post by willemd »

thomasbaetge wrote: Thursday 07 December 2023 11:20
(just wondering what will happen if someone else starts to send random emails there....)
Thanks, it is easy to build in some safeguards
lost
Posts: 616
Joined: Thursday 10 November 2016 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: can Domoticz check incoming mail?

Post by lost »

willemd wrote: Thursday 07 December 2023 11:06 I prefer to use email because it is so simple and available everywhere. I would rather not install an app or something like that.
That's for sure possible with a program for that, but IMO much easier to trigger actions directly using domoticz JSON API (for instance setting your thermostat setpoint remotely). Especially if you already made your domoticz accessible remotely (https+domain name+let's encrypt ; and fail2ban with some custom rules, even if https is no comparison to ssh server as a target: That's much more quiet, almost only search engine indexing robots that give up on login page).

For such quick actions (compared to mobile web page use or dedicated domoticz app), I use a generic app available on google-play as well as f-droid named "HTTP Shortcuts": This can do curl like requests + allow some JS before/after scripting as well (I use this scripting to use LAN IP if connected to one of my wifi APs, that share a common SSID naming prefix I can check from the JS to change local/remote url before the request is done).
https://http-shortcuts.rmy.ch/

IMO, you have less chance to have https filtered (would mean an almost unusable network nowadays!) than smtp from some public network (to avoid spammers abuse): It's quite rare, but I was already forced to use webmail instead of my laptop mail client that could not connect...

I use it myself for alarm activation, garage door opening... Or even domoticz mobile UI with the LAN (if currently connected to my wifi) or remote URL as there is also a browser type shortcut.
willemd
Posts: 621
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: can Domoticz check incoming mail?

Post by willemd »

lost wrote: Thursday 07 December 2023 12:23
willemd wrote: Thursday 07 December 2023 11:06 I prefer to use email because it is so simple and available everywhere. I would rather not install an app or something like that.
That's for sure possible with a program for that, but IMO much easier to trigger actions directly using domoticz JSON API (for instance setting your thermostat setpoint remotely). Especially if you already made your domoticz accessible remotely (https+domain name+let's encrypt ; and fail2ban with some custom rules, even if https is no comparison to ssh server as a target: That's much more quiet, almost only search engine indexing robots that give up on login page).

etc.
I have not exposed my domoticz installation for remote access and using the email method I don't need to do that either. The risk of exposing it makes me uncomfortable, especially the risk of making errors and opening it up more than intended. And the risk involved in using yet another 3rd party App ....

With email I would:
1) set up a dedicated gmail address
2) send mails with intructions from my normal mail addresses to that dedicated gmail address.
3) have the domoticz installation check the dedicated gmail address for incoming mail with a specified subject and/or contents (and ignore and delete the rest, in case it gets spammed).
4) execute a domoticz action (like opening a http with JSON for setpoint control) if the right type of command with safeguards was received.
5) confirm the action back to my own gmail account (see nothing gets done unnoticed)
It would of course only work for the specific predefined action, but that is as intended. In case the dedicated gmail account gets hacked/abused in any way, I could just set up a new one. My catfeeder already works for a number of years in that way.

In the Domoticz documentation, I also see the possibility of using Telegram bot for remote control. Interesting but much more than I need. Anyone experience with this? Any thoughts/concerns?
thomasbaetge
Posts: 153
Joined: Wednesday 02 October 2019 11:47
Target OS: Linux
Domoticz version: 2023.1
Location: DE / BY / LT
Contact:

Re: can Domoticz check incoming mail?

Post by thomasbaetge »

Me again :)
I'm using Telegram to receive status updates upon request (Ip address and other) as a fallback in case my VPN won't work.
But again, I'm doing this via Node-Red.
willemd
Posts: 621
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: can Domoticz check incoming mail?

Post by willemd »

thomasbaetge wrote: Thursday 07 December 2023 14:42 Me again :)
I'm using Telegram to receive status updates upon request (Ip address and other) as a fallback in case my VPN won't work.
But again, I'm doing this via Node-Red.
Thanks, I might take that as route so I also learn some new things again. Probably first set it up on a separate RPi.
So Node-Red would check the email and via MQTT send a command to Domoticz?
I'll do some investigation.
thomasbaetge
Posts: 153
Joined: Wednesday 02 October 2019 11:47
Target OS: Linux
Domoticz version: 2023.1
Location: DE / BY / LT
Contact:

Re: can Domoticz check incoming mail?

Post by thomasbaetge »

yep, that would be the way.
Installation of NR on a RPI is a matter of minutes only, the same goes for the MQTT Broker (preferably Mosquitto) on the same machine.

As for the Domoticz portion, set the topic of the MQTT message to the standard 'domoticz/in' and check the API document for the required message content in Json format.
Once you got the hang of it, it will open up a pletheora of use cases and integration scenarios, as NR can literally integrate almost everything.
I have moved all of my logic and most integrations to node red and I am using Domoticz merely as a UI.
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: can Domoticz check incoming mail?

Post by waltervl »

You can use telegram to control Domoticz: https://www.domoticz.com/wiki/Remote_Co ... legram_Bot
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests