Why is this sensor showing greyed out and 'unavailable?

I’ve added two sensors:

    calculated_feeds_per_day:
      friendly_name: Calculated feeds per day
      value_template: '{{ ((states.sensor.sunminutes.state | int / 60)) | int }}'

    feed_amount_per_dose_20:
      friendly_name: Amount per dose at 20
      value_template: '{{ ((states.input_number.feed_amount_20 | int) / (states.sensor.calculated_feeds_per_day | int)) | int }}'

The first one shows up in the front end fine, but the second, feed_amount_per_dose, shows up as greyed out and unavailable.

Why would this be?

In the settings it shows:

This entity ("sensor.feed_amount_per_dose_20") does not have a unique ID, therefore its settings cannot be managed from the UI. See the [documentation](https://www.home-assistant.io/faq/unique_id) for more detail.

You can overwrite some attributes in the [entity customizations](http://10.0.1.210:8123/config/customize/edit/sensor.feed_amount_per_dose_20) section.

I don’t have another with the same name. Is it badly defined in my YAML?

The first one works because it requests the state value of states.sensor.sunminutes like this:

states.sensor.sunminutes.state

The other two fail because they aren’t requesting the state value and attempt to use states.input_number.feed_amount_20 and states.sensor.calculated_feeds_per_day directly.

Modify the template so each one refers to the state value.

states.input_number.feed_amount_20.state
states.sensor.calculated_feeds_per_day.state
1 Like

Brilliant!

Thank you so much.