I’ve been looking for a solution to translate an email sent from my Synology Diskstation, notifying me that my system is running on the UPS battery power into an item update telling me that my there is a power outage.
I’ve been looking at ifttt combined with gmail and MyOpenHab, but I can’t find any decent ways of achieving this.
Are there any bindings that can parse on IMAP or with a gmail integration?
I setup a single purpose gmail account. Link that to IFTTT. Create a String item ‘gmailSubject’. Then my IFTTT recipe makes a GET web request as follows:
Have you considered looking into the SNMP binding which should let OH get the information directly from the Synology rather than going through this roundabout way of getting the info from an email.
I own such a beast as well but never noticed that it supports SNMP natively. This opens a bunch of possibilities, and UPS power failure detection is surely a fine thing. My number of bindings raises to a dozen.
I ended up creating an item for the Synology SNMP upsInfoStatus:
String NAS_UPS_STATUS "Status on the UPS [%s]" { snmp="<[192.168.x.x:DS:.1.3.6.1.4.1.6574.4.2.1.0:10000]" }
It has a normal status of “OL” and when discharging “OL DISCHRG” or “OB DISCHRG” - still not sure what OB is for because the status is “OL CHRG” or “OB CHRG” when charging, so it can’t be OB for battery powered…
Anyway - I created a rule to first of all change the status of a switch item depending on if the UPS is charging or discharging.
rule "Power out"
when
Item NAS_UPS_STATUS received update
then
UPS_POWER.state=NAS_UPS_STATUS.state
if(NAS_UPS_STATUS.state=="OL DISCHRG"||NAS_UPS_STATUS.state=="OB DISCHRG"){
HOUSE_POWER.sendCommand(OFF)
}else{
if(NAS_UPS_STATUS.state=="OL CHRG"||NAS_UPS_STATUS.state=="OB CHRG"||NAS_UPS_STATUS.state=="OL"){
HOUSE_POWER.sendCommand(ON)
}
}
end
If there is a better way of doing it, I’m open to suggestions
I tried figuring out how that works - I haven’t got any former experience with IFTTT, and after an hour or two researching, I still wasn’t any closer to figure out how to link the email or gmail service to sending a GET request or changing status on an item in OpenHab cloud…
Also the word recipe doesn’t seem to exist within IFTTT anymore - just applets and services. I tried setting up an applet with the gmail service but I couldn’t find a way to link it with the OpenHab service…
Would the openHAB channel work for this? Of course, assuming you have myopenhab.org set up with the Item you want to send the data to exposed to IFTTT.
Not sure - I don’t use myopenhab.org out of stability/security concerns (although I appreciate that exposing my password to IFTTT does not evidence the highest degree of paranoia…)
I actually go an applet up and semi working where I’m not using a web hook, but pointing at an item in myopenhab instead.
It fails on me, but I’m not sure if it’s the gmail service or the OpenHab service and unfortunately I don’t have the time to research it any deeper this week - To be continued when time permits