Hello to all,
I have a pcf8574-based LCD character display attached via the I2C bus to an ESP32 using ESPHome 1.18.0. I have defined some sensors of the kind:
binary_sensor:
- platform: gpio
name: "Valve #1"
id: gwv_sensor_1
device_class: power
pin:
mcp23xxx: mcp23017_hub
# Use pin number A7
number: 7
# One of INPUT or OUTPUT
mode: INPUT
inverted: True
The display has been initialized as:
display:
- platform: lcd_pcf8574
dimensions: 20x4
address: 0x27
id: my_lcd_display
lambda: |-
it.strftime(0,0,"%d/%m/%Y %H:%M", id(homeassistant_time).now());
it.printf(0,3,"Bypass:%s",id(bypass_switch).state ? "ON" : "OFF");
The first line of the LCD display is populated by the HA time and the 3rd line by the state of a predefined switch (bypass_switch).
I tried to add the following lamda to the binary sensor, so that it displays the corresponding sensor value ONLY when the sensor’s state has been changed for a fixed amount of time:
on_state:
then:
- lambda: |-
id(my_lcd_display).printf(0,2,"VLV1:%s",id(gwv_sensor_1).state ? "ON" : "OFF");
However, nothing is displayed on the screen. I assume that any directives for displaying text on the LCD screen should be entered within the display: component.
Has anyone got a clue how to achieve the required functionality?
Furthermore, when the LCD screen configuration is added to ESPHome, the ESP32 log is flooded with:
[18:57:17][V][app:081]: A component took a long time in a loop() cycle (0.26 s).
[18:57:17][V][app:082]: Components should block for at most 20-30ms in loop().
[18:57:18][V][app:081]: A component took a long time in a loop() cycle (0.26 s).
[18:57:18][V][app:082]: Components should block for at most 20-30ms in loop().
[18:57:19][V][app:081]: A component took a long time in a loop() cycle (0.26 s).
Any ideas on that as well?
Thank you!