Hi, i would like to share instructions of how to setup MQTT on Homey to make your devices visible in Home Assistant with a Synology NAS. Thanks a lot to @HarriedeGroot for creating the MQTT Hub, @scanno for the MQTT Client (and Broker, which unfortunately will not be included in this tutorial since my setup is on a Synology NAS with Mosquitto as a broker) and @Gustav_Tillback for initially sharing the first steps in creating this setup which will be explained in further detail below
DISCLAIMER**
I am no developer or wizzard nor do i state this tutorial is the only or best way to configure MQTT for Home Assistant. I’ve bought my Homey 2019 in February 2019 and ran into MQTT on March 18th for the first time in my life. I just practically followed any instruction i could find on the internet as addition on the above mentioned first steps
DISCLAIMER**
The following setup consists of apps on Homey and a so called package on Synology NAS.
What do you need?
- MQTT Client (Homey app)
- MQTT Hub (Homey app)
- Docker (Synology package)
- Mosquitto (Synology package)
Steps in instruction
- Install and configure Home Assistant on Synology NAS in Docker (package)
- Install and configure a Mosquitto broker (package) on Synology NAS
- Install MQTT client app on Homey and configure it to connect to the broker
MQTT Client for Homey - Install MQTT Hub app on Homey and configure it for Home Assistant discovery
MQTT Hub - Set up an integration to the broker in Home Assistant configuration
1. Install and configure Home Assistant on Synology NAS in Docker (package)
Instructions how to install and setup Docker under title ‘Synology NAS’ until the Z-wave USB stick part (halfway page)
2. Install and configure a Mosquitto broker (package) on Synology NAS
Instructions how to install Mosquitto
In the video above a fix is shown when Mosquitto isn’t working with the default configuration. I did not ran into the same problem because this issue probably has been solved since this video is from 2017
3. Install MQTT client app on Homey and configure it to connect to the broker
MQTT Client for installation on Homey
Make sure:
- you fill in the IP address of your Synology NAS and port 1883
- disable both checkmarks at ‘using a safe connection with broker (TLS)’ and ‘disable certificate check’
i already can predict a storm of comments because this probably isn’t a safe way to configure but i don’t have any knowledge to do better so please share your thoughts. With TLS enabled it wouldn’t work anyhow - you keep alive set at 60 (don’t know why
)
- you keep the rest empty since there is a lack of instructions for a noob like me. If you decide to fill in a username and password make sure you use these same credentials in configuration.yaml at step 5
Again i would be thankful if someone could share how to appropriately apply username and password in the rest of the setup
4. Install MQTT Hub app on Homey and configure it for Home Assistant discovery
MQTT Hub for installation on Homey
Make sure that:
- Running is ENABLED
- Under ‘HOME ASSISTANT DISCOVERY’ the switch is ENABLED
- Broadcast button will be used later on once the config in Home Assistant has been modified to be able to discover this broadcast by the MQTT Hub
5. Set up an integration to the Mosquitto broker in Home Assistant configuration
The following steps are Home Assistant related and needs to be done in the configuration.yaml file, which can be found in the folder which you’ve created in step 1
For example in <your_folder_name>/config
-
open configuration.yaml
-
add the following:
mqtt: broker: <please_fill_in_the_IP_address_of_your_Synology_NAS> username: myUsername password: myPassword discovery: true discovery_prefix: homeassistant
YAML is very sensitive to spaces - all lines except mqtt: should have two spaces at the beginning
For username and password fill in the same credentials as for the MQTT Client in step 3
- save your configuration.yaml file
- restart the Home Assistant container in Docker
-Open Docker in Synology NAS
-look for Container and go to homeassist-home-assistant and click on it
-on the Action button above choose restart - Now it is time to open Home Assistant by entering in your browser http://<your_Synology_IP_address>:8123 where you are prompted for a username and password
- when Home Assistant opens you need to go back to your MQTT Hub on your Homey and press on the Broadcast button
On the upper right corner (3 dots) you can click and search for ‘Unused entities’ which will show you all the devices connected to Homey
Happy configuring your entities in cards, glance etc.
More info about Home Assistant and edit the user interface can be found here
Good luck and greetings from a noob