Distinguish single, double and long on a template binary sensor

Hi guys,

I saw examples for Xiomi buttons. Is this at all possible for template binary buttons?

Can I have a hint for simple example for an automation which triggers two different actions on single and long?

Any hint appreciated.

Regards
Ralf

Are you specifically asking about Xiaomi buttons or is this a generic push button and if so what is it connected to ?

I have push buttons connected to nodeMCU’s and Sonoff’s and define different push durations using the ESPhome integration.

I have KNX Switches and binary sensors. And derive template sensors from those.

However shouldn’t that feature distinguishing single, double, long not be a basic feature applicable to all switches and binary sensors? Kind of a generic class which is then inherited to all other Switches and binary sensors? Like the filter feature?

I have yet not much visibility on the architecture of HA. Just one week into it. However I have a long history in OpenHAB from which I am migrating ,-).