Exploring ESPHome Customization and Sensor Integration

Hey everyone, I’m diving into the world of ESPHome and custom sensors, and I wanted to share my journey and some questions I’ve come across. I recently set up two binary sensors using ESPHome to detect motion in my bedroom. Here’s a snippet of my configuration:

yaml
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;
    }

These sensors are supposed to trigger when motion is detected in specific areas. I then tried customizing them in my customize.yaml file to change icons based on their state:

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

However, I noticed that the icons aren’t updating as expected. Is there something I’m missing in my setup? Could it be related to how the sensors are defined in ESPHome versus other configurations?

I’m also curious about how others have successfully customized their ESPHome sensors and if there are any best practices or common pitfalls to avoid. If anyone has tips or resources, I’d greatly appreciate it!

On a lighter note, I’m excited to see how this integration can enhance my smart home setup. It’s amazing how a bit of coding can turn everyday objects into smart devices. Keep the tips coming, and happy tinkering! :rocket: