Add switch platform for calling a service

Hi all,

what do you think about a switch that calls a HA service. eg:

switch:
  - platform: service
    on:
      service: remote.send_command
      data:
        foo: bar
    off:
      service: remote.send_command
      data
        foo: bar2

I need something like this to control logitech harmony devices and I think it could be used for much more.

I thin kyou can already do this with the template switch: https://home-assistant.io/components/switch.template/

but what would I put into the value_template property when I don’t have a sensor to listen to?

Actually you can use https://home-assistant.io/components/input_boolean and set automation to react on state change.

that’s what I actually do, but I don’t think that this is optimal. that’s why I thought of a service switch. I could make a PR for it, if you think that it should be integrated into HA

I think in that case I think you should expand the input_boolean (and the other input_X) components.

But since I’m not a deciding vote you should probably wait for a maintainer opinion :slight_smile:

Any news? I have the same problem. I would like to have a switch to turn on and turn off the Xiaomi Aqara ringtone service…

1 Like