Struggling to get binary sensor template working

Hi. I have two accelerometers setup with ESPHome, one to my washer and one to my dryer. I’m getting data from them, but unfortunately I am unable to get a binary sensor template working to show that the dryer/washer is running.

This is what I have in my binary_sensor.yaml:

- platform: template
  sensors:
    washing_machine:
      friendly_name: Washing Machine
      value_template: >-
        {% if states('sensor.washer_accel_z') | float > 0.1 %}
          Running
        {% elif states('sensor.washer_accel_z') | float < -0.1 %}
          Running
        {% else %}
          Off
        {% endif %}
      availability_template: >
        {{ states('sensor.washer_accel_z') != 'unavailable'}}
    dryer:
      friendly_name: Dryer
      value_template: >-
        {% if states('sensor.dryer_accel_x') | float > 0.1 %}
          Running
        {% elif states('sensor.dryer_accel_x') | float < -0.1 %}
          Running
        {% else %}
          Off
        {% endif %}
      availability_template: >
        {{ states('sensor.dryer_accel_x') != 'unavailable'}}

No matter what the readings of the accelerometers are at they both always show Off. Can anyone help me figure out what is wrong here? This is my first time writing templates.

A Binary Sensor’s nominal states are on and off.

You said you are trying to create a binary_sensor, in binary_sensor.yaml, yet your configuration is reporting a Running state and Off with a capital O. Neither is valid for a binary_sensor.

If you absolutely want those state values move what you created into sensors.yaml (or whatever file you use for sensors) to create a Sensor (not Binary Sensor).

If you absolutely want them to be proper Binary Sensors, let me know and I’ll show you how to modify the templates.

Dang son. You fixed it. I feel stupid. Thank you for that!!