HomeAssistant (HAOS): Alle Konfigurationsdateien komplett bearbeiten... aber wie?

n/a

Banned
Registriert
Feb. 2025
Beiträge
673
Hi, ich hoffe, bin unter Anwendungen -> Systemtools richtig ... (hatte vor einiger Zeit schon einmal ein Thema bzgl. HA geöffnet)

Ich wollte meine HAOS-Konfiguration manuell (also mithilfe eines Editors, und nicht mithilfe eines "Helpers") bearbeiten, und habe deshalb das File Editor Add-on installiert. Allerdings kann ich damit nicht in meinen Konfigurations-Ordner wechseln ... dieser sollte eigentlich unter /config/ sein, aber ich sehe diesen Ordner nicht

Könnte man zum HAOS vielleicht eine ssh-Verbindung aufbauen? Wenn ja, wie?

Danke, wer eine Idee hat
 
n/a schrieb:
Könnte man zum HAOS vielleicht eine ssh-Verbindung aufbauen? Wenn ja, wie?
ssh user@ip
in der configuration.yaml kannst du alles konfigurieren.
 
Vielleicht hilft das

Code:
Command executed: ls -la /: 0
total 108
drwxr-xr-x    1 root     root          4096 Jul 22 17:39 .
drwxr-xr-x    1 root     root          4096 Jul 22 17:39 ..
-rwxr-xr-x    1 root     root             0 Jul 22 17:39 .dockerenv
drwxr-xr-x    2 root     root          4096 Oct  8  2024 addon_configs
drwxr-xr-x    2 root     root          4096 Jul 22 16:51 backup
drwxr-xr-x    1 root     root          4096 Jan  4  2024 bin
drwxr-xr-x    2 root     root         12288 Jan  4  2024 command
drwxr-xr-x    2 root     root          4096 Jul 22 17:39 data
drwxr-xr-x   15 root     root          3940 Oct  8  2024 dev
drwxr-xr-x    1 root     root          4096 Jul 22 17:39 etc
drwxr-xr-x    2 root     root          4096 Dec  7  2023 home
drwxr-xr-x    7 root     root          4096 Jul 22 17:38 homeassistant
-rwxr-xr-x    1 root     root          1012 Nov 20  2023 init
drwxr-xr-x    1 root     root          4096 Jan  4  2024 lib
drwxr-xr-x    2 root     root          4096 Oct  8  2024 media
drwxr-xr-x    2 root     root          4096 Dec  7  2023 mnt
drwxr-xr-x    2 root     root          4096 Dec  7  2023 opt
drwxr-xr-x    6 root     root          4096 Nov 20  2023 package
dr-xr-xr-x  272 root     root             0 Jul 22 17:39 proc
drwxr-xr-x    1 root     root          4096 Feb 10  2024 root
drwxr-xr-x    1 root     root          4096 Jul 22 17:39 run
drwxr-xr-x    2 root     root          4096 Dec  7  2023 sbin
drwxr-xr-x    2 root     root          4096 Oct  8  2024 share
drwxr-xr-x    2 root     root          4096 Dec  7  2023 srv
drwxr-xr-x    2 root     root          4096 Oct  8  2024 ssl
dr-xr-xr-x   12 root     root             0 Jul 22 17:39 sys
drwxrwxrwt    1 root     root          4096 Jul 22 17:39 tmp
drwxr-xr-x    1 root     root          4096 Feb 10  2024 usr
drwxr-xr-x    1 root     root          4096 Feb 10  2024 var

Command executed: ls -la /homeassistant: 0
total 70608
drwxr-xr-x    7 root     root          4096 Jul 22 17:38 .
drwxr-xr-x    1 root     root          4096 Jul 22 17:39 ..
-rw-r--r--    1 root     root             8 Jul 22 17:01 .HA_VERSION
drwxr-xr-x    2 root     root          4096 Jul 16 17:09 .cloud
drwxr-xr-x    2 root     root          4096 Jul 22 17:42 .storage
-rw-r--r--    1 root     root             2 Jul 16 17:08 automations.yaml
drwxr-xr-x    5 root     root          4096 Jul 20 09:19 blueprints
-rw-r--r--    1 root     root           265 Jul 16 17:08 configuration.yaml
drwxr-xr-x    2 root     root          4096 Jul 16 17:08 deps
-rw-r--r--    1 root     root           601 Jul 22 17:39 home-assistant.log
-rw-r--r--    1 root     root           757 Jul 22 17:35 home-assistant.log.1
-rw-r--r--    1 root     root             0 Jul 22 17:38 home-assistant.log.fault
-rw-r--r--    1 root     root      67973120 Jul 22 17:50 home-assistant_v2.db
-rw-r--r--    1 root     root         32768 Jul 22 17:52 home-assistant_v2.db-shm
-rw-r--r--    1 root     root       4227152 Jul 22 17:52 home-assistant_v2.db-wal
-rw-r--r--    1 root     root          3300 Jul 21 23:52 scenes.yaml
-rw-r--r--    1 root     root             0 Jul 16 17:08 scripts.yaml
-rw-r--r--    1 root     root           161 Jul 16 17:08 secrets.yaml
drwxr-xr-x    2 root     root          4096 Jul 16 17:09 tts

