Customizing an ESPHome Created Sensor

Hi All,

Looking for some pointers as to why a couple of sensors aren’t “customized” with icons specified.

First off, the sensors are created through an ESPHome project:

binary_sensor:
   - platform: template
     name: "inBed_1"
     lambda: |-
       if (id(upperleft).state &&
           id(lowerleft).state) {
         return true;
       } else {
         return false;
       }
   - platform: template
     name: "inBed_2"
     lambda: |-
       if (id(upperright).state &&
           id(lowerright).state) {
         return true;
       } else {
         return false;
       }

Then, in my customize.yaml file I’ve got this:

binary_sensor.inbed_1:
  icon_template: >-
    {%- if states('binary_sensor.inbed_1') == on -%}
      'mdi:bed'
    {% else %}
      'mdi:bed-empty'
    {% endif %}

Is the issue with the fact that the sensor is created in a ESPHome .yaml file and not through config.yaml? Or is there just something plain wrong with my coding?

Customize does not support an icon_template. Only an icon: Customizing entities - Home Assistant

If it did, this should be:

{%- if states('binary_sensor.inbed_1') == 'on' -%}

but it doesn’t so… not much point correcting it.

thanks for clarification, sounds like what I would need to do is to create a template sensor that uses the sensor from esphome and customize that new template sensor, correct?

Edit: Also, was it just the apostophe’s around the on that needed to be added? That seems to be the only thing I could find.