ESPHome log into homeassistant logbook

How can the esphome sensor log the state information into the homeassistant log as any other device ?

Having a log every time an analogue value changed could flood the logbook so sensors with units are excluded from the logbook.

From the documents:

Use the History dashboard to view these sensors.

I have the same need. I wanted to log a BLE connection that should happen only on button press.

I was having a similari need. I had to Debug some automation i made inside a smart-plug and of course i could not keep the web interface open to view the log in realtime because the task i was working with is random. I found two solution. The first is to use the esphome cli to attach a logger and redirect the output to a file. Command Line Interface — ESPHome

The Second solution was to use syslog external component to send all the logs to a remote syslogd server. I already had one so it wasn’t a problem for me to use that.