Help needed: Sensor not available

Hi, I want to have a sensor with a status text which changes with an automation.

My sensor is defined in templates.yaml

      - name: "Lüftungsstatus Kind"
        unique_id: "lft_kind_status"
        state: "OK"

and it shows up in Settings → Entities with status “OK”.

I have created an automation which will execute to the end when I look at “traces”.

alias: Lüften Kind
trigger:
  - platform: time_pattern
    minutes: /15
action:
  - choose:
      - conditions:
          - condition: numeric_state
            entity_id: sensor.htp_kind_luftfeuchtigkeit
            below: 60
        sequence:
          - service: input_text.set_value
            data:
              entity_id: sensor.luftungsstatus_kind
              value: OK
      - conditions:
          - condition: numeric_state
            entity_id: sensor.differenz_abs_lf_kind
            below: 0
        sequence:
          - service: input_text.set_value
            data:
              value: Schließen
            target:
              entity_id: sensor.luftungsstatus_kind
      - conditions:
          - condition: numeric_state
            entity_id: sensor.differenz_abs_lf_kind
            above: 0
            below: 1
        sequence:
          - service: input_text.set_value
            data:
              value: OK
            target:
              entity_id: sensor.luftungsstatus_kind
      - conditions:
          - condition: numeric_state
            entity_id: sensor.differenz_abs_lf_kind
            above: 1
        sequence:
          - service: input_text.set_value
            data:
              value: Öffnen
            target:
              entity_id: sensor.luftungsstatus_kind

But although the entity shows as available in the entities page and in the autmations editor, as a result I get this error:

 Logger: homeassistant.helpers.service
Source: helpers/service.py:246
First occurred: 3. Februar 2024 um 11:45:00 (189 occurrences)
Last logged: 10:15:00

    Referenced entities sensor.luftungsstatus_kind are missing or not currently available

What am I doing wrong? And why is my sensor’s entity name different from what I set as unique_id? Might this be the problem?

A input_text entity starts with ‘input_text’ and not sensor…do check your entities in developer tools > states as I cannot see from above how/what you defined

1 Like

Thanks.
What I am trying to achieve is that I want to display a status text only without the possibility to enter text, but I find the text sensors rather confusing…

The sensor has been defined as described above:

     - name: "Lüftungsstatus Kind"
        unique_id: "lft_kind_status"
        state: "OK"

You can easily define them via settings > devices/helpers instead of yaml, then you also make less mistakes and again…if you defined a input_text sensor, which is not clear also from your reply, then it starts with input_text, not sensor

Input Text - Home Assistant (home-assistant.io)

2 Likes

Understood. Read that referenced help page more than once. I already went with that before and indeed it worked, but when I display an input_text entity on my dashboard where the text will appear in an input field, obviously. I do not want that, I just want to display plain text on my dashboard (state of the text entity, obviously) without the possibility to enter/edit something and this is where I fail. If I define a text helper entity and use input_text I am back to where I dont wanna be :wink:

What was not clear from my reply? Sorry, I do not seem to understand your request.

The use another card…e.g. (custom)button …here you have a ugly /quick example on how they differ

This is a possible solution, but isn’t it possible to just have a plain text entity?

I am not sure what you mean then. Input text is ‘plain’ text which you can populate as you like (e.g. along the automation you set above) and then use anywhere in HA. If you want to have ‘fixed’ text without a need to be an entity, you can use the markdown card as well

Just a plain text which changes with the automation’s status. It needs to be in an entity as I also need to have it available in ESPHome.
Like “Status: OK / not OK” (theres more than 2 status’, so not a binary sensor, though)

Then use templating / script to display what you like based on the state of a sensor
e.g.
custom-cards/button-card: :sparkle: Lovelace button-card for home assistant (github.com)

There are way too many options in HA to discuss, so you’d have to dig into cards and templating. Good luck :slight_smile: (I am out for the w/e)

Oh wow, there is really no way to just have a string inside an entity without all that hassle? I thought this to be some very basic functionality… and regarding Javascript, I’m out, no experience in it…