ESPHome help please, import value for HA and display it on LCD

Glad we got there (well @armin-gh did!)

I am as well, what I do not understand was why my template was not working. I suspect my “on state” may have needed to be something else?

my best guess is that the template doesn’t have a state change?
Did you try to put the automation into the sensor definition for the input_boolean from HA?
of course you have to disable the backlight handling in the lambda for the display temporarily


  - platform: homeassistant
    id: tank_backlight
    entity_id: input_boolean.esphome_backlight
    internal: false
          lambda: |-
            if (id(tank_backlight).state) {
            // Binary sensor is on
            } else {
            // Binary sensor is off


1 Like

Armin, I did not. I only tried it in a template. I have been “coding” for many years, but nothing as modern as C++, I have a lot to learn and I am still not sure at 60 if I really want to go there. Although it does not seem to bad as it is starting to make a tiny bit of sense to me. But, when I look at the guides it is very overwhelming. Way more than bash, perl or basic python.

I will try to work more on it later, now I need to add a temperature probe to the mix. It will be I2C as well. Then I can call this about done. I may convert to a 2004 display for a couple of extra lines.

Hi Matt
yes, quite a learning curve… but I think it is more about ESPHome than about C or C++, the lambdas are usually quite simple and only a few lines of code. Of course a simple syntax error might result in dozens of warnings and errors after ESPHome has done its magic and translated the YAML into C++.

Understanding where to put what in the YAML and finding the right samples was for me usually the challenge

The sample for the backlight in the documentation seems to be written for a pyhsical button via GPIO, publishing the state into the template, that does not translate easily into a binary sensor state sent by HA.

What helped me is to put some debug information into the code, you were using the attached display to show debug information but you can also print information to the debug log and watch with the webserver component, just put into the lambda
for numeric values:
ESP_LOGD("something","Tank 1 %.1fF", id(tank_temp).state));
for string values, with .c_str():
Same formatting as on it.print, you may also have multiple variables, just make sure to use the right pattern for the format and to have a matching number of variables.


I really appreciate your input and suggestions. I did end up placing the state of the binary sensor on the dispay and that is what clued me into part of the solution.

I am still missing how to tell HA that the esp is booted and can be used to trigger an automation?

That would be the status sensor

Thanks, will did into that!

I have had a very rocky start to ESPHome, maybe should have started with a smaller project or less complicated one. But, I tend to have a need and the find a way to fill it. I have built this unit with Tasmota, ESPEasy and ESPHome. Most of my time over the years has been spent with Tasmota on anything power related and ESPHome on any sensor system I have built. Displays on Tasmota feel like an after thought and on ESPEasy the work very well. ESPEasy is very configurable, but all MQTT based so a lot of config to build. I have been interested in ESPHome because it so tightly integrates with HA and honestly I am very impressed!

I have been running HA since the .2 days and have run on RPi, bare metal i5 (currently), docker and a couple of other methods over the years. At my age now (60), I am to the point I want it to just work and tight integrations make a world of difference to me. I do not have a lot of time to spend keeping it running properly with a 17yo in high school, a 21yo in junior college, a disabled wife and work. To that point, I tend to rely on the community for odd problems and help as someone has seen it before me… I hope!

I really do appreciate the community and do attempt to provide help where and when I can. So, thanks to all who responded here and provided wisdom and knowledge. I will make every attempt to learn more before my next ESPHome project.

What I have left on this one? I am adding an external I2C buss so that I can add thermal sensors for a second tank, and I will eventually add relay drivers and tank heaters without internal stats and backup heaters.