WTH can't I change the device-class of an input boolean to be a motion-sensor with a helper?

As the title suggest, I’d like to change an input boolean to motion-sensor the use for homekit bridge as front-door “motion detected”. But in the “helpers” section is templating such a sensor not possible.

I needed this because the Unifi “smart detected a person in front of your door camera” works fine, but when someone is at my door for serval minutes (like delivery service), the integration keeps fireing the motion detected sensor on and off and on. When I couple this sensor directly to homekit bridge (like suggested in many examples). My homekit app constant notifies some-one is at my door (while i’m busy at the door with the delivery). So my tought was to create an automation controlling an input boolean “motion is happening” until the thing at the door is really over, and then disable the input boolean again. And then use the input boolean as “motion sensor” for homekitbrige, so there is only 1 notification from homekit there is someone at the door, and not serval. But it seems not possible to fake the device-class with a helper… I worked around the problem with an automation, but it’s kind of a complicated work around which could be a lot easyer if I could just change the boolean with the helper…

This is what template entities are for. You can create a trigger based binary template sensor with delayed off to get the same effect and it’s a rather simple template entity.

1 Like

I believe it was not possible in the helpers, and when tring it via configyaml it wasn’t accepted by homekitbridge, but i’ll try it again!

It’s possible via UI template entities and yaml entities

1 Like

I would love to have that, too. As a noob, I just created a input boolean helper for occupancy for each room. I think most people will avoid template helpers. An input boolean is qite similar to a binary sensor. It should be possible to assign a device class.

input booleans are closest to a switch, a binary sensor is something you cannot modify the state of. There isn’t anywhere in the UI where you’d get use out of a device_class on an input boolean because you’ll always see the toggle value represented by the color of the card or the nature of the toggle switch.

1 Like

Okay, thank you for your explanation. I still have some issues with this, making me unhappy.

  1. I could use template binary sensors. But I can’t change the state with automations.
  2. I could keep my input booleans. But a switch is not the correct device class for i.e. a virtual occupancy sensor.
  3. I could use a template binary sensor based on each of my input booleans. But that makes lots of additional entities.

… but why do you need the device class on an input boolean. Lets start there.

Because I use the input booleans to reflect the state of a “device” or a room. This can be my mailbox( the device-class mail is missing) or as stated above the occupancy.
For example, I have an automation switching an input bolean to on, based on two PIR and one die sensor. It would be nice if this input bolean could be configured to be shown as different devices, like the binary sensor can. I hope I could make it clear.
Probably I am thinking wrong, cause otherwise this WHT would be voted much more.

Device class only handles translations and icons, the functionality in the UI is not handled by device class. So adding device class to input booleans would only get you icons because the UI only displays input booleans as a toggle switch (with no words).

What would you do? Try to write the automations which handle the state of the input booleans into the template binary sensor? Or add template binary sensors based on the state of the input booleans? Or is there even a better way I do not know about?

I’d typically use template entities, but that doesn’t always work for every situation. Post the automation and I can provide more pointed advice

1 Like

For me it was not an automation who didn’t work. The homekit bridge integration did not accept the entitiy’s deviceclass as I faked it with a template.