Entity Button for Automation Trigger throwing since 0.103.0

Hello,
for months I’ve been using this automation triggered via an mqtt client or an entity_button on lovelace.
Since 0.103.0 the trigger via mqtt still works, but via lovelace it throws an exception. I didn’t see anything in the changelog regarding this. Is it possible that the new rule that integrations must have an entity_id is causing a problem for mqtt-triggered events via lovelace?

The entity_button is configured as:

entity: automation.buro_dunkel
hold_action:
  action: more-info
icon_height: '-1px'
name: Büro Dunkel
show_icon: false
show_name: true
tap_action:
  action: call-service
  service: automation.trigger
type: entity-button

Now, the exception is:

Fehler beim Aufrufen des Service automation/trigger. must contain at least one of entity_id, area_id.

Log says:

must contain at least one of entity_id, area_id

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 817, in validate_callable
    return schema(data)
  File "/usr/src/homeassistant/homeassistant/helpers/config_validation.py", line 94, in validate
    raise vol.Invalid("must contain at least one of {}.".format(", ".join(keys)))
voluptuous.error.Invalid: must contain at least one of entity_id, area_id.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 133, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1213, in async_call
    processed_data = handler.schema(service_data)
  File "/usr/local/lib/python3.7/site-packages/voluptuous/validators.py", line 208, in __call__
    return self._exec((Schema(val) for val in self.validators), v)
  File "/usr/local/lib/python3.7/site-packages/voluptuous/validators.py", line 287, in _exec
    raise e if self.msg is None else AllInvalid(self.msg, path=path)
  File "/usr/local/lib/python3.7/site-packages/voluptuous/validators.py", line 283, in _exec
    v = func(v)
  File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 276, in __call__
    raise er.MultipleInvalid([e])
voluptuous.error.MultipleInvalid: must contain at least one of entity_id, area_id.

The automation is defined as :

- id: '1572571899096'
  alias: Büro Dunkel
  description: ''
  trigger:
  - payload: '1'
    platform: mqtt
    topic: buero/state/dark
  condition: []
  action:
  - alias: ''
    data:
      brightness_pct: 40
      color_temp: 500
      entity_id: light.buro_decke_mitte
      transition: 2
    entity_id: light.buro_decke_mitte
    service: light.turn_on
  - data:
      entity_id: climate.buro
      hvac_mode: heat
      temperature: 25
    entity_id: climate.buro
    service: climate.set_temperature
  - delay: 00:45
  - data:
      entity_id: climate.buro
      hvac_mode: heat
      temperature: 23
    entity_id: climate.buro
    service: climate.set_temperature
  - data:
      payload: 0
      qos: 2
      retain: true
      topic: buero/state/dark
    service: mqtt.publish

You have not specified which automation to trigger when the button is pressed.

Try:

...
tap_action:
  action: call-service
  service: automation.trigger
  service_data:
    entity_id: automation.buro_dunkel
...

Check the automation entity_id I used is correct in the developer tools / states page.

2 Likes

Hello tom_I,
sorry, it’s me again :slight_smile:
It was created via the lovelace-editor, where the entity was selected in the first field (screenshot below).
The code was created by that and it says the entity in the first line.
Your solution does work though and solves the problem! Thanks!

I’ve now recreated a new button with the old settings but the same exception appears and the same (faulty) code is generated on the new one. There seems to be a problem with the generation of the code through the UI-button designer in regards to the new requirements in 103.

Yeah it’s a work in progress. Update to 0.103.2, clear your browser cache and try again. If it still occurs you should submit an issue here:

1 Like

Thanks. Helped me with a related issue.

1 Like