das konnte ich über das File Editor Add-on ausführen

madmax2010 schrieb:
Port?

madmax2010 schrieb:
in der configuration.yaml kannst du alles konfigurieren
Leider nicht. Ich habe zwei Templates erstellt, und diese sind in dieser Yaml-Datei nicht... die ist leer
Ergänzung ()

Ohje ...

https://community.home-assistant.io...ration-yaml-and-how-to-manually-edit/209549/5

HOWEVER…

Not all configuration is stored in configuration files in yaml and it’s getting less and less common these days.

Most of your configuration will be stored in the files located in the .storage folder. These files aren’t meant to be user editable.

Heißt das, mein Vorhaben ist damit obsolet?
 
Zuletzt bearbeitet:
dieser sollte eigentlich unter /config/ sein, aber ich sehe diesen Ordner nicht
Der "homeassistant" Ordner ist schon der richtige Ordner mit der configuration.yaml
Der "config" Ordner wurde irgendwann mit einem Update umbenannt in "homeassistant"
Wenn "Enforce Basepath" im File-Editor aktiviert ist, landest du dort automatisch.

https://www.home-assistant.io/docs/configuration/
 
  • Gefällt mir
Reaktionen: n/a
Danke für die Erklärung!

configuration.yaml sieht bei mir so aus:

1753202935940.png


Ich vermute, das meiste wird in dieser Datenbank sein:

1753203060793.png


und die sollte man wahrscheinlich nicht manuell editieren ...
 
Am besten schaust du dir ein paar Videos zu den Sensoren und Auslagerung der Sensoren etc. in seperate Dateien (per "!include" eingebunden) an. z.B.
 
  • Gefällt mir
Reaktionen: n/a
@ohmsl Video angeschaut und Skript durchgelesen ... ✅ Danke dafür

1753204708630.png


Ich habe mit Punkt 5 angefangen ... aber ich möchte jetzt den Code, den der Helfer wahrscheinlich intern erzeugt, in die configuration.yaml eintragen ... - Nennen wir es mal vorsichtshalber Boilerplate-Code ... - es gibt aber offenbar keine Export-Funktion

Was nun?

... Ich kann mir zwar auch etwas aus den Fingern saugen und ausprobieren, ob es funktioniert, aber so sähe planvolles Handeln nicht aus ;)
 
Willst Du jetzt Deine Configs editieren, oder die Datenbank?

Edit: Da haben sich unsere Beiträge überschritten, Du erklärst in #7 endlich was Du machen möchtest genauer. Hätte in #1 gehört.

Die Helfer liegen in /homeassistant/.storage (normalerweise ein versteckter ordner).

Also z.b. /config/.storage/core.config_entries


Warum nennst Du das Kind nicht mal beim Namen? Eventuell können wir dann besser helfen?
Was ist das eigentliche Problem. Was möchtest Du erreichen. Komplette Geschichte wenn es geht.
 
Zuletzt bearbeitet:
  • Gefällt mir
Reaktionen: n/a
HisN schrieb:
Die Helfer liegen in /homeassistant/.storage (normalerweise ein versteckter ordner).

Also z.b. /config/.storage/core.config_entries

Danke, gefunden:

Code:
Command executed: ls -la /homeassistant/.storage/: 0
total 424
drwxr-xr-x    2 root     root          4096 Jul 22 20:24 .
drwxr-xr-x    7 root     root          4096 Jul 22 17:38 ..
-rw-r--r--    1 root     root          1054 Jul 16 17:16 androidtv_remote_cert.pem
-rw-r--r--    1 root     root          1675 Jul 16 17:16 androidtv_remote_key.pem
-rw-r--r--    1 root     root           634 Jul 16 17:09 assist_pipeline.pipelines
-rw-------    1 root     root          5984 Jul 22 20:23 auth
-rw-------    1 root     root           267 Jul 16 17:10 auth_provider.homeassistant
-rw-r--r--    1 root     root           980 Jul 22 16:52 backup
-rw-r--r--    1 root     root          3263 Jul 22 20:23 bluetooth.passive_update_processor
-rw-r--r--    1 root     root           147 Jul 16 17:11 core.analytics
-rw-r--r--    1 root     root          1255 Jul 21 06:18 core.area_registry
-rw-------    1 root     root           387 Jul 16 17:11 core.config
-rw-r--r--    1 root     root         13236 Jul 22 19:38 core.config_entries
-rw-r--r--    1 root     root         28154 Jul 22 17:42 core.device_registry
-rw-r--r--    1 root     root        256152 Jul 22 17:42 core.entity_registry
-rw-r--r--    1 root     root          1221 Jul 16 19:48 core.label_registry
-rw-r--r--    1 root     root         17174 Jul 22 20:24 core.restore_state
-rw-------    1 root     root           126 Jul 16 17:09 core.uuid
-rw-r--r--    1 root     root           332 Jul 16 19:28 frontend.user_data_ ...
-rw-r--r--    1 root     root           285 Jul 16 17:09 hassio
-rw-r--r--    1 root     root           586 Jul 16 17:09 homeassistant.exposed_entities
-rw-r--r--    1 root     root           356 Jul 22 17:41 http
-rw-r--r--    1 root     root           134 Jul 16 17:09 http.auth
-rw-r--r--    1 root     root          2871 Jul 21 21:56 lovelace.dashboard_temps
-rw-r--r--    1 root     root           154 Jul 16 17:12 lovelace.map
-rw-r--r--    1 root     root           567 Jul 16 22:40 lovelace_dashboards
-rw-------    1 root     root           174 Jul 16 17:12 onboarding
-rw-r--r--    1 root     root           290 Jul 16 19:29 person
-rw-r--r--    1 root     root           109 Jul 16 17:11 repairs.issue_registry
-rw-r--r--    1 root     root            85 Jul 22 17:35 trace.saved_traces

