Control Panels with momentary switches

I have created various control panels with Glance cards in Lovelace using momentary switches.

I used template switches to create momentary switches, once switched on they immediately turn off, perfect for TV remotes

 bbc1:
  friendly_name: BBC 1
  value_template: >
    {% if is_state('switch.bbc1','on') %}
      false
    {% endif %} 
  turn_on:
    - service: script.tvchannel
      data:
        channel: "BBC ONE HD"
  turn_off:
bbc2:
  friendly_name: BBC 2
  value_template: >
    {% if is_state('switch.bbc2','on') %}
      false
    {% endif %} 
  turn_on:
    - service: script.tvchannel
      data:
        channel: "BBC TWO HD"
  turn_off:

Payload in the turn_on can be anything you like in my case a script to change channel, turn_off is always empty as it can never be triggered, because the switch is turned off as soon as it is turned on.

Hope this helps someone

That’s an interesting way of doing it.

The other option is to call the scripts directly with a button card tap action.

Or if you prefer a fancier button there’s the custom button card that can do the same thing.

1 Like

Thats much better :slight_smile:

Can you share the lovelace code , are all the TV remote icons mdi ?

very nice

There’s a write up of the Kodi remote here: Kodi Remote

1 Like