MQTT Hub/Gateway

LOL! :joy:

1 Like

Yes @robertklep, you can laugh about it, but it’s serious matter! First we need to test it thoroughly before we can take it to production.

1 Like

I thought the Homey Manifesto was “Every User Is A Tester”? :stuck_out_tongue_winking_eye:

2 Likes

Hello HarriedeGroot,

I have started working on an application that runs anywhere, doesn’t rely on third party application and where you can create your logic in a flow manner, but kind of a mind map (like Visio flow chart with multiple triggers and multiple outputs).
The application is MQTT broker and client. It successfully receives MQTT messages from Homey. But how can I ask your app (with an MQTT message) to send all states (e.g. to get all devices with properties and states)?

Also, is there a way to get the available devices with states as a message (json object as payload with all info per device)?

  • Robert
1 Like

Did you take a look at Node RED?
You can receive all device info by implementing the Homie convention.
No need to ask the app for it, it will be retained on the broker at app startup.
I did not (yet) implement the commands to receive entity info (app, zone, device, capability, etc.).

Yes, I did take a look at Node-RED. However, you need too much to install (node.js, python etc etc), mosquitto… too much hassle for the ordinary user. Also, developing in Node-RED is for developers.
I want an application that is for everyone very, very easy to use.
Athom did make a good start with the flows concept, but the problem is that you need tons of flows. I would like the flow concept where you have a freem map (canvas), drop any trigger, condition and action card in and connect them.
All the stuff I have seen are more for developers rather then users (consumers).

I will have a look at https://homieiot.github.io/
thanks!
(didn’t see the command to get a list of all devices though. Will have a better look later)

Robert,

I wrote the nodeRED flow that bridges homie3 to the HA MQTT discovery protocol. There is no command to get all the information you need in one JSON payload.

What I did was to connect to the MQTT broker that MQTT-Hub is using and using a wildcard topic of homie/# retrieve the homie3 topic hierarchy and build such an object within nodeRED to reference it later. Any topic updates update the object, although I didn’t need that aspect. In your case you’ll have your own internal broker.

Please continue the discussion on your own thread.

Sorry Harrie … didn’t know there was another thread ! Off there now

Thank you for the reply xAPPO So, it means that to get all the devices in my app, I am forced to press BROADCAST’ in the MQTT Hub app? Also, after knowing the devices, I need to request the state of each device? The problem is after starting the app, when the Homey connects to the broker. The state of each device needs to be aligned. I am new to MQTT (as you might have guessed :wink: ). So maybe there is a standard for this which I don’t know about

(by the way, this is about the MQTT Hub app)

The beta version contains a bug which is already fixed in the ha branch. No need to press broadcast (anymore).

1 Like

Indeed… so I have been giving it a good bash and it’s looking promising. The ‘state’ reporting seems fixed now although an occasional unusual device still not supplying one e.g. buttons and some Sonos properties still.

Lots of entities propagated into HA now. HomeAssistant discovery really needs to provide a way to handle devices with multiple capabilities though as everything gets parts exploded into separate entities. e.g. a Sonos player becomes 10 different parts. I gather OH is much better in this regard.

The HA discovery protocol, or at least its topic structure doesn’t provide any way to handle devices with the same name but originating from different controllers (homie3 does).

Great progress though I think…

K

HarrideGroot,
Is it true that ‘BROADCAST’ button only broadcasts the meta information, but not the value of the properties itself? E.g. the onoff of a light doesn’t seem to be part of the message list.

Is this correct behaviour? Does this mean that after getting the $state=ready, we need to get the state of all devices ourselfs?

No that’s incorrect - all the states are reported too. But there was a bug (that Harrie mentioned above) in the app store version where sometimes this doesn’t happen. It does work as it should in the next release so just a temporary issue - or use the HA branch.

I am using the beta branch (otherwise it wouldn’t work with V2.0.2 I think)

