-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Eclipse Smarthome Implementation #85
Comments
The first part sounds correct to me! No problem after all. Of course this is how the development of homie is anticipated (see #46). Regarding arrays I want to mention @marvinroger as I did never touch them and I know that he had some recent thought about them. |
It is official now: eclipse-archived/smarthome#5450 |
FYI: The implementation (except node instances/arrays, which I do not plan to do atm) is done. I have not yet performed any real tests, because I do not have a MQTT setup yet. If anybody else want to test the next days, please do so and report back in the linked eclipse smarthome issue. Cheers, |
:( |
Wait... what? |
The problem: It is not possible to subscribe to topics containing a "$". It is not the moquette broker, as I anticipated originally. It is worse. It's the antique paho Mqtt client library version that is used in ESH/Openhab. Unfortunately there is no new release since half a year, the last commit is even 9 months ago. The developer is apparently concentrating on the mqttv5 part of the library (which is incompatible, API and protocol wise). ESH is not homie convention compatible at the moment. |
Hi @davidgraeff! What Paho library version is used in ESH MQTT transport bundle? 1-2 years ago @gorootde started with the development of a Homie binding for openHAB, using the 1.1.0 version of Paho, and it works fine. Here you have a link to his repository: https://github.com/gorootde/openhab2-addons/tree/bindings/homie/addons/binding/org.openhab.binding.homie A have made some improvements to the binding for my personal use (not released yet, sorry, although I would like to extend your work in the Homie 3.X binding to support Homie 2.0.1 devices) and I didn't found any error subscribing to topics containing a "$" 😕 Is the library version being used older that 1.1? Many thanks for your work! Aitor |
It is the latest available release 1.2. If someone has the time to test the raw paho library that would be awesome. In ESH I'm using the Moquette server, the paho library and on top an abstraction layer. Any of those components or the composition could be the problem. |
Hi again @davidgraeff! I will try to make some test again using the 1.2.0 version of the library, but I'm pretty sure that it doesn't have any problem subscribing to topics with "$" 😞 What tests should I do? In the meantime, have you tried using one of the publicly available MQTT brokers? Eclipse has one at "tcp://iot.eclipse.org" (1883 or 8883) and HiveMQ also offers a public broker at "tcp://broker.hivemq.com:1883". |
I haven't found any restriction in the paho sources (https://github.com/eclipse/paho.mqtt.java/blob/master/org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/MqttTopic.java and some other files like MqttAsyncClient.java)? @davidgraeff are you sure your problem is on client side? Which server are you using? |
Hi! I've written a very simple client that subscribes to the topic "homie/homie_test/$online" in the "iot.eclipse.org" broker and everything seems to work fine. This is the 'stupid' code:
And here you have the execution output:
Nothing strange, so the problem must be somewhere else 🤔 |
I had the suspicion that Moquette is the culprit, but the command line mosquito client was able to publish and subscribe "$" topics. Example code of my test suite:
I'm publishing the default $homie topic as well as a more or less random utf8 topic.
Only the second test times out. Paho is not able to receive anything from Moquette for any "$" topic. |
Ummmm... I'm trying a local Moquette configuration and it's driving me nuts 😢 I have followed this steps (https://github.com/andsel/moquette#1-minute-set-up):
Then, I have published a retained message using the command line mosquitto client:
And I have attempted to read the message back with the mosquitto_sub command:
But I'm not able to receive the retained message! This is what the Mosquitto terminal tells me:
If I publish a new message while the mosquitto_sub client is connected, everything works fine, but retained messages are not delivered. However, the following commands work perfectly:
Can anyone verify this simple test? Do you confirm my results? @davidgraeff, what are your results using the "iot.eclipse.org" broker instead of the ESH embedded broker? PS: Perhaps we are getting too off-topic... |
Moquette only retains messages with QoS != 0. I've overlooked that and it took me some time. That's actually spec conform, the issue was closed on the moquette repository. One other note: I'm using paho in asynchronous mode. Might be a bug in that implementation. |
Wow, I didn't know that, many thanks for the hint David! Just for the sake of completeness, here you have a link where it was discussed in the Moquette repository: https://github.com/andsel/moquette/issues/125. It's strange because they seem to be the only ones doing it, although they fully conform to the specification. Anyway, now I'm not able to confirm your results, sorry. My test have been done using:
The small client is able to receive all messages published to the topic containing the "$", I can't see anything wrong 🤔
Do you want me to test anything in particular? 👍 |
Thanks a lot for investigating. Could you try the paho asynchronous API as well? Especially moquette and paho. That's the last piece. If it's not in there, it's related to the esh abstraction layer. What is also done in esh is: paho is configured to use persistence. Maybe the persistence layer has an issue with dollar sign topics. I'll investigate. |
Here I am again! New tests done with the Paho Async API, here you can see the client implementation (just in case someone wants to try it out):
And the output:
Nothing wrong, nothing suspicious, works fine. |
Thanks a lot. I have done my homework as well and analysed the abstraction layer, by adding a ton more test cases. And indeed the problem is that simple line: The dollar sign makes the regex expect the end of the string which results in no match. |
So the ESH MQTT transport layer needs to be fixed then? Do you know how to solve it? Let's hope that the future PR will be accepted as soon as possible 👍 Thanks for your work David! |
It is solved already with a PR that I will soon open. I need to finish work first. |
The MQTT with homie ESH implementation is done on my side now and is provided in 4 different PRs. Unfortunately I needed to redesign API of an existing class (API break). That may result in a longer discussion which can be followed here: eclipse-archived/smarthome#5535 |
Done. Can be closed. |
That's awesome. Thanks @davidgraeff and everyone involved. 👍 |
@davidgraeff wrote in #62 (comment):
The text was updated successfully, but these errors were encountered: