Hi everybody,
I am currently (once again ) trying to get a more sensible structure to my configuration yaml files. Iβd like to create a file containing yaml anchors that I need in multiple different files in that folder. Can you please help me figure out how to do this?
Example folder structure; the anchors.yaml
file is the one Iβd like to include in both packages/radiators/bedroom.yaml
and packages/radiators/bathroom.yaml
.
root_folder/
|- packages/
|- lights/
|- kitchen.yaml
|- livingroom.yaml
| (etc.)
|- radiators/
|- bedroom.yaml
|- bathroom.yaml
|- ==> anchors.yaml
This is an example for the current radiators configuration; it contains all radiators (so it is not -as in the example above- split into one file per room. This is fine, but since I have different things I want to happen in different rooms, Iβd like to split it up in one config per room. But when I do, the current solution (below) that I am using will not work.
input_number:
az_morgens:
name: "AZ 08:30"
initial: 16.5
<<: &input_template
min: 5
max: 30
step: 0.5
icon: mdi:radiator
unit_of_measurement: "Β°C"
wz_morgens:
name: "WZ 07:45"
initial: 19.5
<<: *input_template
az
being study and wz
being livingroom; as per definition above, these two entities, that are currently in the same .yaml
file would be in two separate files; so wz_morgens
would not be able to access *input_template
; my solution would be an anchors.yam
file something like this (not sure about indentation hereβ¦)
<<: &input_template
min: 5
max: 30
step: 0.5
icon: mdi:radiator
unit_of_measurement: "Β°C"
Then in both wz.yaml
and az.yaml
Iβd somehow have to integrate this file
az.yaml
!include `anchors.yaml`
az_morgens:
name: "AZ 08:30"
initial: 16.5
<<: *input_template
and
wz.yaml
!include `anchors.yaml`
wz_morgens:
name: "WZ 07:45"
initial: 19.5
<<: *input_template
However, if I understand yaml
correctly, you can only !include
something when it is behind a colon, for example sensor: !include_dir_merge_named sensor/
β¦ in my case, Iβd somehow have to be able to just have !include anchors.yaml
β¦
Can this be done somehow? Or is there another solution for what Iβd like to do?
I am doing this because my packages/
folder alone is getting out of hand! I have too many subdirectories for things that donβt need them on one hand, and some files I was βforcedβ to combine because of this issue that should rather be separate files.
.
βββ haus
β βββ bad_oben_test.yaml
β βββ gewitter.yaml
β βββ grandfather_clock.yaml
β βββ grocy.yaml
β βββ neato.yaml
β βββ notify_changes.yaml
β βββ notify_jonna_trinken.yaml
β βββ notify_script.yaml
β βββ podcasts_gpodder.yaml
β βββ r_arbeitszimmer.yaml
β βββ r_draussen.yaml
β βββ r_dusche.yaml
β βββ r_kueche.yaml
β βββ r_schlafzimmer.yaml
β βββ routine_guten_morgen.yaml
β βββ routine_tv.yaml
β βββ spezialtage_sensor.yaml
β βββ tasmota_schalter.yaml
β βββ timer.yaml
β βββ wecker.yaml
β βββ zeitsteuerung.yaml
βββ heizungen
β βββ baeder.yaml
β βββ flur.yaml
β βββ fritzbox.yaml
β βββ heizungen_mit_template.yaml
β βββ wohnzimmer.yaml
β βββ zeitsteuerung_heizungen.yaml
βββ homeassistant
β βββ anzahlen.yaml
β βββ batterien.yaml
β βββ browser_mod.yaml
β βββ conversation.yaml
β βββ customize.yaml
β βββ customize.yaml.backup
β βββ devices_im_netzwerk.yaml
β βββ discovery.yaml
β βββ downloader.yaml
β βββ feiertage.yaml
β βββ groups.yaml
β βββ hacs.yaml
β βββ influxdb.yaml
β βββ locations_usw.yaml
β βββ logbook.yaml
β βββ logger.yaml
β βββ mqtt.yaml
β βββ neato.yaml
β βββ notify.yaml
β βββ panel_iframe.yaml
β βββ recorder.yaml
β βββ shellies_discovery.yaml
β βββ shopping_list.yaml
β βββ synology.yaml
β βββ tankerkoenig.yaml
β βββ tts.yaml
β βββ unifi.yaml
β βββ wetter.yaml
β βββ zones.yaml
βββ licht
β βββ bad_oben.yaml
β βββ festlegen.yaml
β βββ flur.yaml
β βββ flux.yaml
β βββ haustuer.yaml
β βββ kueche.yaml
β βββ licht.yaml
β βββ scenes.yaml
β βββ sonnensensor.yaml
β βββ wohnzimmer.yaml
β βββ xmas.yaml
β βββ zwischenzimmer.yaml
β βββ zwischenzimmer_led.yaml
βββ media
β βββ alexa.yaml
β βββ chromecast.yaml
β βββ firetv.yaml
β βββ firetv_tor.yaml
β βββ kodi.yaml
β βββ licht_media.yaml
β βββ media_extractor.yaml
β βββ mpd.yaml
β βββ nvidia_shieldtv.yaml
β βββ plex.yaml
β βββ sonos.yaml
β βββ tv.yaml
βββ misc
β βββ caldav.yaml
β βββ calendar.yaml
β βββ day_of_week.yaml
β βββ hundefutter.yaml
β βββ jahreszeit.yaml
β βββ mond.yaml
β βββ sabnzbd.yaml
β βββ sonarr.yaml
β βββ soziale_netzwerke.yaml
β βββ time.yaml
β βββ unifi.yaml
βββ remotes
β βββ broadlink.yaml
β βββ button_schlafzimmer.yaml
β βββ espurna.yaml
β βββ zigbee2mqtt.yaml
β βββ zigbee2mqtt_networkmap.yaml
βββ security
β βββ alert.test_funktioniert
β βββ cams_alle.yaml
β βββ cams_dafang.yaml
β βββ rauchmelder.yaml
β βββ security_tor.yaml
β βββ security_unterstand.yaml
βββ tasmota
β βββ energyreset_total.yaml
β βββ tasmota_startup.yaml
βββ telegram
β βββ abfragen.yaml
β βββ callback.yaml
β βββ cameras_telegram.yaml
β βββ jonna_trinken.yaml
β βββ klingel.yaml
β βββ telegram_bot.yaml
β βββ tor.yaml
β βββ wuff.yaml
βββ testing
β βββ test_wled.yaml
β βββ zeittest.yaml
βββ 00.yaml
Instead of all this, I could instead have one package per room (plus one for things that do not have a location, or work in multiple locations); but thatβd require me to import the template somehow, as az.yaml
would be in packages/az
(containing all things related to the study) and wz.yaml
would be in packages/wz
with everything related to the livingroomβ¦
THank you for your ideas