But this is what I get for one device (don’t see if light is on (onoff state):

2019-02-17 17:23:05.7097|INFO|MTTQ Client Local => From=cf1f9e5633774820a101e4f26f1215e8 → Message: Topic=homie/lamp-eethoek/$type, Payload=light, QoS=AtMostOnce, Retain=False
2019-02-17 17:23:05.7270|INFO|MTTQ Client Local => From=cf1f9e5633774820a101e4f26f1215e8 → Message: Topic=homie/lamp-eethoek/$name, Payload=Lamp eethoek, QoS=AtMostOnce, Retain=False
2019-02-17 17:23:05.7270|INFO|MTTQ Client Local => From=cf1f9e5633774820a101e4f26f1215e8 → Message: Topic=homie/lamp-eethoek/$properties, Payload=onoff,dim, QoS=AtMostOnce, Retain=False
2019-02-17 17:23:05.7270|INFO|MTTQ Client Local => From=cf1f9e5633774820a101e4f26f1215e8 → Message: Topic=homie/lamp-eethoek/onoff/$name, Payload=Lamp eethoek - Aangezet, QoS=AtMostOnce, Retain=False
2019-02-17 17:23:05.7270|INFO|MTTQ Client Local => From=cf1f9e5633774820a101e4f26f1215e8 → Message: Topic=homie/lamp-eethoek/onoff/$retained, Payload=false, QoS=AtMostOnce, Retain=False
2019-02-17 17:23:05.7270|INFO|MTTQ Client Local => From=cf1f9e5633774820a101e4f26f1215e8 → Message: Topic=homie/lamp-eethoek/onoff/$settable, Payload=true, QoS=AtMostOnce, Retain=False
2019-02-17 17:23:05.7270|INFO|MTTQ Client Local => From=cf1f9e5633774820a101e4f26f1215e8 → Message: Topic=homie/lamp-eethoek/onoff/$datatype, Payload=boolean, QoS=AtMostOnce, Retain=False
2019-02-17 17:23:05.7410|INFO|MTTQ Client Local => From=cf1f9e5633774820a101e4f26f1215e8 → Message: Topic=homie/lamp-eethoek/dim/$name, Payload=Lamp eethoek - Dim niveau, QoS=AtMostOnce, Retain=False
2019-02-17 17:23:05.7410|INFO|MTTQ Client Local => From=cf1f9e5633774820a101e4f26f1215e8 → Message: Topic=homie/lamp-eethoek/dim/$retained, Payload=false, QoS=AtMostOnce, Retain=False
2019-02-17 17:23:05.7410|INFO|MTTQ Client Local => From=cf1f9e5633774820a101e4f26f1215e8 → Message: Topic=homie/lamp-eethoek/dim/$settable, Payload=true, QoS=AtMostOnce, Retain=False
2019-02-17 17:23:05.7410|INFO|MTTQ Client Local => From=cf1f9e5633774820a101e4f26f1215e8 → Message: Topic=homie/lamp-eethoek/dim/$unit, Payload=%, QoS=AtMostOnce, Retain=False
2019-02-17 17:23:05.7410|INFO|MTTQ Client Local => From=cf1f9e5633774820a101e4f26f1215e8 → Message: Topic=homie/lamp-eethoek/dim/$datatype, Payload=float, QoS=AtMostOnce, Retain=False
2019-02-17 17:23:05.7410|INFO|MTTQ Client Local => From=cf1f9e5633774820a101e4f26f1215e8 → Message: Topic=homie/lamp-eethoek/dim/$format, Payload=0:1, QoS=AtMostOnce, Retain=False

You need to use the HA branch from GitHub … not the beta branch in the app store
https://github.com/harriedegroot/nl.hdg.mqtt/tree/ha

1 Like

@RobertP Try MQTT Explorer to get a nice overview of all the available topics and payloads.

1 Like

Ah, ok, thought only the broadcast itself was missing, but I guess it isn’t complete either.
No proble, I will wait for the new beta. I have enough to do without me being blocked by this issue

HA Discovery is working perfect with lights.

1 Like

@Viktor Light temperature isn’t working yet…