Yaml for integrations, rooms (at least backup...)

Hi everybody,

I have read https://community.home-assistant.io/t/yaml-vs-ui-managed-integrations/120476 already, but perhaps something has changed since then, and even if not, I have another question regarding this that was not addressed there.

Is there a way to manually configure integrations and rooms (not sure if it is actually “rooms” in English; I use German home-assistant and am talking about the settings -> area register or similar)?

So this is what this is mostly about:

  • ESPHome devices (both backing up existing devices and deleting unused entities that used to be on those devices)
  • UniFi device presence
  • devices added via mqtt auto discovery

Examples:

  1. I have tried dozens of times to manually add device presence detection via configuration.yaml. It had never worked, and I gave up on it. Today I was clicking around the settings and saw that UniFi was also an option when manually adding integrations. So I did - and it worked right away. Of course I had always used the correct URL, username, and password, but was never able to actually connect to my UniFi controller - but now that I did it via webGUI, it worked like a charm.

  2. I use zigbee2mqtt hand in hand with home-assistant’s mqtt discovery, so whenever there is a new device connected to my CC2531 zigbee usb stick, it will automatically connect to home-assistant. This is great! But I use home-assistant both on my home server (actual automation) and on my main computer (testing new features before deploying to home server etc.). I try to always assign things like friendly_name via customize.yaml, but I have occasionally forgotten to so. In those cases, writing automations was very painful for me. I’d be sure the automation was correct, but it would not work. When I then tested it on the other host (because some things would just not work from my main computer’s docker home-assistant, but would work fine from the homeserver’s docker home-assistant), they would work as expected, because that server had a different friendly_name and/or entity_id there than it did on my main computer.

While point 2 is actually somewhat good because it makes me focus on configuration files more, it would be great to synchronize integrations just like my other configuration files so they are always exactly the same on both machines.

Also, I just got into ESPHome… so I have (at least) one test device that I constantly flash with different firmware to test different sensors, relays, etc. etc. When I re-flash a device, I have not found a decent¹ way to delete old entities from home-assistant that those ESPHome devices no longer a) have in their config nor b) are physically connected to.
(Example: I have a “testy” ESPHome that now has multiple buttons, binary switches, relays, etc. assigned to it in home-assistant, though currently it only watches for BLE devices and when flashing, the config has been edited to not include those entities still displayed in home-assistant any longer).

¹ I found that deleting the home-assistant.db file would get the job done, but it would also (of course) get rid off everything else that db contained, which I sometimes wouldn’t want deleted just to get rid off some no longer used entity.

And lastly, it is possible to assign integrations to rooms; by default, there is bedroom, kitchen, and livingroom, but I’d like to add all rooms I actually have… but it seems like there is no way to sync this between my testing hass and productive hass server.

Thanks in advance for your input :pray:

All of the areas, devices, and entities configured through the GUI are in json files inside .storage

They are human readable files and are not a database.

Wouldn’t that negate the advantage of having a “development” system and a “production” system if the two systems were always exactly the same?

But if you really wanted that you could always run syncthing in docker to synchronize your two config directories.

I’m pretty sure you can just go into the “entity registry” area of the configuration page and delete individual entities. Or you can go to the “integrations” section of the same page and then select the device and delete the whole device from there.

1 Like

Thank you @flamingm0e I have found the file that I need for this issue :slight_smile: That is much better than always deleting the entire configuration directory as I still keep my logins etc. this way.

The difficulty here was that I have not set up my home-assistant enough for it to "just work"™ and only add a new automation and/or device every once in a while. I am constantly messing with the configuration, and especially ESPHome devices act a bit strange when it comes to this. I’ll create one with two binary_input (hardware) buttons, flash it, and home-assistant finds it. When I re-flash that very device and remove those buttons from the config, they will still be shown inside home-assistant. This really messed with some rules for LED strips, as I assumed they’d be called light.room_x|y_window, but instead I’d have to change my scenes to light.room_x|y_window_2. Even though they should have “overwritten” the test devices I had created (and then removed from) via EPSHome while still testing.

So in my testing environment, everything worked fine, and when I pushed it to the server, the LEDs wouldn’t change. This is because my testing environment did not have the additional lights added to it (because it only runs when I need it to) and didn’t create the _2 at the end.

It would be much easier on me to just copy those files from the server to my testing instance while constantly re-flashing my nodeMCUs so that they will both work with the same entity_ids. I will hopefully not have to do this once everything is set up the way I want it to.