Homeassistant.toggle vs. script.toggle

I wonder if somebody can explain the difference between script.toggle and homeassistant.toggle (and “turn_on” etc etc.)? Or is it the same, but homeassistant.toggle was added more recently?

There’s not a lot of difference. The main one being that the home assistant toggle/on/off version can be used in service templates that have more than one domain. e.g. scripts and scenes:

  - service: homeassistant.turn_on
    data_template:
      entity_id: >
        {% if states('input_select.rumpus_scene') == 'Off' %}
          script.rumpus_off
        {% elif states('input_select.rumpus_scene') == 'Automatic' %}
          scene.rumpus_automatic
        {% elif states('input_select.rumpus_scene') == 'Blood' %}
          scene.rumpus_blood
        {% elif states('input_select.rumpus_scene') == 'Bright' %}
          scene.rumpus_bright
        {% elif states('input_select.rumpus_scene') == 'Forest' %}
          scene.rumpus_forest
        {% elif states('input_select.rumpus_scene') == 'Imperial' %}
          scene.rumpus_imperial
        {% elif states('input_select.rumpus_scene') == 'Night Light' %}
          scene.rumpus_night_light
        {% elif states('input_select.rumpus_scene') == 'Party' %}
          script.rumpus_party
        {% elif states('input_select.rumpus_scene') == 'Sky' %}
          scene.rumpus_sky
        {% elif states('input_select.rumpus_scene') == 'Under Water' %}
          scene.rumpus_under_water
        {% elif states('input_select.rumpus_scene') == 'Watch Movie' %}
          scene.rumpus_watch_movie
        {% elif states('input_select.rumpus_scene') == 'Zen' %}
          scene.rumpus_Zen
        {% else %}
          scene.rumpus_automatic
        {% endif %}
1 Like