LAB02-Research / HASS.Agent

Windows-based client for Home Assistant. Provides notifications, quick actions, commands, sensors and more.
https://hassagent.lab02-research.org
MIT License
1.54k stars 67 forks source link

Feature: Mqtt over WebSocket #244

Open Eweol opened 1 year ago

Eweol commented 1 year ago

Hi guyes,

Thanks for that project. I try to replace my old iot-link stuff with this project but I currently face an issue with mqtt.

So far I connected to my MQTT-Server over WebSocket, because I can handle that with help of my Traefik instances like an http protocol. The MQTT protocol needs to be handled seperatly via tcp.

My Question is, if you plan to support mqtt over websocket as well.

BR

LAB02-Admin commented 1 year ago

Yep! On my todo list: https://lab02research.youtrack.cloud/issue/hassagent-160

mcsrobert commented 1 year ago

I would very much second this request. My use case is slightly different, but generally similar.

I'm migrating to use the Nginx Proxy Manager add-on in HA. Ideally it would be the only place where I renew my Let's Encrypt cert, which means that I would need to use WS to setup a reverse proxy to MQTT.

NightcoreIsla commented 1 year ago

I hope this feature implemented too, without MQTT over WebSocket would not be able to let all wan IOT/Server Connect behind reverse proxy/Cloudflare protection.

I watch out for this line of MQTT connect https://github.com/LAB02-Research/HASS.Agent/blob/c859e6e98deb81d84d8c3098444cbea9098c4e44/src/HASS.Agent/MQTT/MqttManager.cs#L623

Will any connection problem happen if we add a checkbox option and then change the line to ".WithWebSocketServer" Instead of ".WithTcpServer"?

I didn't try compiling once by that idea, or maybe the author already tried and got a problem with this?

NightcoreIsla commented 1 year ago

I hope this feature implemented too, without MQTT over WebSocket would not be able to let all wan IOT/Server Connect behind reverse proxy/Cloudflare protection.

I watch out for this line of MQTT connect

https://github.com/LAB02-Research/HASS.Agent/blob/c859e6e98deb81d84d8c3098444cbea9098c4e44/src/HASS.Agent/MQTT/MqttManager.cs#L623

Will any connection problem happen if we add a checkbox option and then change the line to ".WithWebSocketServer" Instead of ".WithTcpServer"?

I didn't try compiling once by that idea, or maybe the author already tried and got a problem with this?

just now, I replaced the line, and connected successfully with Cloudflare and Nginx proxy manager addon, main feature worked fine, maybe get a few rest days from work I can do more testing and write GUI for this, then create a fork with a merge request...?

pdsccode commented 10 months ago

Any update on this topic? I too have my Home Assistant behind a reverse proxy (nginx) and would like to use HASS.Agent. Although I am experienced enough to compile the app myself and change some code, I do prefer to use a precompiled official version for day-to-day use.