No-operation service

I have some automations where the service to be called is determined by a template. In certain situations I do not want a service called. In that case I call the service homeasistant.update_entity in order to prevent the error “invalid service”. Like this:

  - service: '
    {% if state_attr("sensor.jablotron_oasis_80","zones")=="ABC" and states("alarm_control_panel.woonhuis_alarm")!="armed_away" %}
      alarm_control_panel.alarm_arm_away
    {% elif state_attr("sensor.jablotron_oasis_80","zones")=="A" and states("alarm_control_panel.woonhuis_alarm")!="armed_home" %}
      alarm_control_panel.alarm_arm_home
    {% elif state_attr("sensor.jablotron_oasis_80","zones")=="None" and states("alarm_control_panel.woonhuis_alarm")!="disarmed" %}
      alarm_control_panel.alarm_disarm
    {% else %}
      homeassistant.update_entity
    {% endif %}
    '
    target:
      entity_id: alarm_control_panel.woonhuis_alarm
    data:
      code: !secret alarm_code
    '

However this stil generates an error because the update_entity service does not allow any data.
Is there a no-op service that can be applied in all domains, accepts all kind of data and does exactly nothing?

Scripts are services. Write a script that only has a delay of one second in the sequence and call that.

The other option is to use the choose action that does not require an else case.

Thanks for the advice. I’ll try the choose action. That seems the most elegant solution.

1 Like