MailControl Binding - sprehn/openhab GitHub Wiki
Introduction
MailControl binding provides possibility to receive commands sent via email in JSON format.
Commands of the following types can be sent:
- decimal
- HSB
- increase - decrease
- on - off
- open - closed
- percent
- stop - move
- string
- up - down
Commands are parsed, converted into instances of classes from org.openhab.core.library.types package and published by event publisher.
MailControl binding is getting use of the following libraries:
- access-email-1.0.2.jar which needs the following jars: mail-1.4.jar, activation-1.1.jar
- openhab-mailcontrol-model-1.0.0.jar which needs json-simple-1.1.jar
MailControl binding allows to send commands to the OpenHAB home server remotely without any additional server running somewhere else (for example, in a cloud).
Configuration
Example of configuration properties for the Message Control binding:
mailcontrol:[email protected]
mailcontrol:password=XXXXXXXXXX
mailcontrol:smtphost=smtp.mail.some.com
mailcontrol:smtpport=587
mailcontrol:smtpauth=true
mailcontrol:smtpstarttls=true
mailcontrol:smtpsocketfactoryport=995
mailcontrol:pop3host=pop.mail.some.com
mailcontrol:pop3port=995
mailcontrol:pop3socketfactoryport=995
mailcontrol:pop3socketfactoryclass=javax.net.ssl.SSLSocketFactory
Examples of Messages
The subject of an email message must be OpenHAB.
Examples of messages for different types of commands:
decimal: {"messageType":"110","productVersion":"1.0","itemCommand":{"timeSent":"0","command":{"commandType":"DECIMAL","value":"1.2"},"item_id":"Item"},"senderEmail":"[email protected]"}
HSB: {"messageType":"110","productVersion":"1.0","itemCommand":{"timeSent":"0","command":{"brightness":30,"saturation":50,"commandType":"HSB","hue":150},"item_id":"Item"},"senderEmail":"[email protected]"}
increase: decrease: {"messageType":"110","productVersion":"1.0","itemCommand":{"timeSent":"0","command":{"commandType":"INCREASE_DECREASE","value":"INCREASE"},"item_id":"Item"},"senderEmail":"[email protected]"}
on - off: {"messageType":"110","productVersion":"1.0","itemCommand":{"timeSent":"0","command":{"commandType":"ON_OFF","value":"ON"},"item_id":"Item"},"senderEmail":"[email protected]"}
open - closed: {"messageType":"110","productVersion":"1.0","itemCommand":{"timeSent":"0","command":{"value":"OPEN","commandType":"OPEN_CLOSED"},"item_id":"Item"},"senderEmail":"[email protected]"}
percent: {"messageType":"110","productVersion":"1.0","itemCommand":{"timeSent":"0","command":{"value":"12","commandType":"PERCENT"},"item_id":"Item"},"senderEmail":"[email protected]"}
stop - move: {"messageType":"110","productVersion":"1.0","itemCommand":{"timeSent":"0","command":{"commandType":"STOP_MOVE","value":"STOP"},"item_id":"Item"},"senderEmail":"[email protected]"}
string: {"messageType":"110","productVersion":"1.0","itemCommand":{"timeSent":"0","command":{"value":"someValue","commandType":"STRING"},"item_id":"Item"},"senderEmail":"[email protected]"}
up - down: {"messageType":"110","productVersion":"1.0","itemCommand":{"timeSent":"0","command":{"value":"UP","commandType":"UP_DOWN"},"item_id":"Item"},"senderEmail":"[email protected]"}