Binary Template without Input Helper

I’ve been using an input_boolean helper to indicate whether my trash can is on the curb or not. It has an NFC tag which flips the bit to on.

Due to some confusion, my can got mixed up with a neighbors. Since the NFC tag hidden, it’s not easy to tell which one belongs to which neighbor, unless you know the can’s barcode. I realize that in a normal situation, these cans are fungible: My neighbor getting my recycling can and me getting theirs is not that big of an issue.

Since I don’t want to tag yet another can, I figured I’d add an attribute with the can’s barcode and then make sure I have the correct can.

I found this topic but I don’t want to download a script for this. The OP made it sound like a template with a binary sensor might do the trick. I started setting it up but then discovered that the automation service input_boolean.turn_on can’t “turn on” the binary sensor’s state.

Here is my template:

- unique_id: b5064b8bff9e42c3944c55caecd93e52
    - name: Recycling Can 7890
      unique_id: '5c619b9e-9234-43a0-ba39-d139336f7983'
      state: 0
        barcode: "1234567890"

And here’s my automation:

- id: '20f2f708-f7f6-4673-82cf-de7b9f0a891c'
  alias: Test Tag 1 is scanned
  - platform: tag
    tag_id: de196629-0dac-45e0-8863-57e91fa0df5f
  condition: []
  - service: input_boolean.turn_on
    data: {}
      entity_id: binary_sensor.recycling_can_7890
  mode: single

My guess is that sensor states aren’t designed to be changed via automation; they are designed to be read. Is this correct?

If that’s the case, should the template be updated to read the input_boolean.recycling_can state? Or is there a way to interact with the entity and flip the binary state using automation?


If you just need to add a static value as an attribute, you can use Customize Entities. This is a great little trick for situation like this or to add details like battery type, color, etc.

      barcode: 123456

That did the trick! Thank you!