# \[TUTORIAL\] Setting up MQTT on Homey for configuring Home Assistant for dashboard purposes

**URL:** <https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880>\
**Category:** Questions & Help\
**Created:** [March 21, 2019, 11:46am UTC](https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880 "2019-03-21T11:46:12Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![victoroos](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/victoroos/32/8344_2.png) [@victoroos](https://community.homey.app/u/victoroos)\
**Post date:** [March 25, 2019, 10:49am UTC](https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880/21 "2019-03-25T10:49:22Z")

</div>

Do you still need :

- Mosquitto (Synology package)

> [@Ferry\_van\_E](#):
>
> - Docker (Synology package)
> - Mosquitto (Synology package)

when you sue teh rboker and client and hub on homey?

more important question. Why would I want to sue home assistant? and would I run it on a pi then I presume? Soemthing new for em it seems ^^

---

<div class="post-metadata">

**Author:** ![HarriedeGroot](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/harriedegroot/32/56160_2.png) [@HarriedeGroot](https://community.homey.app/u/HarriedeGroot)\
**Post date:** [March 25, 2019, 11:22am UTC](https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880/22 "2019-03-25T11:22:11Z")

</div>

Wrote some logic to retry topic subscription on failure. If a subscription fails, Homey does not listen to triggers from outside apps. Maybe this helps addressing the above problems.

> [@MQTT Hub/Gateway](https://community.homey.app/t/mqtt-hub-gateway/6766/545):
>
> Submitted (waiting for approval).
> 
> #### Version 2.1.9
> 
> - Retry topic subscriptions on failure & manual broadcast
> 
> Already available on the [master branch](https://github.com/harriedegroot/nl.hdg.mqtt/tree/master).

---

<div class="post-metadata">

**Author:** ![Ferry\_van\_E](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ferry_van_e/32/10953_2.png) [@Ferry\_van\_E](https://community.homey.app/u/Ferry_van_E)\
**Post date:** [March 25, 2019, 12:00pm UTC](https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880/23 "2019-03-25T12:00:22Z")

</div>

> [@victoroos](#):
>
> Do you still need :
> 
> - Mosquitto (Synology package)
> 
> ![](https://sea1.discourse-cdn.com/flex015/user_avatar/community.athom.com/ferry_van_e/40/7925_2.png) Ferry\_van\_E:
> 
> > - Docker (Synology package)
> > - Mosquitto (Synology package)
> 
> when you sue teh rboker and client and hub on homey?
> 
> more important question. Why would I want to sue home assistant? and would I run it on a pi then I presume? Soemthing new for em it seems ^^

If you use the MQTT broker on Homey then you don’t need to run Mosquitto on Synology.

Concerning your other question; i obviously cannot answer this since you are asking yourself a question and i think you are the only one who will know the answer 🤷🏽‍♂️

---

<div class="post-metadata">

**Author:** ![David\_Maas](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/david_maas/32/25776_2.png) [@David\_Maas](https://community.homey.app/u/David_Maas)\
**Post date:** [March 25, 2019, 3:40pm UTC](https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880/24 "2019-03-25T15:40:05Z")

</div>

1. Yes restarted everything several times in different orders.
2. Yes, no luck.

* * *

1. Seeing the incoming message on the broker-homie-homey directory in the Mqtt Explorer
2. See a lot coming in at the client, but not the task i trieing to execute.
3. Messages are incomming.

Only i dont see a Client tab in the Mqtt explorer, is this correct?

 ![IMG_20190325_163823](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/6/662d744cb94950c2ba44cabac2cd49e86cb7e0a1.jpeg)

---

<div class="post-metadata">

**Author:** ![xAPPO](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/xappo/32/13726_2.png) [@xAPPO](https://community.homey.app/u/xAPPO)\
**Post date:** [March 25, 2019, 4:15pm UTC](https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880/25 "2019-03-25T16:15:09Z")

</div>

MQTT Explorer is a great little tool for us to sort out what isn’t working…  
At the top of the topic tree you should show that you have two clients connected (Homey and Home Assistant)  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/c/ce053c4d7e75385cddecdefcc19d0ac506562d28.png)

Double check you are using the latest version of MQTT Hub, 2.1.7 or higher and $state should show ‘ready’.  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/6/62cc2b9c7ecbc8e106760a77868ec25092625ba2.png)

In the Homie.Homey fork expand it so you can see a specific simple device that you know works in Homey and is also auto created in HA and updates OK (from Homey) - like a switch or a light. You should see something like this for my non dimmable light device ‘test’.

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/5/59d37563032a14aec08deb0443cb77dab82a6c2c.png)

Watch the tree whilst you toggle on and off the device from Homey and you will see that the onoff topic updates with the current value as it turns on and off. Now try and control it from HomeAssistant - did a ‘ **set** ’ subtopic appear and if so is it updated as you alter it in the HA interface?

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/a/acbf58d6e9ca1c30a51ab594e205f14f3fa320df.png)

If it is created does the onoff topic update too ? You’ll see mine has switched to true.

If it is not created then this points towards where the problem lies and I’ll see if I can help you fix that.

You can try manually publishing the topic and updating its value in MQTT explorer between true and false . You need to enter the Topic, select ‘raw’ add false or true and click publish .The real light should follow each state update. This would show that MQTT-Hub is working.  
Here is my topic - (note my Homey is called louey - yours is homey)

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/f/f7307e75f78cb73664cb1ea6e48901d5c1278271.png)

---

<div class="post-metadata">

**Author:** ![xAPPO](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/xappo/32/13726_2.png) [@xAPPO](https://community.homey.app/u/xAPPO)\
**Post date:** [March 25, 2019, 4:58pm UTC](https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880/26 "2019-03-25T16:58:47Z")

</div>

Just for completeness what is happening here is that a homeassistant tree is being added to the MQTT broker (by MQTT Hub) and that tells Home Assistant what type of devices you have available and how to control them and track their status. So in my example I had a non dimmable light called test.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/9/9f7f6cc18d3124ba45181c5961a887495df5cf96.png)

Here is the expanded content of that ‘config’ topic as shown in MQTT Explorer.

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/c/c5219c9a76e8cf7905316c17e67e41d758f5bfc5.png)

You will notice within that that it points HomeAssistant to two topics that provide the state and can control the device. This sets up the two way working linkage between HomeAssistant and Homey.

“state\_topic”: “homie/louey/test/onoff”  
“command\_topic”: “homie/louey/test/onoff/set”

---

<div class="post-metadata">

**Author:** ![NoClaim](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/noclaim/32/9817_2.png) [@NoClaim](https://community.homey.app/u/NoClaim)\
**Post date:** [March 25, 2019, 6:12pm UTC](https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880/27 "2019-03-25T18:12:44Z")

</div>

I have installed MQTT explorer. And I can’t see anything change when trying to control a switch from HA. Pushing a button (controlled in Homey) I can see the value change from true to false and the other way around.

I assume I installed everything correctly (I know… assumptions 😄)  
Can it be something with user credentials?

---

<div class="post-metadata">

**Author:** ![xAPPO](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/xappo/32/13726_2.png) [@xAPPO](https://community.homey.app/u/xAPPO)\
**Post date:** [March 25, 2019, 6:20pm UTC](https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880/28 "2019-03-25T18:20:44Z")

</div>

So the ‘set’ topic does not get created within the device (in the homie tree) ? That would indicate HA is not accessing the MQTT broker (but yet contradictorily it has discovered the devices).

Does you MQTT server have a username/password setup and if so did you add that in your configuration.yaml ?

Can you post the section in HA’s configuration.yaml headed `mqtt:` (obscuring any passwords). Like this…

```
mqtt:
  broker: 192.168.1.78
  username: kevin
  password: redacted
  discovery: true
  discovery_prefix: homeassistant

```

Also - in the post just above yours I showed what a ‘config’ topic should look like when expanded in MQTT Explorer. Can you post yours for this device.

---

<div class="post-metadata">

**Author:** ![NoClaim](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/noclaim/32/9817_2.png) [@NoClaim](https://community.homey.app/u/NoClaim)\
**Post date:** [March 25, 2019, 6:38pm UTC](https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880/29 "2019-03-25T18:38:50Z")

</div>

😟 … I have installed [hass.io](http://hass.io) image directly to the pi. I’m a gui kinda guy… no real cl experience

Where can I find the configation.yaml file and how can I change the file?

this is the config file for the broker running on [hass.io](http://hass.io)

> Blockquote  
> {  
> “logins”: [  
> {  
> “username”: “username”,  
> “password”: “password”  
> }  
> ],  
> “anonymous”: false,  
> “customize”: {  
> “active”: false,  
> “folder”: “mosquitto”  
> },  
> “certfile”: “fullchain.pem”,  
> “keyfile”: “privkey.pem”  
> }

---

<div class="post-metadata">

**Author:** ![xAPPO](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/xappo/32/13726_2.png) [@xAPPO](https://community.homey.app/u/xAPPO)\
**Post date:** [March 25, 2019, 6:57pm UTC](https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880/30 "2019-03-25T18:57:50Z")

</div>

NB: This is for a [hass.io](http://hass.io) image - it is slightly different if you installed a Docker container or use HomeAssistant rather than [hass.io](http://hass.io).

Three things you could do - log in via SSH and edit the file directly or install the SAMBA addin and then the configuration folder for homeassistant will be accessible as a share. In the config folder is configuration.yaml.

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/8/88f578af814f2bedbc3259c5ee90eb4ea7229d84.png)

Or add the Configurator addin which will provide an editor within [Hass.io](http://Hass.io) You’ll probably prefer this as it’s more GUI based.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/e/ef59c7fb05c7ba2760f52e5e139c034a2c11ce27.png)

In configuration.yaml you should have, or add an MQTT section as above (just the mqtt: part not mqtt\_eventstream or mqtt\_statestream). If you broker does not have a username or password just omit those lines. Be very careful with editing configuration.yaml particularly preserving whitespace. It’s very tetchy on this. Save the new version and then click ‘Configuration \> General \> Check Config’ button and confirm it says ‘Configuration Valid’ before then restarting HA by clicking ‘restart’ in red at the bottom of that same page.

(You can I think also do this via Configuration \> Integrations \> MQTT but I have not tried it that way)

---

<div class="post-metadata">

**Author:** ![David\_Maas](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/david_maas/32/25776_2.png) [@David\_Maas](https://community.homey.app/u/David_Maas)\
**Post date:** [March 25, 2019, 7:55pm UTC](https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880/31 "2019-03-25T19:55:54Z")

</div>

I noticed in my installation my tv is popping up all of the time.  
It seems this one issn’t controlled by homey but directly.

I can control this device in HA, set it louder, quiet, off.  
Now i i’m confused, what works and what not.

---

<div class="post-metadata">

**Author:** ![xAPPO](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/xappo/32/13726_2.png) [@xAPPO](https://community.homey.app/u/xAPPO)\
**Post date:** [March 25, 2019, 8:04pm UTC](https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880/32 "2019-03-25T20:04:50Z")

</div>

This is perhaps an Apple TV ? Some things are discovered by Home Assistant directly - you can limit this within the discovery component in HA. Don’t worry about those at the moment, they are not being discovered by MQTT.

Sorry was mixing yourself and NoClaim up… You still have this problem ? You are using MQTT Hub v2.1.7 or later aren’t you ? This was a problem in earlier versions.

> [@David\_Maas](#):
>
> It sets the state after 3 seconds to the old state.

K

---

<div class="post-metadata">

**Author:** ![David\_Maas](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/david_maas/32/25776_2.png) [@David\_Maas](https://community.homey.app/u/David_Maas)\
**Post date:** [March 25, 2019, 8:12pm UTC](https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880/33 "2019-03-25T20:12:04Z")

</div>

> [@xAPPO](#):
>
> ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/a/acbf58d6e9ca1c30a51ab594e205f14f3fa320df.png)
> 
> If it is created does the onoff topic update too ? You’ll see mine has switched to true.
> 
> If it is not created then this points towards where the problem lies and I’ll see if I can help you fix that.

This is not happening, the set is changing but the onoff stays the same, i tried the raw version, but it issn’t working.

edit: using Hub 2.1.8.

---

<div class="post-metadata">

**Author:** ![xAPPO](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/xappo/32/13726_2.png) [@xAPPO](https://community.homey.app/u/xAPPO)\
**Post date:** [March 25, 2019, 8:17pm UTC](https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880/34 "2019-03-25T20:17:14Z")

</div>

Ahh - well that points to maybe an MQTT Hub issue,  
Changing **set** between true and false should update the state reported in the **onoff** topic  
(assuming $settable = true)

What is the physical device in Homey ?  
Is it just on/off or does it have other capabilities ?  
Is this the same for all devices ?

---

<div class="post-metadata">

**Author:** ![David\_Maas](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/david_maas/32/25776_2.png) [@David\_Maas](https://community.homey.app/u/David_Maas)\
**Post date:** [March 25, 2019, 8:20pm UTC](https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880/35 "2019-03-25T20:20:50Z")

</div>

The physical device in Homey is a Fibaro wallplug.  
So i this case just on off.

But i tried several devices and it is all the same.

---

<div class="post-metadata">

**Author:** ![HarriedeGroot](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/harriedegroot/32/56160_2.png) [@HarriedeGroot](https://community.homey.app/u/HarriedeGroot)\
**Post date:** [March 25, 2019, 8:22pm UTC](https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880/36 "2019-03-25T20:22:40Z")

</div>

When you switch the value manually using the MQTT explorer (payload true/false on the set topic), do you see it coming in in the MQTT Client log?

---

<div class="post-metadata">

**Author:** ![David\_Maas](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/david_maas/32/25776_2.png) [@David\_Maas](https://community.homey.app/u/David_Maas)\
**Post date:** [March 25, 2019, 8:24pm UTC](https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880/37 "2019-03-25T20:24:09Z")

</div>

Nope

---

<div class="post-metadata">

**Author:** ![HarriedeGroot](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/harriedegroot/32/56160_2.png) [@HarriedeGroot](https://community.homey.app/u/HarriedeGroot)\
**Post date:** [March 25, 2019, 8:26pm UTC](https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880/38 "2019-03-25T20:26:56Z")

</div>

Do you see a message like: “successfully subscribed to topic …” in the MQTT hub log?

---

<div class="post-metadata">

**Author:** ![David\_Maas](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/david_maas/32/25776_2.png) [@David\_Maas](https://community.homey.app/u/David_Maas)\
**Post date:** [March 25, 2019, 8:30pm UTC](https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880/39 "2019-03-25T20:30:39Z")

</div>

No nothing happens, i have looked in debug and information.  
I only see a lot of updates of my signal measure of my telephone

---

<div class="post-metadata">

**Author:** ![HarriedeGroot](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/harriedegroot/32/56160_2.png) [@HarriedeGroot](https://community.homey.app/u/HarriedeGroot)\
**Post date:** [March 25, 2019, 8:32pm UTC](https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880/40 "2019-03-25T20:32:09Z")

</div>

Try turning off all devices except one light to get a clean log.

[Previous page](https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880.md?page=1)

[Next page](https://community.homey.app/t/tutorial-setting-up-mqtt-on-homey-for-configuring-home-assistant-for-dashboard-purposes/10880.md?page=3)
