# MQTT Homie: trigger channel silent after reboot

**URL:** <https://community.openhab.org/t/mqtt-homie-trigger-channel-silent-after-reboot/63489>\
**Category:** Bindings\
**Tags:** mqtt, homie\
**Created:** [January 9, 2019, 7:57pm UTC](https://community.openhab.org/t/mqtt-homie-trigger-channel-silent-after-reboot/63489 "2019-01-09T19:57:33Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![fischerman](https://community.openhab.org/letter_avatar_proxy/v4/letter/f/ee59a6/32.png) [@fischerman](https://community.openhab.org/u/fischerman)\
**Post date:** [January 9, 2019, 7:57pm UTC](https://community.openhab.org/t/mqtt-homie-trigger-channel-silent-after-reboot/63489/1 "2019-01-09T19:57:33Z")

</div>

I’ve set up MQTT 2.4 bindings with Homie and an ESP8266 which has a single button to control some lights. I’ve linked the button to a switch item using the rawbutton-toggle-switch profile (via Paper UI). The first problem I experienced is that a single press triggered multiple events (which makes my lights go crazy):

```
2019-01-09 19:22:23.580 [vent.ChannelTriggeredEvent] - mqtt:homie300:f4feb5ec:b361d0:button#button triggered PRESSED
2019-01-09 19:22:23.585 [vent.ChannelTriggeredEvent] - mqtt:homie300:f4feb5ec:b361d0:button#button triggered PRESSED
2019-01-09 19:22:23.588 [vent.ChannelTriggeredEvent] - mqtt:homie300:f4feb5ec:b361d0:button#button triggered PRESSED
2019-01-09 19:22:23.592 [vent.ChannelTriggeredEvent] - mqtt:homie300:f4feb5ec:b361d0:button#button triggered PRESSED
...
2019-01-09 19:22:23.780 [vent.ChannelTriggeredEvent] - mqtt:homie300:f4feb5ec:b361d0:button#button triggered RELEASED
2019-01-09 19:22:23.784 [vent.ChannelTriggeredEvent] - mqtt:homie300:f4feb5ec:b361d0:button#button triggered RELEASED
...

```

When I subscribe to the channel via Mosquitto I only observe a single message (so ESP and transmission seem to work fine). I thought a restart of OpenHab may help. However, now I don’t see any such messages in the log and the item does not toggle. I can still see the messages in Mosquitto and also the device status is updated in OpenHab

```
2019-01-09 20:33:14.874 [hingStatusInfoChangedEvent] - 'mqtt:homie300:f4feb5ec:b361d0' changed from ONLINE (CONFIGURATION_PENDING) to ONLINE

```

QoS is at least once, which might explain the first problem but not the recent problem. Any ideas?

---

<div class="post-metadata">

**Author:** ![David\_Graeff](https://community.openhab.org/user_avatar/community.openhab.org/david_graeff/32/61322_2.png) [@David\_Graeff](https://community.openhab.org/u/David_Graeff)\
**Post date:** [January 9, 2019, 9:23pm UTC](https://community.openhab.org/t/mqtt-homie-trigger-channel-silent-after-reboot/63489/2 "2019-01-09T21:23:33Z")

</div>

> [@fischerman](#):
>
> rawbutton-toggle-switch

I think a rawbutton produces events as long as it is clicked.

Does it work without the profile?

---

<div class="post-metadata">

**Author:** ![vzorglub](https://community.openhab.org/user_avatar/community.openhab.org/vzorglub/32/17166_2.png) [@vzorglub](https://community.openhab.org/u/vzorglub)\
**Post date:** [January 10, 2019, 7:49am UTC](https://community.openhab.org/t/mqtt-homie-trigger-channel-silent-after-reboot/63489/3 "2019-01-10T07:49:25Z")

</div>

> [@fischerman](#):
>
> The first problem I experienced is that a single press triggered multiple events (which makes my lights go crazy):

What firmware do you use?  
Is that button debounced?

---

<div class="post-metadata">

**Author:** ![fischerman](https://community.openhab.org/letter_avatar_proxy/v4/letter/f/ee59a6/32.png) [@fischerman](https://community.openhab.org/u/fischerman)\
**Post date:** [January 10, 2019, 9:06pm UTC](https://community.openhab.org/t/mqtt-homie-trigger-channel-silent-after-reboot/63489/4 "2019-01-10T21:06:44Z")

</div>

> Does it work without the profile?

As far as I understand a link always has a profile and in case of a button (channel itself is correctly auto-discovered as trigger channel of type system.rawbutton as documented [https://www.openhab.org/addons/bindings/mqtt.generic/](https://www.openhab.org/addons/bindings/mqtt.generic/)) the only profile Paper UI let’s me select is Raw Button Toggle. The docs explicitly mention the switching lights example as a use case for that profile.

> What firmware do you use?

I use Homie for ESP8266 (Homie v3 patch). Essentially I follow this: [https://github.com/bodiroga/homie-esp8266/blob/develop-v3/examples/SingleButton/SingleButton.ino](https://github.com/bodiroga/homie-esp8266/blob/develop-v3/examples/SingleButton/SingleButton.ino)

> Is that button debounced?

No, but it’s not the issue as I can confirm by mqtt logs (i pressed the button twice):

```
$ mosquitto_sub -t '#' -F '@Y-@m-@dT@H:@M:@S@z \e[92m%t \e[96m%p\e[0m' -q 2
...
2019-01-10T22:01:30+0100 homie/b361d0/button/button PRESSED
2019-01-10T22:01:31+0100 homie/b361d0/button/button RELEASED
2019-01-10T22:01:35+0100 homie/b361d0/button/button PRESSED
2019-01-10T22:01:35+0100 homie/b361d0/button/button RELEASED

```

Might still be a good idea to add debounce, though.

---

<div class="post-metadata">

**Author:** ![fischerman](https://community.openhab.org/letter_avatar_proxy/v4/letter/f/ee59a6/32.png) [@fischerman](https://community.openhab.org/u/fischerman)\
**Post date:** [January 10, 2019, 10:08pm UTC](https://community.openhab.org/t/mqtt-homie-trigger-channel-silent-after-reboot/63489/5 "2019-01-10T22:08:29Z")

</div>

Removing and recreating the Thing entirely solves the problem. Now, I have exactly one message per button press. But only until the next reboot. A reboot seems to consistently break the setup. Do I need to save something explicitly?

---

<div class="post-metadata">

**Author:** ![David\_Graeff](https://community.openhab.org/user_avatar/community.openhab.org/david_graeff/32/61322_2.png) [@David\_Graeff](https://community.openhab.org/u/David_Graeff)\
**Post date:** [January 10, 2019, 10:39pm UTC](https://community.openhab.org/t/mqtt-homie-trigger-channel-silent-after-reboot/63489/6 "2019-01-10T22:39:31Z")

</div>

> [@fischerman](#):
>
> Do I need to save something explicitly?

No. There seem to be a bug hidden somewhere. But without knowing your setup it’s hard to replicate.

---

<div class="post-metadata">

**Author:** ![fischerman](https://community.openhab.org/letter_avatar_proxy/v4/letter/f/ee59a6/32.png) [@fischerman](https://community.openhab.org/u/fischerman)\
**Post date:** [January 12, 2019, 12:16am UTC](https://community.openhab.org/t/mqtt-homie-trigger-channel-silent-after-reboot/63489/7 "2019-01-12T00:16:38Z")

</div>

I think the two issues (no toggle and too many toggles) are related. I can also reproduce the latter. Every time a Homie device goes offline and online again I get an additional log of a press (see above). I suspect that multiple handler run in parallel. And on boot no handler is started.

My setup is OpenHab 2.4.0 on Openhabian (Pi). I’ve created a single switch item and linked the button channel to the item. I’ve noticed in the logs, that on boot all links are recreated (not only mqtt):

```
2019-01-10 22:59:10.713 [temChannelLinkRemovedEvent] - Link 'Light => mqtt:homie300:f4feb5ec:b361d0:light#on' has been removed.
2019-01-10 22:59:10.716 [temChannelLinkRemovedEvent] - Link 'Light => mqtt:homie300:f4feb5ec:b361d0:button#button' has been removed.
2019-01-10 22:59:10.734 [temChannelLinkRemovedEvent] - Link 'Light => zwave:device:707546a4:node98:switch_binary' has been removed.
2019-01-10 22:59:10.740 [temChannelLinkRemovedEvent] - Link 'Light => mqtt:homie300:66080c3d:button#button' has been removed.
2019-01-10 23:00:37.647 [.ItemChannelLinkAddedEvent] - Link 'Light-mqtt:homie300:f4feb5ec:b361d0:light#on' has been added.
2019-01-10 23:00:37.655 [.ItemChannelLinkAddedEvent] - Link 'Light-zwave:device:707546a4:node98:switch_binary' has been added.
2019-01-10 23:00:37.660 [.ItemChannelLinkAddedEvent] - Link 'Light-mqtt:homie300:f4feb5ec:b361d0:button#button' has been added.
2019-01-10 23:00:37.664 [.ItemChannelLinkAddedEvent] - Link 'Light-mqtt:homie300:66080c3d:button#button' has been added.

```

Is this on purpose? Is there any other data that might be helpful?

---

<div class="post-metadata">

**Author:** ![fischerman](https://community.openhab.org/letter_avatar_proxy/v4/letter/f/ee59a6/32.png) [@fischerman](https://community.openhab.org/u/fischerman)\
**Post date:** [January 12, 2019, 3:20pm UTC](https://community.openhab.org/t/mqtt-homie-trigger-channel-silent-after-reboot/63489/8 "2019-01-12T15:20:08Z")

</div>

I also tried the embedded mqtt broker. Same behavior.

---

<div class="post-metadata">

**Author:** ![MrWendal](https://community.openhab.org/user_avatar/community.openhab.org/mrwendal/32/45080_2.png) [@MrWendal](https://community.openhab.org/u/MrWendal)\
**Post date:** [January 12, 2019, 9:44pm UTC](https://community.openhab.org/t/mqtt-homie-trigger-channel-silent-after-reboot/63489/9 "2019-01-12T21:44:00Z")

</div>

I’ve also just noticed missing Homie messages after restarting. There is an issue in SmartHome that sounds a lot like the same thing: [[MQTT-Binding / Homie]: No communication possible with Homie-Thing after restart · Issue #6828 · eclipse-archived/smarthome · GitHub](https://github.com/eclipse/smarthome/issues/6828).

---

<div class="post-metadata">

**Author:** ![mojo2600](https://community.openhab.org/user_avatar/community.openhab.org/mojo2600/32/37031_2.png) [@mojo2600](https://community.openhab.org/u/mojo2600)\
**Post date:** [May 3, 2019, 9:15am UTC](https://community.openhab.org/t/mqtt-homie-trigger-channel-silent-after-reboot/63489/10 "2019-05-03T09:15:43Z")

</div>

I have the exact same error and it has nothing to do with a button. I have a sensor which is constantly sending messages. When i add the thing, it is working. But if i restart openhab the connection is gone.

I figured it out, it is a bug in the mqtt implementation. It is already fixed. In the current Snapshot version it is already working.  
A workaround that was working for me: If you delete all retained messages from the broker (e.g. with mqtt explorer), the devices start working again until the next restart.
