Template binary_sensors not appearing

Hi everyone,

I’m updating from the old templating style to the new style (no idea why it’s taken me this long) and I’m having a bit of trouble getting the binary_sensors entities to exist in Home Assistant.

My goal is to copy the existing binary_sensors, as they don’t have device_class: motion set, which makes the History Graph lovelace card look different to the rest of the motion sensors as it outputs true/false rather than detected/clear.

Here is my code:

template:
  - binary_sensor:  
    - name: "Garage Motion"
      unique_id: template_garage_motion
      delay_off: "00:01:00"
      device_class: motion
      state: "{{is_state('binary_sensor.garage_global_motion_sensor', 'true') }}"

    - name: "Front Yard Motion"
      unique_id: template_front_yard_motion
      delay_off: "00:01:00"
      device_class: motion
      state: "{{is_state('binary_sensor.front_yard_global_motion_sensor', 'true') }}"

Any help would be much appreciated, as I’m starting to pull my hair out.

try use ‘on’ instead of ‘true’

You don’t need to create new sensors to do this, just use customize to add the device class.

You can’t add the off delay though. So if that is important just alter your automations to include for: statements in your triggers.

How were these sensors discovered or created?

It may be that the integration needs updating.

Fantastic! Thank you so much for the suggestion. That saves having duplicate entities too. I’ll give it a shot when I get back home and I’ll create an issue on the repo so the developers are aware. I could likely solve it and make a PR but I’m not sure how binary sensor states are handled, would changing the class potentially break user automations etc. or is it purely aesthetic?

They’re from the Eufy Security integration, I’m pretty sure it’s this one that I’m using.