Esphomelib - library to greatly simplify Home Assistant integration with ESP32

Tags: #<Tag:0x00007f2041c645b8> #<Tag:0x00007f2041c641d0>


Yeah it’s more of a luxury than anything. I’ll probably spend a little more time but if I don’t figure it out I’ll happily resort to local access only. It’s more just trying to scratch that itch now hehe… thanks for the follow up. :+1:t3:


Yeah so putting it into a subdirectory won’t work. I have no idea how you even got that to work with the other services, but usually in the HTTP services world it’s quite hard to put services in subdirectories.

The reason your solution isn’t working is because ESPHome redirects to /login on the first visit, which of course then doesn’t get redirected by nginx again to the proper location. The same will be for all static resources as they use absolute URLs as well.

The usual solution to this (that I’ve also used many times before) is using subdomains. For example and etc. It’s not hard to do with nginx and will make way less trouble with most services.

Also, I don’t know of a reason why you wouldn’t want to open up another port on your router. Having the nginx proxy in front of ESPHome doesn’t magically make things safer (because the ESPHome addon uses nginx internally too).


it makes things saver if you use just 1 proxy server and all other stuff behind it.
and normally also easier, because you can connect locally behind that proxy without ssl.

thanks for pointing out the subdomain option. didnt think of that.



Will the additional ports open get the same security level as the default 443?


that depends on your settings in nginx. if you configure that right they will.
although i must say that port 443 on its own has no security at all when you dont create the security.


Hi There,

Just want to say that I follow this topic because in my case I also prefer to setup a solution with sub directories instead of port for every services. My reason for this is also to avoid to create a new port redirection for every service.
I also would like to avoid to create one sub domaine for every services.
And the last but not the least is because from office the externals ports are open on request and then no way to get these ports open to access my personal home assistant.

So me too I’m looking for this solution.


like i said to @talondnb, you will find out that its a pain in the but, to use sub directories.
Otto already stated that ist hard( if not impossible) to do things on the serverside.
so your gonna have to figure out everything that is needed to be redirected and find a way to get it through nginx. its not impossible, but it can take you days to figure out how to do it all with the nginx settings.
and the downside is that an update from the server can throw everything out of order.

you dont need to open ports on the office. only at home. unless you want to reach the office from the outside.

the subdomain solution is not much different then the subdirectory, but you avoid a lot of trouble.

but whatever you do decide, remember that its very risky to open the settings from your homeautomation to the world.
its bad when people can flip a switch when you got a breach,
but its way worse when people can change your alarmcode, or redirect your camera, or change when your heater will go off.


Here I speak about outgoing ports. From the office network if I want to go to for example http_://mydomain:4444/ then I sall ask IT to open outgoing trafic to 4444.

Yes and maybe I’ll go this way. But for the moment I fear this solution need more changes in different locations (eg: Certbot, I using let’s encrypt).

This is true for all solution and then also the sub domaine one.


no if you use your browser to go to http_://mydomain:4444/ it goes through the port that they did set fot http traffic. if what you say was true, then your mobile internet provider also needs to open port 4444 when you want to use that :wink: the port you specify in the url has only to do with the port from the server you try to reach (your home)

nope, you can still use 1 lets encrypt. you just need to change the NGINX settings.

(and please for others that want to talk about this subject, lets not do it in this topic, but open a new topic and/or PM me)


To be clear: It is definitely possible to add such an option, and it probably wouldn’t be that much work either. But, as you can see in the issue/feature trackers, there’s approximately a million other things that I’m working on, and this is quite low priority for me tbh.

Also, I would like to add that I do not guarantee that the ESPHome dashboard is 100% safe. There might well be some issue that allows remote access - and with remote access you can control the ESPs which would give an attacker RCE plus the ability to sniff WiFi packets. So, also as a general rule, I would recommend only opening up apps if you really need them to be public.

Yes, subdomains might be a bit more setup with letsencrypt, but it’s not hard. letsencrypt gives out certificates that cover all subdomains too (by default I think even).

For further discussion, please open an issue here:


Why the restore mode is not available for the output component?

I have setup the relay on a Dual R2, one relay controls a set of lights, so i would like to expose it to ha via light domain. I tried to setup then a switch and outputto the same pin and the restore state (ALWAYS ON) to the switch. When reboot happens or after mains down and up the relay comes on then off.
If i take the output light then it works ok.

Also the switch and light entities shown in the integration are not in sync when toggled one or the other.


@subzero79 Because outputs shouldn’t restore state - the frontend component that controls them (here light) should do so. If you really want the relay to show up as a light in HA plus you want to control the restore mode, make the relay a switch on the ESPHome side, and use the light.switch platform in HA to convert it to a light.


Hi… I’m new in ESP32… I bought a m5stack camera, but I don’t know how to connect it to my WiFi network… (sorry if is a newbie question…). Do I need to install a software to do this?
I installed the Hassio addon, but I can’t install the firmware.

Anyone could help me with this? Thanks in advance!!


@matiasaul ESP32 camera is not supported (yet)


It looks like something worth of support, so good to see the (yet) at the end of your post!


Hi Otto
Is it possible to use a servo?
Iwould like to use it as an “analog display” or gauge for temperature, an arrow glued to the servo.
The idea is to make an interface for the home assistant thermostat with gauges and potentiometers.


I see a stepper component, perhaps that would work?


I think it won’t work with stepper because you can not give absolute positions, only stamps at the time


I think a servo would be a great addition to the available deices then.

Your overall idea seems wonderfully retro, almost steampunk.


A servo is just PWM with 50Hz, for example