How to integrate a finished project into ESP Home

Hi,
I’ve got an allready working ESP32 project I would like to integrate in my Home Assistant.
It consists of an LCD a few buttons, encoders, pwm-outputs, a RTC.
I developed a menu and a logic to chance settings via that menu.
A logic is then switching a dimming lights acourding to those settings.

I would like to leave my logic untouched so it can function independent from ESP Home and Home Asisstant.

I would like to be able to see the status of my lights and the dimm level, switch the lights and change the settings.

Basicly I’v got a instance of a struct containing my settings by which my logic is switching and dimming lights and I would like to display and change those settings via Home Assistant.

I was looking at

to see how I would creat my own component, but the documentaion is some what poor. Of course I was looking at the code of some components, but it isn’t very clear to me how I would create a component including a dozen files.

This is a good example for why in software engineering it is important to think about requirements and use cases first :slight_smile: However I don’t know your whole story and maybe your existing logic has been working for years.

Anyhow, my question would be whether you are indeed interested to use ESPHome or if you actually just want to integrate your device in Home Assistant. In the latter case, I would suggest to simply add mqtt to your code. It is rather simple to add to existing logic and will enable you to publish data and receive commands.

ESPHome works stand alone and doesn’t require Home Assistant.
However, it can use an API to communicate directly with Home Assistant, so all data used by the esp can be accessed by HA and vise versa :wink:

So I agree with @ThomDietrich, you should have used esphome to start with :thinking:

Or (!) just don’t rely on it :slight_smile: If @RFDarter already has his own ways of managing wifi and sensors etc, there is really no need to go to ESPHome for help. Just mix in basic mqtt pub/sub and define mqtt template sensors in HA. Easy peasy.

And if I may add: I’ve transitioned to be a very happy ESPHome user over the last couple of years. Furthermore, I have two-three microcontrollers running my own code as legacy devices in my network.

If I had the time I would re-implement those in ESPHome. In the long-run devices with an ESPHome based firmware are much easier to develop, onboard, maintain, and enhance.

So if at all reasonable, take the time and the learnings you made and re-implement everything you have in ESPHome. Caution, it might be devastating to learn just how easy that is :smiley:

Use external components. It will give your app the full power of all of ESPHome. Very versatile. A bit of a learning curve but once you have it setup, very easy to maintain. You can then use whatever components including your own and customize them to your own needs. Add features that Esphome does not have. Esphome can be used standalone, or with other infrastructures if you use mqtt or add a web component with the included api. It is wayy easier then the old Arduino platform where you would need to include and source your own libraries. Esphome takes care of that with platformio in the background.

Hi, thanks for your replies.
I am a few hours into some tutorial videos on esp home now and I can say i quite underestimated it.

I spent hours developting a menu for an LCD and just found out it could have been done in a few minutes unsing esp home.

I guess I’m going to redo my projekt with esphome.

What would be a good way to store my 3 time of day variables?
Multible number components?
I haven’t found a time picker input so I guess the closest thing to that would be using 2 select components, one for the hour and one for the minutes.
And then combining those values and store them in my number component?

To check if the lights should be switched on I would use an on_time event triggered every second to compare the current time to my stored one?