MQTT Hub/Gateway

Just thought I’d let you know I’m following along. Not sure what’s working yet but here’s what I see.
I get my devices discovered :smiley: , but the connection thing goes offline

Device did not send heartbeat in time

and with control I get a communication error

No connection or readOnly channel!

But looking very promising.

Yes, I noticed Homey is very busy in the startup phase (registering devices) and does sometimes not have enough time to respond to the heartbeat during this period. Restarting the Gateway app, resolves this problem most of the time.

FYI: Currently I’m working on handling color & enum values.

Just completed the implementation of the Homie Convention v3.0.1 for Homey v1.5.13.
I’ve got a fully working HABpanel with the ability to control all of my Homey devices (auto detected).

Next: Homey v2.0 & app settings

5 Likes

I have been waiting for something like this!

Looking very promising! :slight_smile:

That’s great - it seems there’s an issue with handling the heartbeats/timeouts in OpenHAB - I posted here and there’s a new update coming in a 2.5 nightly.

There might also still be an issue of whitespace inclusion in Homey node topic ID’s still. But it might not be a problem. I have topics with whitespace after the second text e.g. “kitchen-counter near”

Kevin

PS Do you intend to implement the (alternative much simpler/less capable) HomeAssistant MQTT discovery protocol too - as I think more people on here use that ?

I also noticed the heartbeat timeout is an openHab issue. The dashboard is working correctly even if the Homie MQTT device is stated offline.

Do you want to create GitHub issues for your findings?

HomeAssistant MQTT discovery wasn’t on my radar yet. Could be a nice addition. But let’s first create a ‘stable’ app for both Homey versions. Also a settings page is a must before the app can be published.

1 Like

Yes, you’re right to get to stable first.

I think a few will later apppreciate HomeAssistant support - and it’s way easier than homie3 .

I’ll raise GitHub issues. I don’t know why whitespace is not supported in the homie3 spec. Not sure how to do GitHub pull requests yet.

I can’t get two way control of devices because I constantly get timeouts and when I control anything I get read only on the set topic, so it is never published from openHAB. I have around 70 devices and the population through homie3 takes around 15 seconds.

Some topicsID’s have that whitespace issue although I quickly patched it out. I think openHAB is assigning defaults, specifically $settable = false to my nodes. They can’t be controlled through Paper UI.

The settable property is read from the Homey device capability.

Yes but it’s then published as a property via MQTT and openHAB assigns default values if it hasn’t received ALL the related node MQTT messages within 1.5 sec (I think) of homie protocol $state ‘init’ - so OH is missing this and defaulting it back to false unfortunately, … but it still shows true in MQTT of course. So OH thinks its not controllable.

I think this 1.5 secs is going to be eliminated in an upcoming OH 2.5 build and await $state ‘ready’ instead.

This is going to be great when it’s ready :grinning: thanks for the app !

I do not understand how to use this? Can some one help me?

It’s all experimental for now, but roughly follow these steps:

  1. Install an mqtt broker (Homey app/mosquito/HiveMQ, etc.)
  2. Install the BETA version of the MQTT Client app & connect to the broker
  3. Install the MQTT Gateway app from the GitHub ‘homie’ branch via the athom-cli (Homey v1.5.13 only).
  4. Install OpenHAB or any other application with the ability to communicate over mqtt (HASS, Node RED, mobile app, etc.) & configure the connection with your mqtt broker
  5. Add a ‘Homie MQTT device’ to your application and let it automatically discover the Homey devices and their capabilities. Or manually configure the MQTT communication channels (see the Homie Convention)
  6. Build your dashboard
1 Like

Thanks, i have updated to v2… so then i have to wait? The beta ver 2 app in store not working ?

Auto discovery (the Homie convention) is not yet implemented for Homie v2.0. you need some patience here…work in progress.

Custom Device communication is working for Homey v2.0 (beta channel, see app readme).

@Talzac Are you already using MQTT elsewhere in your setup, if so with what devices / applications ?

The existing v2 store (beta) release works fine, it’s just that there is a new ‘discovery’ protocol implemented in another branch of the GitHub implementing the ‘homie 3’ protocol. ‘Homie 3’ is not a ‘Homey’ specific thing - they’re unrelated just a similar name. AFAIK openHAB and the associated HABPanel application are the only mainstream applications that support this homie 3 protocol at the moment.

I’ve partially written a nodeRED flow that takes the homie 3 published discovery information and republishes it in the HomeAssistant discovery format - which means that the Homey devices are now auto discovered within HomeAssistant too. It then translates the control and status bi-directionally.

So far I’ve only done this for a couple of simple device types (on/off and dimmer) but if there’s interest I could map more. How many people would find this useful and also use HomeAssistant and nodeRED (and 1.5) ? It will become tidier later by obviating the need for nodeRED, when the HA discovery protocol might be implemented directly within MQTT Gateway. I may even look at how difficult that would be and submit a pull request.

I’ll post a screenshot over the next day or so … just as a teaser because you can then use the various HA dashboards too, in addition to the openHAB ones offered through homie 3

Kevin

1 Like

There’s also a rather interesting aspect of ‘auto creating’ or at least selectively allowing creation of Homey devices from MQTT … as virtual devices

1 Like

I’m updating my Homey to v2 (right now…fingers crossed!). Homie 3 for Homey v2 is next.

1 Like

Implementing HA discovery within the gateway app would be nice!

I’ve never done a GitHub pull before so it’ll be a learning experience for me. (I’m an electronics engineer with software embraced as an adjunct) . I’m just going to get this alternative nodeRED flow working as a temporary step. I’ll peruse your code this weekend though and see if I feel capable.

The HomeAssistant discovery protocol is really simple though - you only need to publish one message on a topic that effectively just ‘titles’ the device and tells HA what ‘type’ it is and then where the state and command information goes (i.e. the device’s topics). It’s nowhere near as complicated, or capable, as homie 3 although it does support using the original devices topic structure rather than requiring a device supports homie 3 - which is a good move for existing devices.

K

I’m not going to lie, some things rock your boat.
‘Home Assistent MQTT Auto Discovery’ of devices trough Mqtt-gateway into Virtual Devices in Homey is Affengeil