Connect an autonomous ESP8266 via url

Hello,
I’ve create an autonomous project with esp8266.
I want now add to home assistant the possibility to push url or get states from this esp8266.

The final idea is to have a connected controller of lights, working in hardware mode (physical button / detectors connected directly on the esp) and usable from Wifi (url to turn on/off lights, url to get states, and configurable pushed url on event ).
The important fact is that he must always work, even if wifi or home assistant is down, and of course no cloud based if possible.

The project is full working in solo mode ( wall wired button, presence detector, day/night luminosity detection, timing outputs ) , and with the integrated web interface.

I’m new in HA, so I’ve just create a button card with url action … it’s working for testing … but I need a more complex integration.

For each esp, I’ve 4 inputs and 4 outputs, so I need to be able to set on/off/timer for each output, and get states them.
Real situation example : The module drive 4 outdoor led projectors (separately). 2 PIR detectors drives 2 projectors each with timed function (left and right of my house). An interior wall button turn on/off all the 4 lights. Now, I want to have an HA dashboard with button to turn on/off all or single lights. I also want to have the possibility to interact with Alexa.

Is anyone have an idea for this integration in HA ?

Thanks

Integrates natively with Home Assistant. No REST calls needed.
You can do all the things you described with it.

If you already coded your project and/or don’t want to migrate it to esphome, the easiest path would probably be to use MQTT as a middle tier.

See MQTT discovery if you want your sensors / switches auto-discovered by HA

I’ve already try ESPhome, but not found how to integrate custom code to make it full autonomous.
With internal timers, and other logic.

Have you any example for that ?

Thanks

I think I need to try this.
Thanks.

With an esphome custom component, you can put any code of your liking.
The custom component follows the setup() / loop() logic, so it’s quite easy to migrate existing code.

https://esphome.io/custom/custom_component.html