Openhab home automation integration


#1

Openhab is a fantastic open source home automation system, with an advanced rule engine.

Triggering Openhab means that I can do actions such as “If I’m at home, turn on all morning lights - but only if it’s not yet dawn”. To do this now, I have to go through IFTTT.

It would be great to be able to trigger Openhab directly without having to go through IFTTT (and suffer the extra delays from IFTTT latency).

They have a simple REST interface - see https://www.openhab.org/docs/configuration/restdocs.html

This REST API is also available through a cloud connector at https://user:pass@myopenhab.org

Happy to help with testing.


#2

This is really interesting and something we would like to explore but it seems that there are few competing home automation solutions. Is there anything unifying, some common interface to them? Does Openhab for example support MQTT for any task?


#3

It’s a possibility, but needs careful thought.

Openhab does support MQTT. It doesn’t come with an MQTT broker, but most folks add Mosquitto. Crucially (for the solution I propose at the end) Openhab allows the use of multiple MQTT brokers.

For external access (i.e. from cloud services such as Sleep as Android) there’s a (free) cloud bridge for Openhab, called Myopenhab. This means that an Openhab user doesn’t need to poke holes in their own firewall for external cloud services to be able to interact. Instead, their local Openhab instance makes an outbound connection to Myopenhab and receives events that have been exposed. If you were building an Openhab-specific API, you’d be communicating with Myopenhab. Myopenhab doesn’t include an MQTT bridge.

An ideal MQTT solution for Sleep as Android and Openhab would (I suggest) have the following attributes:

  • Doesn’t require the user to install an on-premise MQTT broker (they may not be using MQTT for anything else)
  • Doesn’t require the user to use an MQTT cloud bridge for any on-premise MQTT broker (which would be a lot of extra config)
  • Doesn’t require the user to open any ports on their firewall to access an MQTT broker (which would reduce security)

This could all be accomplished if you provided the MQTT broker service for Sleep as Android. You’d need to provide a public key to certify the identity of the broker service, and require username and password from the user.