Skip to content
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

Change websocket port #1

Open
ben-digitalhive opened this issue May 29, 2021 · 3 comments
Open

Change websocket port #1

ben-digitalhive opened this issue May 29, 2021 · 3 comments

Comments

@ben-digitalhive
Copy link

Hello I have installed your addon in Webthings Gateway and I am assumming I can then use this to publish events to my broker? However it seems to have a hardcoded websocket port of 8080 - is this correct? How can I change this for my particular purposes?

@bewee
Copy link
Owner

bewee commented May 29, 2021

Hi @ben-digitalhive,

Exactly. With this addon, things and co will publish events to your broker.

Please have a look at the README. It describes the setup process, including how to change the URL (which contains the port). The default port is btw 1883. Also, please don't forget to create a local authorization token and give it to the addon, because else it cannot interact with your things :)

Fyi, I also wrote an addon which allows you to run an MQTT broker from within your gateway: mqtt-broker-extension

@ben-digitalhive
Copy link
Author

ben-digitalhive commented May 29, 2021

Hi - Thanks for the response. Yes I understand the intent of the addon now and have successfully had it connected to my Home Assistant. Data is flowing - great work!

However what tripped me up when I was playing with this initially and it wasnt working was that it seems to have a hard-coded requirement for port 8080 even though I have specified 1883. The errors in the log look like this:

2021-05-29 01:01:22.236 INFO : mqtt-bridge: Loading add-on mqtt-bridge from /home/pi/.webthings/addons/mqtt-bridge
2021-05-29 01:01:24.179 INFO : mqtt-bridge: Probing port 8080
2021-05-29 01:01:24.369 INFO : mqtt-bridge: MQTT connected
2021-05-29 01:01:24.441 INFO : mqtt-bridge: WebthingsClient lost. Reconnecting in 1 second
2021-05-29 01:01:25.444 INFO : mqtt-bridge: Probing port 8080
2021-05-29 01:01:25.479 INFO : mqtt-bridge: WebthingsClient lost. Reconnecting in 1 second
2021-05-29 01:01:26.480 INFO : mqtt-bridge: Probing port 8080

.....

Compared to an MQTT broker that has both 1883 and 8080 exposed looks like this:

2021-05-29 01:03:17.527 INFO : mqtt-bridge: Loading add-on mqtt-bridge from /home/pi/.webthings/addons/mqtt-bridge
2021-05-29 01:03:17.903 INFO : mqtt-bridge: Probing port 8080
2021-05-29 01:03:18.070 INFO : mqtt-bridge: MQTT connected
2021-05-29 01:03:18.254 INFO : mqtt-bridge: zb-00158d0004876bbf : Subscribed to all events
2021-05-29 01:03:18.267 INFO : mqtt-bridge: zb-00158d0004876bbf : Subscribed to MQTT
2021-05-29 01:03:18.270 INFO : mqtt-bridge: zb-00158d0004876b54 : Subscribed to all events
2021-05-29 01:03:18.274 INFO : mqtt-bridge: zb-00158d0004876b54 : Subscribed to MQTT
2021-05-29 01:03:18.276 INFO : mqtt-bridge: zb-00158d0003539a52 : Subscribed to all events
2021-05-29 01:03:18.277 INFO : mqtt-bridge: zb-00158d0003539a52 : Subscribed to MQTT

@bewee
Copy link
Owner

bewee commented May 30, 2021

Hi @ben-digitalhive,

you're right, there is a somewhat hardcoded dependency for port 8080. It's required because that's where the webthings gateway (by default) provides the interface to interact with its things. I do agree that the log messages you posted above don't make this really clear, and I also think that it would be better to make the webthings port a configurable option as well. Feel free to open a PR improving this behavior if you want to :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants