Entitäten Namen exportieren in Liste

Hallo Zusammen,
ich bin nicht sicher ob ich in der richtigen Kategorie bin (Fall Nein, bitte in andere Kategorie bewegen).
Hat einer von euch eine Ahnung wie ich die Entitätennamen per Export aus Home Assistant “rausbekomme” ?
Mir fällt immer wieder auf das ich bei Scripten Entitätsnamen mit Copy&Paste einfügen muss. Da diese sich bei mir aber so gut wie nie ändern, hätte ich gerne eine Möglichkeit diese zu exportieren.
Das was ich bisher bei der Google Suche gefunden hab, hat bei mir nicht so wirklich funktioniert. Ein Export sollte aber doch grundsätzlich möglich sein, oder ?
Ich bin froh über Ideen und Anregungen und hoffe auf möglichst wenig Kommentare a la “wozu brauchst du denn sowas ?” und “im JSON werden die doch automatisch vervollständigt”. Ich brauche die um z.B. Gruppen in den Config Files anzulegen etc.
Vielen Dank schon mal vorab für eure Ideen.
Viele Grüße
Reimar

Die einfachste Möglichkeit dürfte sein unter Entwicklerwerkzeuge/Zustände sich die aktuellen Entitäten anzeigen zu lassen.
Mit der Maus alles markieren und mit Strg+C alles in die Zwischenablage befördern.
Dann kann man es in einer Tabellenkalkulation weiter verarbeiten.
Zwischenablage in die erste Spalte einfügen, einen Filter setzen und nach Bedingung (sensor, automation) filtern.

Hoffe das hilft etwas weiter. :grinning:

1 „Gefällt mir“

Vielen Dank. Ein sehr pragmatischer Ansatz und daher gar nicht so verkehrt. :slight_smile: Hilft auf jeden Fall schon mal fürs Erste. Ich hatte nur gehofft das aus dem System heraus eine etwas elegantere Lösung gibt.

Schau mal hier, da wird es gut beschrieben:

1 „Gefällt mir“

Hi,
ja das war das was ich auch gefunden hatte. Irgendwie reicht mein Know-How aber dafür scheinbar nicht aus. Die Configuration.yaml zu editieren ist ja kein Thema, ich habe aber keine Ahnung wie und wo ich das Script anlegen soll. Siehe hier:
t 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:

  1. 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
  1. 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.

Scripts erstellt man hier:
Open your Home Assistant instance and show your scripts.
(Einstellungen - Automationen & Szenen - Skripte)

Wenn du das erstellt hast, kannst du es ausführen und die Datei müsste angelegt werden, sofern du die configuration.yaml richtig angepasst hast.

1 „Gefällt mir“

so wie ich das lese, musst in die configuration.yaml folgendes:

notify:
- name: print_export
  platform: file
  filename: /config/www/export.txt
  timestamp: false

Und dann unter Automatisierungen & Szenen eine Szene anlegen mit dem Dienst-Aufruf (s.o.)

1 „Gefällt mir“

Manchmal hat man nur ein Brett vorm Kopf :wink: Vielen Dank für den Wink mit dem Zaunpfahl. Hat jetzt alles geklappt.

Ich habe das Script und die Einträge in der configuration.yaml wie oben beschrieben erstellt. Wenn ich das Script jetzt aufrufe, erhalte ich folgenden Fehler:

Die Aktion notify.print_export verwendet die Aktion script.print_entity_attributes die nicht gefunden wurde.

Hier noch die Protokolldetails zu dem fehler:

Logger: homeassistant.components.script.print_entity_attributes
Quelle: helpers/script.py:2039
Integration: Skript (Dokumentation, Probleme)
Erstmals aufgetreten: 13:48:39 (1 Vorkommnisse)
Zuletzt protokolliert: 13:48:39

print_entity_attributes: Error executing script.
Service not found for call_service at pos 1: Action notify.print_export not found

Hat jemand eine Idee?

:crayon:by HarryP: Code-/Logzeilen formatiert (bitte immer in </> einbinden)

Funktioniert es denn bei allen anderen? Hat niemand das Problem?