Sensor in configuration.yaml is unavailable

I’m taking value from a d1mini configured with esphome ’ sensor.bed_sensor ’ . I want to scale them in another sensor ’ bed_weight ’ (I want to scale it in a second sensor, I don’t want to use the map function of esphome). I’ve created this code to have the correct value from the sensor scaled correctly and the mean of the last 30 minutes of the sensor.
(other numbers in scaling formula ‘input_number.XXX’ are daily changed in automations)

Both sensors appears as unavailable in entity section. What am I doing wrong?

#bed weight
  - platform: template
        value_template: >-
          {{ ((states(input_number.kg_sergio) | int)*(((states(sensor.bed_sensor) | int)-(states(input_number.not_kg_letto_vuoto) | int))/((states(input_number.not_kg_letto_sergio) | int)-(states(input_number.not_kg_letto_vuoto) | int)))) | round(1) }}
        unique_id: bed_weight
        friendly_name: 'Bed Weight'
        unit_of_measurement: 'kg'
#bed sensor 30 minutes mean
  - platform: statistics
    name: "Bed sensor mean over last 30 minutes"
    entity_id: sensor.bed_sensor_mean
    unique_id: bed_sensor_mean
    state_characteristic: mean
      minutes: 30

All entity_ids are missing the colons. For example:


(and so on)

And I’d give the int a default value: |int(0)

1 Like

Thanks <3 , It works :slight_smile:
I’m noob in this programming lenguage so sorry for the stupid question :slight_smile:

All good! :slight_smile: