ESPHome Text Sensor does not get updated with Input_Text Helper from HA

ESPHome is really fun to play around, but as much fun it is, the faster you hitting a imaginary dead end :wink: but I know you are here to help - so this is another ESPHome mystery I could not solve with “search”

I created an input_text helper in HA. (screenshot below)
I populated some data to it using the “Dev Tools” (screenshot below)

I created a ESPHome Config with a display attached and static text works fine, also reading any other “sensor” also works but reading from the “input_text Helper” results in nothing. As you als can see in the screenshot looking at the sensor.notification_display which is pushed by the ESPHome Device.

I am struggling to figure out why the data is not getting pulled by the ESPHome device, or more specific, why only this helper sensor is not getting pulled.

Thanks

esphome:
  name: $devicename
  platform: ESP8266
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:

# Sync Time with Home Assistant
time:
  - platform: homeassistant
    id: homeassistant_time
    
ota:
  password: !secret ota_password

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "${upper_devicename}"
    password: !secret wifi_ap_password

captive_portal:

# Enable Web server
web_server:
  port: 80
  auth:
    username: admin
    password: !secret web_server_password
    
i2c:
  sda: GPIO0
  scl: GPIO2

display:
  - platform: lcd_pcf8574
    dimensions: 16x2
    address: 0x27
    lambda: |-
      //it.printf(id(notification_display).state.c_str());
      it.printf(0, 0, "Data: %s", id(notification_display).state.c_str());
      
text_sensor:
  - platform: version
    name: "${upper_devicename} Version"
    hide_timestamp: true
  - platform: wifi_info
    ip_address:
      name: "${upper_devicename} IP"
      icon: mdi:ip-network
    mac_address:
      name: "${upper_devicename} MAC"
      icon: mdi:network
  - platform: homeassistant
    name: "Notification Display"
    id: notification_display
    entity_id: input_text.notification_display
    attribute: state

grafik

Reference Posts

I created an input boolean that I switched on then off when input text changes.

The reason that the display timed for 1 minute is because the display is usually a clock, and the boolean is called news because I have an RSS feed from the BBC that I send to the input text

You also have to create input_boolean.news or whatever you are going to name it in HA.

I’m convinced there must be an easier way, but this works fine for me.

- action:
  - delay: 00:00:01
  - service: input_boolean.turn_on
    entity_id: input_boolean.news
  - delay: 00:00:05
  - service: input_boolean.turn_off
    entity_id: input_boolean.news
  alias: New Message
  id: '2514545568142'
  trigger:
  - platform: state
    entity_id: input_text.new_message

Then we have this in ESPhome

text_sensor:
  - platform: homeassistant
    id: new_message
    entity_id: input_text.new_message
    internal: true

binary_sensor:
  - platform: homeassistant
    entity_id: input_boolean.news
    id: news
    internal: true
    on_press:
        then:
        - lambda: |-
            id(news_bool) = true;
        - delay: 00:01:00
        - lambda: |-
            id(news_bool) = false;


display:
  - platform: max7219digit
    cs_pin: GPIO21
    id: my_matrix
    num_chips: 8
    lambda: |-
      if (id(news_bool)) {
        it.printf(0, 0, id(digitss_font), "%s", id(new_message).state.c_str());
        it.scroll(true,1,30,2000,2000);
        it.invert_on_off(0);
      }

I hope I’ve covered it all.

Thanks, I will try that solution.

But my main problem is that the text sensor is not getting any information from the input_text helper. Whereas if I use the same text sensor but another existinge sensor from HA it works.
So something is weird with the combination of my input_text helper and the sync to the text sensor on esphome.

State is not an attribute.

1 Like

Thanks @nickrout I think this did the trick :slight_smile: and it makes somehow sense, also why I did not get an error :smiley:
Anyhow, after removing the attribute and also deleting the esphome device from integration and adding it again it “magically” works :smiley:
THANKS

This is the working code not

substitutions:
  devicename: "testing"
  upper_devicename: "Testing"
  
esphome:
  name: $devicename
  platform: ESP8266
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:

# Sync Time with Home Assistant
time:
  - platform: homeassistant
    id: homeassistant_time
    
ota:
  password: !secret ota_password

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "${upper_devicename}"
    password: !secret wifi_ap_password

captive_portal:
    
i2c:
  sda: GPIO0
  scl: GPIO2

display:
  - platform: lcd_pcf8574
    dimensions: 16x2
    address: 0x27
    lambda: |-
      //it.printf(id(notification_display).state.c_str());
      it.printf(0, 0, "Data: %s", id(notification_display_l1).state.c_str());
      it.printf(0, 1, "Data: %s", id(notification_display_l2).state.c_str());

text_sensor:
  - platform: homeassistant
    name: "Notification Display L1"
    id: notification_display_l1
    entity_id: input_text.notification_display_l1
  - platform: homeassistant
    name: "Notification Display L2"
    id: notification_display_l2
    entity_id: input_text.notification_display_l2
1 Like