Combining platforms/services with template switch

2 months into HASS setup, and I’m accepting that I aint a naturally gifted coder!

I can’t seem to get templating into my thick head. There are clear uses for it in my particular setup - i wonder if anyone can help push me into understanding!

1: combine various services/switches into one switch - ie i have a wake on lan switch, and a command line switch, which id like to turn into a single, toggleable switch

i just dont ‘get’ the whole value template bit.

would it be:

switch:

  • platform: template
    switches:
    HTPC:
    value_template: “what_goes_here?”
    turn_on:
    service: switch.turn_on
    entity_id: switch.name_of_wakeonlan_switch
    turn_off:
    service: switch.turn_on
    entity_id: switch.name_of_commandline_switch

tia

I would have one switch, say wakeonlan, copy commandline switch. You can then hide wakeonlan and use commandline switch as the combo switch. The copy switch template is in the example below, use wakeonlan as the source switch. If you then want a toggle, use the example toggle switch below but put the new template commandline switch as the switch.blind_toggle in the example.

@RobDYI cheers for the pointer, and relating it to my example - i’ll experiment with your suggestion.

I actually think you need to put wakonlan switch in the switch.blind_toggle in the example, not the new template commandline switch as I first suggested.

Here is the method I use, it uses script instead of switch templates. Its simple but has a different look on the front end.

script:
  new_toggle_comboswitch:
    sequence:
      - service: switch.toggle
        data:
          entity_id: switch.commandline
      - service: switch.toggle
        data:
          entity_id: switch.wakeonlan
1 Like