Das Script steht als JSON in der core.entity_registry Datei... (sogar gelöschte Einträge sind dort)

JSON:
[
   {
      "created_at":"2025-07-21T19:53:39.495953+00:00",
      "data":{
        
      },
      "disabled_by":null,
      "discovery_keys":{
        
      },
      "domain":"template",
      "entry_id":"abc...",
      "minor_version":1,
      "modified_at":"2025-07-21T19:53:39.495978+00:00",
      "options":{
         "device_class":"humidity",
         "device_id":"abc...",
         "name":"Sensor 358 Humi",
         "state":"{% set val = states('sensor.tp358_e551_humidity') | float(0) %}\n{% if 35 <= val <= 100 %}\n  {{ val }}\n{% else %}\n  None\n{% endif %}",
         "state_class":"measurement",
         "template_type":"sensor",
         "unit_of_measurement":"%"
      },
      "pref_disable_new_entities":false,
      "pref_disable_polling":false,
      "source":"user",
      "subentries":[
        
      ],
      "title":"Sensor 358 Humi",
      "unique_id":null,
      "version":1
   },
   {
      "created_at":"2025-07-21T19:55:29.605457+00:00",
      "data":{
        
      },
      "disabled_by":null,
      "discovery_keys":{
        
      },
      "domain":"template",
      "entry_id":"abc...",
      "minor_version":1,
      "modified_at":"2025-07-21T19:55:29.605477+00:00",
      "options":{
         "device_class":"temperature",
         "device_id":"abc...",
         "name":"Sensor 358 Temp",
         "state":"{% set val = states('sensor.tp358_e551_temperature') | float(0) %}\n{% if 10 <= val <= 40 %}\n  {{ val }}\n{% else %}\n  None\n{% endif %}",
         "state_class":"measurement",
         "template_type":"sensor",
         "unit_of_measurement":"°C"
      },
      "pref_disable_new_entities":false,
      "pref_disable_polling":false,
      "source":"user",
      "subentries":[
        
      ],
      "title":"Sensor 358 Temp",
      "unique_id":null,
      "version":1
   }
]

(sensible IDs hab ich durch abc... ersetzt)

Meine Frage wäre nun, wie ich aus diesem JSON-Array YAML-Einträge in der Konfigurationsdatei machen kann... also wie ich das json konvertieren könnte (oder adaptieren)

HisN schrieb:
Was ist das eigentliche Problem

Ich möchte den Helper nicht verwenden, das ist mir bei mehreren Template-Sensoren zu umständlich
 
  • Gefällt mir
Reaktionen: HisN
Ich habe den Code mal bei Googles KI Gemini eingefügt und um Umwandlung in einen yaml-Code für Template Sensor gebeten. Folgendes ist dabei herausgekommen:
Code:
# configuration.yaml or a dedicated package file (e.g., sensors.yaml)

template:
  - sensor:
      - name: "Sensor 358 Humi"
        unique_id: "sensor_358_humi_template" # Optional: Add a unique_id for better entity management
        state: >-
          {% set val = states('sensor.tp358_e551_humidity') | float(0) %}
          {% if 35 <= val <= 100 %}
            {{ val }}
          {% else %}
            None
          {% endif %}
        unit_of_measurement: "%"
        device_class: "humidity"
        state_class: "measurement"

      - name: "Sensor 358 Temp"
        unique_id: "sensor_358_temp_template" # Optional: Add a unique_id for better entity management
        state: >-
          {% set val = states('sensor.tp358_e551_temperature') | float(0) %}
          {% if 10 <= val <= 40 %}
            {{ val }}
          {% else %}
            None
          {% endif %}
        unit_of_measurement: "°C"
        device_class: "temperature"
        state_class: "measurement"
 
  • Gefällt mir
Reaktionen: n/a
Zurück
Oben