@LittlePapaJohn @bwerst, @MilesAheadToo, @VolkerStolz
It has been along time since I implemented the following to accomplish what you are asking.
I can’t find my source, but try this if you are still seeking a solution…
There are a few steps:
- create a script to call the service and link it to a button on your desktop for easy activation. Examining mine, you will see I use a ~ for column separation.
alias: print_entity_attributes
sequence:
- service: notify.print_export
data_template:
message: |
{% for state in states %}{{ state.entity_id }}~{{ state.domain }}~{{ state.object_id }}~{{ state.name }}~~{{ state.attributes.icon, state.attributes.friendly_name }}~~{{ state.state }}
{% endfor %}
mode: single
icon: mdi:cloud-print-outline
- Create the notify service (Called by the script). ((I am assuming not everyone has the configuration split.)) In your configuration.yaml under default_config:
default_config:
notify:
- name: print_export
platform: file
filename: /config/www/export.txt
timestamp: false
Notes:
filename: /config/www/export.txt designates the destination and name of the file. If the file already exists and it is called again, it will append to the existing results. You could go directly to a .CSV but as you will notice, the first two lines need deleting; additionally, if there are any ,'s (commas) in the file, they need to be remedied before [Search and replace all ~ for ,] Finally you can save and rename the extension to .CSV and you should have everything you are looking for.