Turn your Homey into a HUB and let external applications discover & control all your connected devices.
With this app you can communicate with all your devices connected to Homey using MQTT.
The MQTT Hub automatically broadcasts all your devices and their capabilities.
It will setup a communication channel per device, so external apps can find and control each one of them.
Furthermore it provides an interface to read the full system state & and allows advanced control of your Homey, without the need to write your own app.
Auto discovery protocols are implemented to simplify the setup and connection with external apps.
Some of the many possibilities:
- Integrate with other home automation systems: OpenHab, Home Assistant, Domoticz, ...
- Create custom dashboards: Lovelace UI, TileBoard, HABPanel, Node RED Dashboard, ...
- Create advanced flows and logic: Node RED, ...
- Use native mobile apps (3rd party): MQTT Dash, ...
- Connect to virtual assistants (Google Home/Assistant): gBridge, ...
- ...
The functionality of the MQTT Hub:
- Broadcast all available devices.
- Create a communication channel for each device.
- Dispatch device state changes for all connected devices.
- Auto discovery of your Homey devices within external apps.
- Add the ability to remotely update the state of any device.
- Dispatch system info (memory, cpu, etc.) on a regular basis.
All can be configured via app settings.
First: This appp is NOT a plug & play solution. NOR is it the replacement for the desktop interface.
Second: You need some technical background to get things working. So, if you don't like to tinker with stuff, you don't like to try many different roads before you finally get your ultimate solution or you don't like to dive just a little deeper to get things up and running: it's probably not for you...
If this meets your expectations and none of the above applies to you: Have fun!
MQTT is a lightweight communication protocol on top of TCP/IP and it's (becoming) the industry standard for IoT messaging (Internet of Things). The Homie Convention (v3.0.1) is implemented to streamline the communication with external platforms by applying a communication standard.
This app uses the MQTT Client app to communicate with a MQTT broker. You can connect with any broker (e.g. CloudMQTT, Mosquitto or HiveMQ). There is also a MQTT broker app available for Homey.
- Install an MQTT broker of your liking.
- Install the MQTT Client app from the store and connect to your broker.
- Install the MQTT Hub and let it discover & broadcast your devices.
- Install any external application supporting MQTT and connect it to your broker.
- Let your app discover Homeys devices (if it supports the Homie Convention).
- Configure your communication channels by observing & dispatching messages on the available topics.
- Start communicating with homey.
TIP: MQTT Explorer is a nice tool to check the available communication channels.
The hub allows several ways of communication.
The default communication protocol is based on the Homie Convention (v3.0.1), for details see the specification.
From their website: The Homie convention defines a standardized way of how IoT devices and services announce themselves and their data on the MQTT broker.
External apps can automatically discover your devices connected to Homey by auto discovery. The Homie Convention supports this by design. Additionally HA Discovery is implemented.
The following message format is used for communication:
root
/system name
/device class (optional)
/zone (optional)
/device name
/capability
/command
NOTE: root
, system name
, zone
& device name
will all be normalized.
i.e. All special characters will be removed, spaces are replaced by a dash (-) and all remaining text will be converted to lowercase characters.
E.g. Homey/light/Living room/Light tv/...
will become homey/light/living-room/light-tv/...
The MQTT Hub also allows a custom
communication protocol with the ability to configure:
- topic structure (e.g. inject device class and/or zone)
- color format (HSV, RGB, channels)
- enable/disable dispatching of device states
- disable topic normalization
- dimensions & value scaling
The hub provides two ways of controlling your devices over MQTT.
The first one is provided by the selected communication protocol.
Additionally the hub allows communication by message (payload). To command your Homey, you can send a payload to the topic <homey devicd id>/$command
.
E.g. These two messages will both dim the tv light to 30%:
- publish to topic 'homie/homey/tv/dim/set', with message payload: 0.3
- publish to topic 'homey/$command', with message payload:
{
"command": "set",
"device":{
"name": "tv"
"class": "light", // optional
"zone": "living", // optional
"id": "<your-device-guid>" // optional
},
"capability": "dim"
"value": 0.3
}
When using the command structure:
- Device id's will automatically be resolved from the device id, name or topic (in this order).
- The device name may contain either de original name or the normalized version.
The MQTT Hub is able to broadcast a birth
message on startup and a last will
message on shutdown.
This can be used by external applications to act on the Hub availability (online/offline).
Starting from app version 2.0.0, this app can only run on Homey's v2 firmware. The reason for this is that this firmware has introduced backward incompatible changes that don't work on older versions of the firmware.
The v1.5
branch will remain and can be manually installed on Homey using athom-cli
.
- Trigger flows
- Create the abillity to listen to app flow triggers
- Discover devices from external apps (& create virtual devices?)
- Expand the insights / device state broadcaster
- Additional commands for advanced control
- ...
- Retry topic subscriptions on failure & manual broadcast
- HA Discovery: covers/blinds
- PR: MQTT Explorer url
- Updated readme
- Athom api update (2.1.178)
- Bug fixes & stability improvements
- [FIXED] Devices are not displayed in app settings on clean install
- Option to enable/disable all devices
- Performance & stability improvements
- Display broadcast progress
- Updated Homey api to version 2.1.172
- Home Assistant Discovery: on_command_type for lights set to 'last'
- Homie Convention integer datatype fix
- Improved app startup & shutdown procedures
- Resolved issues with Client & Hub app install order
- Resolved some issues in MQTT Client app (un)install handling
- Skip normalization of custom topics
- Introduced log levels for 20% speed improvement
- Home Assistant status topic fix
- Home Assistant binary sensors fix
- Fixed the detection of config changes
- General bug fixes & stability
- HA Discovery (beta)
- Simplified settings page + added many options
- App performance & stability (introduction of a MessageQueue)
- Birth & Last Will messages
- Topic clean-up (remove retained messages from the broker when disabling devices)
- Many BUG fixes
- Fixed a BUG in the Homie protocol regarding device state broadcasts
- Topic fixes for system state dispatcher & command handler
- Added instructions
- Custom communication protocol
- Commands (rewrote some code to allow the command structure again)
- General bug fixes
- Renamed the app to 'MQTT Hub'
- Implemented Homie Convention v3.0.1
- Implemented app settings page
- Optionally include
device class
&zone
into the topic - Full re-write of the app booting sequence
- Added Log stream
- Dropped support for Homey v1.5
- Fixed messages for boolean capabilities
- Initial release for Homey firmware v2 (beta)
- Fixed getting device name
- Normalize device name
- Fixed messages for boolean capabilities
- Initial release for Homey firmware v1.5
The repository is available at: https://github.com/harriedegroot/nl.hdg.mqtt
If you want to contribute, just create a pull-request and I will take a look at it!
Do you like this app? Consider a donation to support development.