Log entity in an automation

I have an automation inside of a package:

automation:
- id: '1583509362752'
  alias: 'Notify: Miki error'
  description: Telegram notification when Miki encounters an error
  trigger:
  - entity_id: vacuum.miki
    platform: state
    to: 'Error'
  action:
  - data:
      message: '*Achtung:* Miki steckt!'
    service: notify.telegram
  - data_template:
      message: {{ states.vacuum.miki }}
    service: system_log.write

Since I get to much notifications I would also like to log the complete entity. However even when the expression {{ states.vacuum.miki }} works inside of “Developer tools - Template”, it does not work inside the package. Instead I get the error:

2020-07-18 16:41:21 ERROR (MainThread) [homeassistant.bootstrap] Failed to parse configuration.yaml: invalid key: "OrderedDict([('states.vacuum.miki', None)])"
  in "/config/packages/automower.yaml", line 32, column 0. Activating safe mode

Can someone explain why? How would I log the entity?

Kind regards, Christian

Quotes for single line templates.

message: "{{ states.vacuum.miki }}"
1 Like