Christian-Me / node-red-contrib-homie-convention

Node-RED node for MQTT communication according the Homie Convention
Apache License 2.0
13 stars 2 forks source link

Broker connection password issue (repeated log error messages) #4

Closed xAPPO closed 4 years ago

xAPPO commented 4 years ago

I can't get an MQTT broker connection with password/username. I know these are correct. Without pw/un authentication it does work. Not using SSL. I tried two different mosquitto brokers both with different credentials. I am sure this must be working though. I set up different 'Device Name's which I think is what you use for clientID as I know those must be unique.

FTTB I have disabled username/password authorisation on the broker and it connects immediately

image

18/12/2019, 04:16:38 msg : string[90] "contrib-homie-convention homie.device.config: MQTT client error (mqtt://192.168.1.78:1883)"

Christian-Me commented 4 years ago

I think this is a known issue (see issue before) The node don’t save the credentials correctly) I have to push the fix to npm. I think I can do this today). If you don’t whant to wait you can use the github version. Thank you for posting this issue.

xAPPO commented 4 years ago

OK great. I didn’t read the previous issues as they are ‘closed’ I took this to mean resolved in the npm version , rather than just resolved in github. Maybe issues could stay open with a comment ‘fixed on github’, and then closed when npm is updated ?

I’m looking forward to testing this out. I might have some thoughts on restricting a node to just one homie device at a time, as I have a few devices using homie each with hundreds of nodes. I.e allowing a subscription one level deeper. homie/device/#

Christian-Me commented 4 years ago

Sorry for the inconvenience.

Should be on npm now and soon @ Node-RED flow library.

A device with hundrets of nodes, this sound interesting and will perhaps push the node (and perhaps Node-RED) to it's limits. I only think about the dropdown list for selecting the Nodes with hundreds of entries and in the tree view then multiplied by 5 or more child entries.

A limitation has to take place in the broker config (having one for each device with a "custom" subscription string. That should be a quite easy task, only allowing the root topic textbox default "homie" to be expanded to "homie/device".

The worst case scenario in the ui. The lists are sent to the front end "pre-selected", means only useful information is sent. I have to check if there are any unnecessary redraws, retransmits. The $nodes string would then be quite long, it is spitted in an array quite early and I will have to check to limit this process. It should only happen once when the log message "device detected ... has X nodes). A limitation will perhaps "only" helps during start/restart of the flow.

Let me know A) if the new version works and B) if your need only further help. Quite curios what the hundreds of nodes are ;) More than happy to do the modification for you.

Chris

xAPPO commented 4 years ago

Lots of topics... but only 10 homie devices (on this broker) image

image

Another broker with 8 devices but a couple of big ones image

image

As the device level topic has the $nodes payload subscribing with a filter below that couldn't work, so device level is all that could be achieved.

I'll update you on the new version..

Christian-Me commented 4 years ago

As mentioned before I’m more than happy to help. Let’s see what the results of your test will show

xAPPO commented 4 years ago

The password fix works thanks. The first devices dropdown only lists 6 devices though. I have 10 and counting. Also 3 of those 6 aren't actually devices in the /homie tree - they are topics taken from elsewhere , not homie/. The below screen capture is using the broker pictured above with the 10 homie devices. You can see one device listed (homey-582...) is from a previous higher level topic outside of /homie showing in the screenshot above.. all the Homey-xxx devices don't exist in the /homie tree

I am also seeing some device validation errors - so that maybe is contributing .. I will try and work out where those are coming from so this may not be an 'issue' as such - no detail of the error is provided which if available would be a help. I have likely created some 'not to spec' homie topics.

My other broker node with 7 devices displays correctly. I deleted and recreated the problem one but still the same. I can give you a guest access (read only) to this broker to test if you want.

image

[UPDATE] I'll leave this as an issue but I should have opened a second one I think (if there IS an issue) in the meantime I have found your Discourse support thread and it's more appropriate that I continue there. I want to check my homie structures to try and eliminate the validation warning - if the validation error message could provide more detailed info that would be very helpful.