Open deanfourie1 opened 1 year ago
bump
This would be amazing. Imagine if you could have an URL entry in your YAML pointing to your external home assistance instance. PLEASE DO THIS.
ESPHome Cloudflare tunnel.
As described in a similar request this the challenge is that the ESPHome device is the server not the HA so the ESPHome device would need to setup the tunnel not the other way around. to be able to expose the ESPHome device you would need it to run the cloudflared tunnel code on the ESP and then create a new DNS endpoint. You would then need to point your home assistant server at the new end point.1) I am not sure that the ESP32 is powerfull enough to run that code and 2) A solution for remote and encrypted communication already exists, if you want to do remote ESP home devices it would be best to use encrypted/authenticated MQTT that is pointed at a public MQTT broker then connect your HA instance to liten to that MQTT server, this still solve the "anywhere" challenge of deploying an ESPHome device with components that are already in place.
Yes but in order to setup remote MQTT you will need to have MQTT port open server side.
This is not possible for those behind CGNat.
The idea of the esp32 creating the tunnel is seemless,
It executes the connection and creates the tunnel,
The the cloudflare routing handles the rest, routing between other tunnels etc to reach the HA instance.
This is what would make this integration so awesome.
In this architecture you would use a public MQTT broker like hivemq, You would connect both the endpoint of the ESP and the HA server to it. Then it will do MQTT message exchange without ether device being public. I am not proposing that you make your HA server public
Cloudflared is "public" too... They do see inside your tunnels...
I manage to expose my MQTT broker through the cloudflared tunnel, but only MQTT over WebSocket, which is not possible to use with ESPHome… so implementing MQTT over WebSocket in ESPHome could be a palliative to be able to use remote ESPHome devices even being in a CGNAT network (where it is not possible to expose ports) and not needing to depend on public brokers.
This would be amazing.
Dead thread; but did this ever come to life? Anyone find a way?
Nah, sad :(
I manage to expose my MQTT broker through the cloudflared tunnel, but only MQTT over WebSocket, which is not possible to use with ESPHome… so implementing MQTT over WebSocket in ESPHome could be a palliative to be able to use remote ESPHome devices even being in a CGNAT network (where it is not possible to expose ports) and not needing to depend on public brokers.
Yes, I did the same. Support of WebSocket transport is the missing component and would be the excellent solution.
But seriously, how hard could it be? I don't see it requiring a lot of resources on the esp to make this feature possible.
Cloudflare have all docs available for API. Just need some smart cookie to make it happen ;)
Would love to see integration for the ESPhome project and ESP32 to support the possiblity to connect to a cloudflared tunnel. Not sure how possible this is to achieve, but I have a use case scenario where I want to use a ESP32 to connect and send MQTT over WAN on a different network / 4G, but cannot open port due to CGNat.
Allowing ESPhome to connect the ESP to a cloudflared tunnel would be pretty awesome!