<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Michael Bernhart</title>
    <description>The latest articles on DEV Community by Michael Bernhart (@cloudapp_dev).</description>
    <link>https://dev.to/cloudapp_dev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3974608%2Fc22d5e7e-7665-4ecb-b10b-4d4bb29e2c04.png</url>
      <title>DEV Community: Michael Bernhart</title>
      <link>https://dev.to/cloudapp_dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cloudapp_dev"/>
    <language>en</language>
    <item>
      <title>Home Assistant 2026.11 Upgrade: HACS to Marketplace</title>
      <dc:creator>Michael Bernhart</dc:creator>
      <pubDate>Fri, 20 Nov 2026 07:13:34 +0000</pubDate>
      <link>https://dev.to/cloudapp_dev/home-assistant-202611-upgrade-hacs-to-marketplace-1p3k</link>
      <guid>https://dev.to/cloudapp_dev/home-assistant-202611-upgrade-hacs-to-marketplace-1p3k</guid>
      <description>&lt;p&gt;On 10 November I upgraded my Home Assistant from 2026.9.4 straight to 2026.11.1 and skipped 2026.10. It runs as a Docker container with a pinned image tag. I had waited for the first bugfix release on purpose: 2026.11 replaces HACS with the built-in Marketplace, and I had no wish to find its first bugs on the instance that runs my house.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I checked before switching
&lt;/h2&gt;

&lt;p&gt;Because I skipped 2026.10, I read the release notes of both versions. The section on backward-incompatible changes had 22 entries for 2026.10 and 45 for 2026.11. None of them named an integration I use. A handful are general: usernames are now always normalised, state conditions that combine &lt;code&gt;for&lt;/code&gt; with an attribute fail validation, the sign of a sun trigger offset now decides before or after, and entity names on dashboards are built from the device name. I searched my YAML for sun triggers with an offset, alert cards and that kind of state condition and found none.&lt;/p&gt;

&lt;p&gt;Then I checked my configuration with the new version before switching the running container. I copied the config directory without the database and the backups to &lt;code&gt;/tmp/hacheck&lt;/code&gt;, then ran the command below once with 2026.9.4 and once with 2026.11.1:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run --rm --network none -v /tmp/hacheck:/config \
  --entrypoint python3 ghcr.io/home-assistant/home-assistant:2026.11.1 \
  -m homeassistant --script check_config -c /config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Old and new image printed the same result. The only error was a media folder that the test container doesn't mount, and it showed up in both runs. Last step before switching: a fresh backup, 131 MB. I keep backups as described in &lt;a href="https://www.cloudapp.dev/home-assistant-backup-s3-compatible-storage" rel="noopener noreferrer"&gt;my post on backups to S3-compatible storage&lt;/a&gt;. On the first start the KNX telegram history logged a database schema migration, so for a rollback I would have restored the backup first. I haven't tested whether the old image still runs against the migrated database.&lt;/p&gt;

&lt;h2&gt;
  
  
  The switch itself
&lt;/h2&gt;

&lt;p&gt;The switch was one line in the compose file and a recreate, the same routine as in &lt;a href="https://www.cloudapp.dev/home-assistant-docker-update-rollback" rel="noopener noreferrer"&gt;my Docker update workflow&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sed -i &lt;span class="s1"&gt;'s#home-assistant:2026.9.4#home-assistant:2026.11.1#'&lt;/span&gt; docker-compose.yml
docker compose up -d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The API answered at my first check, a few seconds after the container started. I compared all entity states before and after: 680 entities both times. After the restart, four detection sensors of my Tapo cameras and the new backup size sensor were unavailable. After every restart the Tapo sensors become available again with the first camera event, and the backup size sensor reports a value after the next backup.&lt;/p&gt;

&lt;h2&gt;
  
  
  What happened to HACS
&lt;/h2&gt;

&lt;p&gt;I had HACS 2.0.5 installed, with two custom integrations from it: Midea AC LAN and Tapo Control. After the first start the &lt;code&gt;hacs&lt;/code&gt; folder under &lt;code&gt;custom_components&lt;/code&gt; was gone and so was the HACS entry in the sidebar. In its place there is a config entry called &lt;code&gt;marketplace&lt;/code&gt;, found under Settings → Marketplace. No repair came up.&lt;/p&gt;

&lt;p&gt;Both integrations are listed in the Marketplace as installed, with their update entities. The template &lt;code&gt;integration_entities('marketplace')&lt;/code&gt; returns those two entities, and &lt;code&gt;integration_entities('hacs')&lt;/code&gt; returns an empty list. The old &lt;code&gt;update.hacs_update&lt;/code&gt; entity disappeared. The Marketplace stores its catalogue in the &lt;code&gt;.storage&lt;/code&gt; folder, about 3 MB for 5,000 repositories.&lt;/p&gt;

&lt;p&gt;One detail survived the migration that I hadn't expected. Version 2026.10.0 of Midea AC LAN, released on 23 October, was marked as skipped in HACS, and the Marketplace kept that skip. The update entity therefore showed no pending update although a newer version was listed.&lt;/p&gt;

&lt;h2&gt;
  
  
  The first update through the Marketplace
&lt;/h2&gt;

&lt;p&gt;I used that skipped Midea update to try installation and restart through the Marketplace. I ran it from a script over the Home Assistant API, so I could keep the exact responses. The first attempt failed with this message:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Open the Marketplace and read the warning first, installing and updating work once it is accepted
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Marketplace stores for each user whether they accepted the warning, and after the migration from HACS I still had to accept it. After I accepted the warning, the install went through in about a second, and the Marketplace raised a repair saying a restart was required. After the restart Midea AC LAN ran on 2026.10.0 and both of its entities were available. What I describe in &lt;a href="https://www.cloudapp.dev/how-to-install-hacs-in-home-assistant" rel="noopener noreferrer"&gt;my HACS install guide&lt;/a&gt; about the Marketplace beyond this comes from the release notes and the documentation. I haven't added a new project through it yet.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the log showed afterwards
&lt;/h2&gt;

&lt;p&gt;Midea AC LAN still writes 29 deprecation warnings at start, about temperature properties of its climate and water heater entities. The update to 2026.10.0 didn't change that. A later Home Assistant release may stop supporting those properties, so I will check the integration before the next upgrade.&lt;/p&gt;

&lt;p&gt;The old log file was 155 MB, mostly about 242,000 lines of TP-Link errors with status 403 for two devices, going back to 23 October. That had nothing to do with the upgrade. My old and new instance still run &lt;a href="https://www.cloudapp.dev/home-assistant-migration-old-and-new-in-parallel" rel="noopener noreferrer"&gt;in parallel&lt;/a&gt; and both polled the same bulb and the same plug with the same account. As far as I can tell, every login of one instance ended the session of the other. I disabled the two devices on the new instance, and the errors stopped.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Do I have to reinstall my HACS integrations?
&lt;/h3&gt;

&lt;p&gt;On my instance, no. Both integrations were adopted on the first start and kept their update entities.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I go from 2026.9 straight to 2026.11?
&lt;/h3&gt;

&lt;p&gt;I did. Read the backward-incompatible changes of both releases first, because a skipped release still applies its changes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does the Marketplace work with Home Assistant Container?
&lt;/h3&gt;

&lt;p&gt;Yes, on my Docker install it was there after the first start with no extra step. I haven't tested Core in a Python virtual environment.&lt;/p&gt;

</description>
      <category>homeassistant</category>
      <category>hacs</category>
      <category>smarthome</category>
      <category>selfhosted</category>
    </item>
    <item>
      <title>KNX Heating in Home Assistant: 21 Automations Become 6</title>
      <dc:creator>Michael Bernhart</dc:creator>
      <pubDate>Tue, 17 Nov 2026 08:22:08 +0000</pubDate>
      <link>https://dev.to/cloudapp_dev/knx-heating-in-home-assistant-21-automations-become-6-4mln</link>
      <guid>https://dev.to/cloudapp_dev/knx-heating-in-home-assistant-21-automations-become-6-4mln</guid>
      <description>&lt;p&gt;The heating logic of my KNX house was 21 automations on the old Home Assistant instance. On the new instance it is 6. I moved it on 26 September as one step of a larger migration, from an instance on 2024.11.1 to a new one on 2026.8, and I kept a journal entry while doing it. During the move I changed what happens when a window is closed at night, and the next morning the two instances showed different operating modes for all 11 thermostats. The background on how the room controllers are driven is in my post on &lt;a href="https://www.cloudapp.dev/home-assistant-knx-thermostat-preset-modes" rel="noopener noreferrer"&gt;KNX thermostat preset modes&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What moved
&lt;/h2&gt;

&lt;p&gt;The old file held three groups. 16 automations handled open windows in 8 rooms. 4 handled the night mode at 21:00 and the day mode at 05:00, including applying the mode to 11 thermostats. 1 automation re-sent the mode after a Home Assistant start, and it had been switched off since January. On the new instance the 16 are 1, the 4 stay 4, and the startup automation came along, still switched off. I first copied the night-mode helper unchanged and removed &lt;code&gt;initial: off&lt;/code&gt; on 9 October.&lt;/p&gt;

&lt;p&gt;All six are installed on the new instance but disabled with &lt;code&gt;initial_state: false&lt;/code&gt;. They would switch the operating mode of the KNX room controllers on the bus, and the old instance kept doing that job. Since 6 November only its window automations have remained active, as described in the addendum before the FAQ. I did not want two instances writing operating modes to the same controllers.&lt;/p&gt;

&lt;p&gt;Two small things turned up while copying. One old entity id says day mode 06:00 while the automation runs at 05:00, and on the new instance the id matches the time. The old registry also still carries an orphaned entry for a temperature snapshot automation that was deleted long ago, shown as unavailable, and I left it on the old instance.&lt;/p&gt;

&lt;h2&gt;
  
  
  16 copies become one automation with a table
&lt;/h2&gt;

&lt;p&gt;The 16 window automations were copies made in the UI. Each room had one named deactivate (window open for 5 seconds, set frost protection) and one named activate (window closed for 5 seconds, set comfort). Within each group of eight they differed only in the names of the window sensor and the thermostat. The idea itself is covered in my post on &lt;a href="https://www.cloudapp.dev/home-assistant-knx-window-open-heating-off" rel="noopener noreferrer"&gt;switching the heating off when a window opens&lt;/a&gt;, and it works. With 16 copies, even a change that only concerns closing a window has to be made 8 times.&lt;/p&gt;

&lt;p&gt;The new version is one automation with two triggers, open and closed, told apart by a trigger id. The room-specific part is a table held in a variable that maps each window sensor to its thermostat, and the action looks up the thermostat by the entity that triggered. The room labels and entity ids below are placeholders.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;automation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;heating_window_frost_protection&lt;/span&gt;
    &lt;span class="na"&gt;alias&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Heating: window open -&amp;gt; frost protection, closed -&amp;gt; current mode"&lt;/span&gt;
    &lt;span class="na"&gt;initial_state&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;          &lt;span class="c1"&gt;# shadow mode during the migration
&lt;/span&gt;    &lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;parallel&lt;/span&gt;
    &lt;span class="na"&gt;variables&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;thermostat_by_window&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;&amp;amp;thermostat_by_window&lt;/span&gt;   &lt;span class="c1"&gt;# one line per room, 8 in the real file
&lt;/span&gt;        &lt;span class="na"&gt;binary_sensor.window_room_a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;climate.thermostat_room_a&lt;/span&gt;
        &lt;span class="na"&gt;binary_sensor.window_room_b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;climate.thermostat_room_b&lt;/span&gt;
        &lt;span class="na"&gt;binary_sensor.window_room_c&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;climate.thermostat_room_c&lt;/span&gt;
    &lt;span class="na"&gt;triggers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;trigger&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;state&lt;/span&gt;
        &lt;span class="na"&gt;entity_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;&amp;amp;windows&lt;/span&gt;
          &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;binary_sensor.window_room_a&lt;/span&gt;
          &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;binary_sensor.window_room_b&lt;/span&gt;
          &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;binary_sensor.window_room_c&lt;/span&gt;
        &lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"off"&lt;/span&gt;
        &lt;span class="na"&gt;to&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"on"&lt;/span&gt;
        &lt;span class="na"&gt;for&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;seconds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
        &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;open&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;trigger&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;state&lt;/span&gt;
        &lt;span class="na"&gt;entity_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;*windows&lt;/span&gt;
        &lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"on"&lt;/span&gt;
        &lt;span class="na"&gt;to&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"off"&lt;/span&gt;
        &lt;span class="na"&gt;for&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;seconds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
        &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;closed&lt;/span&gt;
    &lt;span class="na"&gt;actions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;climate.set_preset_mode&lt;/span&gt;
        &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;entity_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"{{ thermostat_by_window[trigger.entity_id] }}"&lt;/span&gt;
        &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="c1"&gt;# BEHAVIOUR CHANGE: the old version always set comfort on closing
&lt;/span&gt;          &lt;span class="na"&gt;preset_mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="s"&gt;-&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;%&lt;/span&gt; &lt;span class="s"&gt;if&lt;/span&gt; &lt;span class="s"&gt;trigger.id&lt;/span&gt; &lt;span class="s"&gt;==&lt;/span&gt; &lt;span class="s1"&gt;'open'&lt;/span&gt; &lt;span class="s"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt;building_protection&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;%&lt;/span&gt; &lt;span class="s"&gt;elif&lt;/span&gt; &lt;span class="s"&gt;is_state('input_boolean.heating_night_mode'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'on'&lt;/span&gt;&lt;span class="s"&gt;)&lt;/span&gt; &lt;span class="s"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt;economy&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;%&lt;/span&gt; &lt;span class="s"&gt;else&lt;/span&gt; &lt;span class="s"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt;comfort{% endif %}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The window list appears once in the file, and the second trigger reuses it through a YAML anchor, &lt;code&gt;&amp;amp;windows&lt;/code&gt; and &lt;code&gt;*windows&lt;/code&gt;. For a new room I add one line to the table, one to the window list and one to the list of thermostats. The preset that the KNX climate entity uses for frost protection is called &lt;code&gt;building_protection&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The next excerpt continues the same automation list and shows the night automation as it is since 9 October. It reuses the window table through the anchor &lt;code&gt;&amp;amp;thermostat_by_window&lt;/code&gt; and defines a second anchor, &lt;code&gt;&amp;amp;all_thermostats&lt;/code&gt;, for the list of the 11 thermostats. From those two it computes the thermostats whose window is open and switches only the others. The day automation and the startup automation use the same variables block and are not shown.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;heating_night_mode_activate&lt;/span&gt;
    &lt;span class="na"&gt;alias&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Heating: apply night mode to all thermostats"&lt;/span&gt;
    &lt;span class="na"&gt;initial_state&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
    &lt;span class="na"&gt;triggers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;trigger&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;state&lt;/span&gt;
        &lt;span class="na"&gt;entity_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;input_boolean.heating_night_mode&lt;/span&gt;
        &lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"off"&lt;/span&gt;
        &lt;span class="na"&gt;to&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"on"&lt;/span&gt;
    &lt;span class="na"&gt;variables&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;thermostat_by_window&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;*thermostat_by_window&lt;/span&gt;
      &lt;span class="na"&gt;all_thermostats&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;&amp;amp;all_thermostats&lt;/span&gt;   &lt;span class="c1"&gt;# 11 entries in the real file
&lt;/span&gt;        &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;climate.thermostat_room_a&lt;/span&gt;
        &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;climate.thermostat_room_b&lt;/span&gt;
        &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;climate.thermostat_room_c&lt;/span&gt;
      &lt;span class="na"&gt;window_open&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="s"&gt;-&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;%&lt;/span&gt; &lt;span class="s"&gt;set&lt;/span&gt; &lt;span class="s"&gt;ns&lt;/span&gt; &lt;span class="s"&gt;=&lt;/span&gt; &lt;span class="s"&gt;namespace(l=[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="s"&gt;) %}&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;%&lt;/span&gt; &lt;span class="s"&gt;for&lt;/span&gt; &lt;span class="s"&gt;window&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;thermostat&lt;/span&gt; &lt;span class="s"&gt;in&lt;/span&gt; &lt;span class="s"&gt;thermostat_by_window.items()&lt;/span&gt; &lt;span class="s"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
          &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;%&lt;/span&gt; &lt;span class="s"&gt;if&lt;/span&gt; &lt;span class="s"&gt;is_state(window&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'on'&lt;/span&gt;&lt;span class="s"&gt;)&lt;/span&gt; &lt;span class="s"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;%&lt;/span&gt; &lt;span class="s"&gt;set&lt;/span&gt; &lt;span class="s"&gt;ns.l&lt;/span&gt; &lt;span class="s"&gt;=&lt;/span&gt; &lt;span class="s"&gt;ns.l&lt;/span&gt; &lt;span class="s"&gt;+&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;thermostat&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="s"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;%&lt;/span&gt; &lt;span class="s"&gt;endif&lt;/span&gt; &lt;span class="s"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;%&lt;/span&gt; &lt;span class="s"&gt;endfor&lt;/span&gt; &lt;span class="s"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s"&gt;ns.l&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;targets&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"{{ all_thermostats | reject('in', window_open) | list }}"&lt;/span&gt;
    &lt;span class="na"&gt;actions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"{{ targets | count &amp;gt; 0 }}"&lt;/span&gt;
        &lt;span class="na"&gt;then&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
          &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;climate.set_preset_mode&lt;/span&gt;
            &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;preset_mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;economy&lt;/span&gt;
            &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;entity_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"{{ targets }}"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  A bug that could happen every night
&lt;/h2&gt;

&lt;p&gt;On the old instance, closing a window always set comfort, including at midnight. Anyone who aired a room at night put that room back on comfort, and the next scheduled mode change only came at 05:00. Each of the 8 activate copies had this behaviour.&lt;/p&gt;

&lt;p&gt;The new automation sets the mode that currently applies when a window is closed, economy at night and comfort during the day. It is still switched off, like everything else from this step. That is the elif branch in the template above, which checks the night-mode helper. It is a deliberate behaviour change and there is a comment in the code saying so. I have no measurement of how often it happened or what it cost in heating energy. When I copied the automations, the scheduled switch at 21:00 and at 05:00 wrote the new mode to all 11 thermostats without looking at the windows, so a room with an open window left frost protection at that moment. The old instance does the same. On 9 October I changed it on the new one, as the excerpt above shows. The night, day and startup automations now skip thermostats whose window is open, and the window automation sets the current mode when the sensor goes from on to off and stays there for five seconds; a sensor that comes back from unknown or unavailable to off does not trigger it. I have checked the target list through the template API with one window simulated as open, which gave 10 of 11 thermostats. A real run is still missing because the automations are off. A window sensor that is unknown counts as closed, and three thermostats have no window sensor at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  Missing operating mode feedback after a restart
&lt;/h2&gt;

&lt;p&gt;The next morning I compared both instances. The old one showed all thermostats on comfort, the new one showed them on standby. The new instance had followed the change at 05:00 correctly by listening on the bus. After a restart at 07:19 it queried the operating mode and got standby back.&lt;/p&gt;

&lt;p&gt;The cause is in the ETS project. My configuration has no readable feedback for the active operating mode. Home Assistant therefore queries the object that is used to switch the mode, and that object does not return the mode that is actually active. The old instance showed comfort only because it had written comfort itself. After its own restart the evening before it had shown standby as well, which was wrong too.&lt;/p&gt;

&lt;p&gt;What the controllers do report back is the setpoint temperature. On that morning they reported 20.0 °C, which matches the comfort value; 18.0 °C would be the night value. That is only a hint at the mode: a later test showed that the reported setpoint also moves with a local adjustment at the controller, by −1 to −2 K in the room I tested (details in the thermostat post linked at the end). I have written about &lt;a href="https://www.cloudapp.dev/home-assistant-knx-thermostat-standby-after-restart-fix" rel="noopener noreferrer"&gt;thermostats showing standby after a restart&lt;/a&gt; before, including the startup automation that works around it. On the old instance that automation has been switched off since January, and this comparison showed the symptom on both instances.&lt;/p&gt;

&lt;h2&gt;
  
  
  I mistook Z-BMU for a status object
&lt;/h2&gt;

&lt;p&gt;The ETS export lists two objects per room controller. One is named BMU plus the room, for Betriebsmodus-Umschaltung, the operating mode switch-over. Next to it is one named Z-BMU plus the room, with the datapoint type for operating modes. I read the Z as Zustand, the German word for state, and the pattern held for all 11 rooms. It looked like the 11 status addresses I was missing.&lt;/p&gt;

&lt;p&gt;Z stands for Zwangsführung, forced operation. The object is not readable. An earlier cleanup of this configuration had already removed exactly these addresses as wrong feedback, and that cleanup is documented in the repository. I caught it because I checked that documentation before entering the addresses again.&lt;/p&gt;

&lt;p&gt;Abbreviations in an ETS project are vendor-specific. Before I enter any address as a status address now, I open the object in ETS and look at its flags. For the query after a restart I need an object that returns the active mode and answers read requests, and the object name does not tell me that.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this means for the switch-over
&lt;/h2&gt;

&lt;p&gt;After a restart both instances can show the wrong operating mode until they see a mode change on the bus or write one themselves. That makes the startup automation, disabled since January, more important than it looked. It had an inconsistency when I copied it: at night it set economy, while the night-mode automation set standby. On 9 October I settled that. Economy now applies at night in the window, night and startup automations. I also removed &lt;code&gt;initial: off&lt;/code&gt; from the night-mode helper, because with it the helper was off after every restart and the startup automation would have set comfort at night. Now it restores its previous value, which can still be wrong if Home Assistant was down at the switching time.&lt;/p&gt;

&lt;p&gt;The next step is in ETS. I still have to check there whether these controllers offer a readable object for the active operating mode. If they do, it gets its own group address, and that address goes into the Home Assistant configuration. I copied the automations before checking that. Until it is done the reported setpoint is the best hint I have, keeping in mind that a local adjustment at the controller shifts it too, as described in &lt;a href="https://www.cloudapp.dev/home-assistant-knx-thermostat-preset-modes" rel="noopener noreferrer"&gt;the post on base and active setpoint&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Addendum, November 2026: On 6 November I switched off the four night and day automations on the old instance, so it no longer changes the operating mode at 21:00 and 05:00. The heating pump only runs from 05:00 to 07:30 and from 17:00 to 20:00, so it is off throughout the night-mode period from 21:00 to 05:00. In the temperature history of 5 and 6 November no room fell to its standby setpoint, and what I did notice were two push notifications a day. The window automations on the old instance are still on. On the new instance all six automations are still switched off, and the pump is also off during the economy-mode period described above.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Why does a KNX thermostat show standby in Home Assistant after a restart?
&lt;/h3&gt;

&lt;p&gt;In my setup the query after a restart reads the object that switches the mode, and that returns standby even when comfort is active. I can only speak for this ETS project.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I check whether a KNX group address can be used as a status address?
&lt;/h3&gt;

&lt;p&gt;Check in ETS whether the object behind the group address reports the active operating mode and has its read flag set. The object name is no evidence, because abbreviations are vendor-specific.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is one automation with a mapping table better than one automation per room?
&lt;/h3&gt;

&lt;p&gt;For my 8 rooms, yes. I change the window logic in one place instead of in 16 automations, and the price is a YAML file with a template instead of the UI.&lt;/p&gt;

</description>
      <category>homeassistant</category>
      <category>knx</category>
      <category>automation</category>
      <category>smarthome</category>
    </item>
    <item>
      <title>Home Assistant Backups on S3-Compatible Storage, Not AWS</title>
      <dc:creator>Michael Bernhart</dc:creator>
      <pubDate>Mon, 09 Nov 2026 07:46:32 +0000</pubDate>
      <link>https://dev.to/cloudapp_dev/home-assistant-backups-on-s3-compatible-storage-not-aws-3mma</link>
      <guid>https://dev.to/cloudapp_dev/home-assistant-backups-on-s3-compatible-storage-not-aws-3mma</guid>
      <description>&lt;p&gt;The Home Assistant instance I am rebuilding on a small Hetzner VM had been running for weeks, by then with real house logic on it, when I opened its backup settings during the migration and found zero backups. I have written before about &lt;a href="https://www.cloudapp.dev/home-assistant-backup-strategy-full-host" rel="noopener noreferrer"&gt;what belongs in a backup of the whole host&lt;/a&gt; and about &lt;a href="https://www.cloudapp.dev/home-assistant-disaster-recovery-rebuild" rel="noopener noreferrer"&gt;rebuilding after a loss&lt;/a&gt;. Those two posts cover what to back up and how to restore it. This post covers copying the Home Assistant backup to S3-compatible object storage outside AWS, and getting a notification when the latest local backup or the last completed run of the copy job is more than 30 hours old.&lt;/p&gt;

&lt;h2&gt;
  
  
  What was missing
&lt;/h2&gt;

&lt;p&gt;The backup settings said &lt;code&gt;automatic_backups_configured: false&lt;/code&gt; and listed no backups. The only thing that was saved was the whole VM, through Hetzner snapshots. My own setup notes for this VM already listed a config backup on Home Assistant level as open, with the remark that the VM snapshot does not replace it. I then moved real logic onto the instance without closing that item. I only found the gap because the migration made me read the settings page.&lt;/p&gt;

&lt;p&gt;Object storage was already at hand. On the same day a media archive I run on the same machine had moved from Azure Blob Storage to Hetzner Object Storage, because the old upload logged in through the managed identity of an Azure VM, and a Hetzner VM has none. The bucket sits in the same project and at the same location as the VM. I created the bucket and the access keys in the Hetzner console. The hcloud CLI manages Storage Boxes and not Object Storage, and I did not script this step with an S3 tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the built-in aws_s3 integration rejects other providers
&lt;/h2&gt;

&lt;p&gt;Home Assistant 2026.8 ships an integration called &lt;code&gt;aws_s3&lt;/code&gt; as a backup location, and its setup form has an endpoint URL field that can be filled in freely. That looked like the obvious solution. The config flow of the integration contains this check, quoted from its source: &lt;code&gt;if not hostname.endswith("amazonaws.com")&lt;/code&gt;, the form returns &lt;code&gt;invalid_endpoint_url&lt;/code&gt;. The field exists, and the validation behind it excludes every other S3-compatible provider.&lt;/p&gt;

&lt;p&gt;So I went one level lower and split the job in two. Home Assistant writes its backup to the local disk, which it can do without any backup location integration, and a small script of my own handles the transport to the bucket.&lt;/p&gt;

&lt;h2&gt;
  
  
  The setup: a local encrypted backup and a separate copy job
&lt;/h2&gt;

&lt;p&gt;Home Assistant now creates an encrypted automatic backup every day at 03:30 and keeps 7 of them locally. At 04:40 a systemd timer on the host starts the copy script inside the Home Assistant container. Running it there has a practical reason: boto3 is already part of the official Home Assistant container image, so the script needs no additional dependency and no second Python environment on the host.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="c"&gt;# ha-backup-s3.timer
# runs after the automatic Home Assistant backup at 03:30
&lt;/span&gt;&lt;span class="nn"&gt;[Timer]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="py"&gt;OnCalendar&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;*-*-* 04:40:00&lt;/span&gt;
&lt;span class="py"&gt;Persistent&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;true&lt;/span&gt;
&lt;span class="py"&gt;Unit&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;ha-backup-s3.service&lt;/span&gt;
&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="c"&gt;# ha-backup-s3.service
# the script runs inside the HA container, boto3 is already there
&lt;/span&gt;&lt;span class="nn"&gt;[Service]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="py"&gt;Type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;oneshot&lt;/span&gt;
&lt;span class="py"&gt;ExecStart&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;/usr/bin/docker exec homeassistant python /config/tools/ha_backup_s3.py&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The script itself deletes nothing in the cloud. Retention is a lifecycle rule on the bucket that removes objects after 180 days, so Hetzner does the deleting, for the Home Assistant backups and for that archive alike. Locally Home Assistant cleans up on its own and keeps its 7. The access keys are in the password manager and in a secrets file on the VM, and the script reads them at run time. How the container gets at that file and how the S3 client is configured is not part of the excerpt below.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the copy is verified
&lt;/h2&gt;

&lt;p&gt;The check is the one that archive job uses before it is allowed to delete a file locally, and I took it over unchanged. After the upload the script reads the object's metadata back and compares the size and the ETag with the local file. On Hetzner the ETag returned for a single PUT is the MD5 of the object. Other providers or encryption settings can behave differently, so check that before reusing the script. The script also checks that the SHA-256 it supplied during the upload is stored in the metadata. That last check confirms the metadata, and the stored content is only hashed again in the restore test further down. A backup that passed gets a receipt, and a file with a receipt is skipped on the next run.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# core of the copy job: upload, read back, compare, then write the receipt
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BACKUPS&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;glob&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;*.tar&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)):&lt;/span&gt;
    &lt;span class="n"&gt;stat&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stat&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;receipts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{}).&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;size&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;stat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;st_size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;continue&lt;/span&gt;                          &lt;span class="c1"&gt;# already copied and verified
&lt;/span&gt;    &lt;span class="n"&gt;md5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sha&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;digests&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;              &lt;span class="c1"&gt;# one pass over the file, both hashes
&lt;/span&gt;    &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ha-backups/&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;rb&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;s3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;put_object&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Bucket&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;BUCKET&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Body&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                      &lt;span class="n"&gt;ContentMD5&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;base64&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;b64encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;md5&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;decode&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
                      &lt;span class="n"&gt;Metadata&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sha256&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;sha&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
    &lt;span class="n"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;s3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;head_object&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Bucket&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;BUCKET&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ContentLength&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;stat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;st_size&lt;/span&gt;           &lt;span class="c1"&gt;# size
&lt;/span&gt;            &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ETag&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'"'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;md5&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;hex&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;     &lt;span class="c1"&gt;# ETag = MD5 for a single PUT
&lt;/span&gt;            &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Metadata&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sha256&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;sha&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;  &lt;span class="c1"&gt;# SHA-256 from the object metadata
&lt;/span&gt;        &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;RuntimeError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;verification failed for &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;receipts&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;key&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;size&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;stat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;st_size&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sha256&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;sha&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nf"&gt;write_json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;RECEIPTS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;receipts&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The archive job, which uses the same bucket, also checks before every run that an anonymous request is rejected with a 403. The first Home Assistant backup was 163 MB and its upload took 2 seconds with the VM and the bucket in the same location.&lt;/p&gt;

&lt;h2&gt;
  
  
  Store the encryption key before setting it
&lt;/h2&gt;

&lt;p&gt;I first saved the encryption key in the password manager and read it back from there, and only then set it in Home Assistant. With the opposite order there is a period in which Home Assistant already encrypts backups with a key that exists in exactly one place.&lt;/p&gt;

&lt;p&gt;After that I checked whether the backup can be opened at all. Home Assistant has a websocket command for this, &lt;code&gt;backup/can_decrypt_on_download&lt;/code&gt;. With the key from the password manager it answered OK, and with a deliberately wrong key it rejected the request. This test confirms that the key fits the backup. Eight days later I ran a restore test against the copy in the object storage. A script downloads the newest backup, compares its size and SHA-256 with the storage metadata, and decrypts and unpacks it with the key from the password manager. The backup had grown to 2.15 GB by then. The download took 9 seconds and unpacking 3,012 files took 61 seconds. All 32 files under &lt;code&gt;.storage&lt;/code&gt; parsed as JSON, 23 of 23 integrations and 16 of 16 package files matched the running instance, and the SQLite quick check of the database passed. I did not start a fresh Home Assistant from that backup, so the last step of a real restore is still untested.&lt;/p&gt;

&lt;h2&gt;
  
  
  Monitoring the backup and the copy
&lt;/h2&gt;

&lt;p&gt;The timer runs on the host and starts the script in the container, so neither is part of Home Assistant itself. If the timer stops firing or the script fails every night, nothing inside Home Assistant changes, and the local backups keep appearing. So the copy job writes a small status file with the time of its last completed run, a &lt;code&gt;command_line&lt;/code&gt; sensor reads that file, and a binary sensor collects the reasons why something is wrong: Home Assistant backup older than 30 hours, S3 copy older than 30 hours, plus the corresponding checks for the archive job. When the sensor has been on for 15 minutes, an automation sends a push notification with the list of reasons. That automation is not in the YAML below. The status file records when the copy job last completed, so a run that finds nothing new counts as well. The age of the newest Home Assistant backup is checked separately by the first condition.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# the copy job writes a status file, Home Assistant reads it&lt;/span&gt;
&lt;span class="na"&gt;command_line&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;sensor&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Backup&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;S3&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;status"&lt;/span&gt;
      &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cat&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;/config/backups/.s3-status.json"&lt;/span&gt;
      &lt;span class="na"&gt;value_template&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;value_json.last_run_utc&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;
      &lt;span class="na"&gt;device_class&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;timestamp&lt;/span&gt;
      &lt;span class="na"&gt;scan_interval&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;600&lt;/span&gt;

&lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="c1"&gt;# trigger-based: the reasons are computed once and used for state and attribute&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;triggers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;trigger&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;time_pattern&lt;/span&gt;
        &lt;span class="na"&gt;minutes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/5"&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;trigger&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;state&lt;/span&gt;
        &lt;span class="na"&gt;entity_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;sensor.backup_s3_status&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;sensor.backup_last_successful_automatic_backup&lt;/span&gt;
    &lt;span class="na"&gt;variables&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;reasons&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;&amp;gt;-&lt;/span&gt;
        &lt;span class="s"&gt;{% set r = namespace(l=[]) %}&lt;/span&gt;
        &lt;span class="s"&gt;{% set b = states('sensor.backup_last_successful_automatic_backup') | as_datetime %}&lt;/span&gt;
        &lt;span class="s"&gt;{% if b is none or (now() - b).total_seconds() &amp;gt; 30 * 3600 %}&lt;/span&gt;
          &lt;span class="s"&gt;{% set r.l = r.l + ['HA backup older than 30 h'] %}&lt;/span&gt;
        &lt;span class="s"&gt;{% endif %}&lt;/span&gt;
        &lt;span class="s"&gt;{% set s = states('sensor.backup_s3_status') | as_datetime %}&lt;/span&gt;
        &lt;span class="s"&gt;{% if s is none or (now() - s).total_seconds() &amp;gt; 30 * 3600 %}&lt;/span&gt;
          &lt;span class="s"&gt;{% set r.l = r.l + ['S3 copy older than 30 h'] %}&lt;/span&gt;
        &lt;span class="s"&gt;{% endif %}&lt;/span&gt;
        &lt;span class="s"&gt;{{ r.l }}&lt;/span&gt;
    &lt;span class="na"&gt;binary_sensor&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Backup&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;problem"&lt;/span&gt;
        &lt;span class="na"&gt;device_class&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;problem&lt;/span&gt;
        &lt;span class="na"&gt;state&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;reasons&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;|&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;count&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;0&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;
        &lt;span class="na"&gt;attributes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;reasons&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;reasons&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I tested it with a simulated clock, by evaluating the template through the template API with &lt;code&gt;now() + timedelta(days=3)&lt;/code&gt; in place of &lt;code&gt;now()&lt;/code&gt;. All age checks fired. The test also found a hole in one of the archive checks: a source that had never archived anything on the new instance had no last success, so its 72-hour check never applied. That is the kind of silent failure the sensor is meant to report. It now counts from the starting point of the archive. My first draft of the sensor had a second flaw. Its state read its own previous attribute through &lt;code&gt;this.attributes&lt;/code&gt; and was always one update behind. The version above is trigger-based and computes the list once in a variable.&lt;/p&gt;

&lt;h2&gt;
  
  
  What went wrong so far
&lt;/h2&gt;

&lt;p&gt;The largest failure so far came on 8 October, when the sensor reported that the S3 copy was older than 30 hours. The media archive was stored under &lt;code&gt;/config&lt;/code&gt;, and in a container installation folders under &lt;code&gt;/config&lt;/code&gt; cannot be excluded from a Home Assistant backup. The archive had grown to 4.2 GB, the backup had gone from 1.2 GB on 2 October to 4.5 GB, and the 38 GB disk was full. The copy script stopped at that file because it only uploads up to 4 GB with a single PUT, so newer backups were not copied either. I moved the archive to its own volume outside &lt;code&gt;/config&lt;/code&gt;, and the next backup was 68 MB. The script now skips a file that is too large, copies the rest and reports it, a size check that is not in the Python excerpt above, and a new sensor warns when less than 6 GB is free. Both new checks feed the same problem sensor as reasons of their own, and neither is in the YAML excerpt above. The restore test described above ran before this change, on the larger backup.&lt;/p&gt;

&lt;p&gt;On the archive job the first upload of a run was rejected twice with AccessDenied. The same file went through on the next run, and three further runs showed no error, so I could not reproduce it and I do not know the cause. The protection worked as intended: the file stayed on the local disk and was uploaded an hour later. The uploader now makes short retries on PUT and HEAD and logs the error code.&lt;/p&gt;

&lt;p&gt;Before the first core update on the new instance I also triggered a fresh encrypted backup with the service &lt;code&gt;backup.create_automatic&lt;/code&gt; and only then changed the image tag. The update and rollback procedure for the container has &lt;a href="https://www.cloudapp.dev/home-assistant-docker-update-rollback" rel="noopener noreferrer"&gt;its own post&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Can the built-in aws_s3 backup integration be used with a non-AWS S3 provider?
&lt;/h3&gt;

&lt;p&gt;Not on Home Assistant 2026.8, the release I was running. The config flow rejects every endpoint whose hostname does not end in &lt;code&gt;amazonaws.com&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  How long are the backups kept, and what deletes them?
&lt;/h3&gt;

&lt;p&gt;Home Assistant keeps the latest 7 automatic backups locally and removes older ones itself. In the bucket a lifecycle rule deletes the copies after 180 days.&lt;/p&gt;

&lt;h3&gt;
  
  
  How can I check that an encrypted backup opens without restoring it?
&lt;/h3&gt;

&lt;p&gt;The websocket command &lt;code&gt;backup/can_decrypt_on_download&lt;/code&gt; checks whether the key matches the backup. I also downloaded, decrypted and unpacked a copy to check its contents, but have not tested starting a new instance from it.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://www.cloudapp.dev/home-assistant-backup-s3-compatible-storage" rel="noopener noreferrer"&gt;cloudapp.dev&lt;/a&gt;, where it is kept up to date.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>homeassistant</category>
      <category>backup</category>
      <category>selfhosted</category>
      <category>s3</category>
    </item>
    <item>
      <title>Home Assistant Packages Instead of Include Files</title>
      <dc:creator>Michael Bernhart</dc:creator>
      <pubDate>Mon, 02 Nov 2026 09:28:37 +0000</pubDate>
      <link>https://dev.to/cloudapp_dev/home-assistant-packages-instead-of-include-files-1dc1</link>
      <guid>https://dev.to/cloudapp_dev/home-assistant-packages-instead-of-include-files-1dc1</guid>
      <description>&lt;p&gt;The Home Assistant config I am migrating away from is split by type, the way most guides show it: input_boolean.yaml, input_datetime.yaml, templates.yaml and one file per category under automations/. Together that is about 4,800 lines of YAML, of which about 2,900 lines are automations in 13 files. For the new instance, which runs 2026.8.2 in Docker on &lt;a href="https://www.cloudapp.dev/home-assistant-21-releases-behind-rebuild" rel="noopener noreferrer"&gt;the machine I rebuilt the setup on&lt;/a&gt;, I dropped that layout and put everything into packages, one file per area. The price is that package automations can only be edited in YAML. I ship the files with a deploy script that checks the configuration and restores the previous files when the check fails.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the split by type stopped helping
&lt;/h2&gt;

&lt;p&gt;I wrote earlier about &lt;a href="https://www.cloudapp.dev/splitting-home-assistant-automations-yaml" rel="noopener noreferrer"&gt;splitting automations.yaml into category files&lt;/a&gt;, and for the problem I had then it worked. I could open the heating automations without scrolling past everything else. The eight files from that post have grown to 13 since. That split only ever covered automations. The helpers stayed in input_boolean.yaml, the time windows in input_datetime.yaml and the display sensors in templates.yaml, so one area of the house was spread over five to six files.&lt;/p&gt;

&lt;p&gt;This started to matter with the migration, because I am moving the logic from the old instance to the new one step by step. I want to take over one area completely, test it and switch it over. With the old layout I have to collect the helpers, templates and automations of an area from five or six files before I can move it.&lt;/p&gt;

&lt;h2&gt;
  
  
  One package per area
&lt;/h2&gt;

&lt;p&gt;A package bundles everything one area needs in a single file: input helpers, template sensors, automations, scripts, and where needed integrations such as modbus or rest. One line in configuration.yaml includes the whole directory, and the file name becomes the package name. The example below is shortened and uses placeholder names, but the shape is the one my real packages have.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# configuration.yaml&lt;/span&gt;
&lt;span class="na"&gt;homeassistant&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;packages&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;!include_dir_named&lt;/span&gt; &lt;span class="s"&gt;packages&lt;/span&gt;   &lt;span class="c1"&gt;# file name = package name&lt;/span&gt;

&lt;span class="c1"&gt;# packages/example_area.yaml (shortened, placeholder names)&lt;/span&gt;
&lt;span class="na"&gt;input_boolean&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;example_area_enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Example area enabled&lt;/span&gt;

&lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;sensor&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Example&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;area&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;status"&lt;/span&gt;
        &lt;span class="na"&gt;state&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;'on'&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;if&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;is_state('input_boolean.example_area_enabled',&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;'on')&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;else&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;'off'&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;

&lt;span class="na"&gt;automation&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;example_area_evening&lt;/span&gt;
    &lt;span class="na"&gt;alias&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Example&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;area:&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;evening&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;routine"&lt;/span&gt;
    &lt;span class="na"&gt;initial_state&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;          &lt;span class="c1"&gt;# shadow mode while the old instance still runs this&lt;/span&gt;
    &lt;span class="na"&gt;triggers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;trigger&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;time&lt;/span&gt;
        &lt;span class="na"&gt;at&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;19:00:00"&lt;/span&gt;
    &lt;span class="na"&gt;actions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;light.turn_on&lt;/span&gt;
        &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;entity_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;light.example&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first thing I converted was the demo data the new instance had carried until then, 21 template entities. It used to be pulled in by name with a single !include and is now packages/demo.yaml like everything else. After that, each area of the old instance gets its own file as it is taken over.&lt;/p&gt;

&lt;h2&gt;
  
  
  The price: no UI editor for package automations
&lt;/h2&gt;

&lt;p&gt;Automations that come from a package cannot be edited in the UI editor. They show up in the UI and I can read their traces, but saving works only in YAML. That suits the way I work, because I change automations in the repository and deploy them from there. Anyone who builds automations mainly by clicking should weigh this before switching.&lt;/p&gt;

&lt;h2&gt;
  
  
  Shadow mode while two instances run
&lt;/h2&gt;

&lt;p&gt;Once the new instance is connected to KNX, both instances share the bus for the rest of the migration. If the same automation runs on both, every action happens twice, so covers move twice and two push notifications go out. Every automation I take over therefore arrives on the new instance with initial_state: false, which I call shadow mode. The switch happens per area and always in the same order: I disable the automations of that area on the old instance first and then enable them on the new one. The initial_state: false line has to be removed at that point, because otherwise the next restart switches them off again. The previous post in this series covers &lt;a href="https://www.cloudapp.dev/home-assistant-migration-old-and-new-in-parallel" rel="noopener noreferrer"&gt;the first steps of that parallel run&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I ordered the areas by risk. Energy and PV come first because that area only reads and controls nothing, then helpers and time control, lights, covers, heating, and after those cameras and notifications. At the time of this first step the new machine had no connection to the house at all, so automations could be transferred and validated but could not yet be tested against real devices.&lt;/p&gt;

&lt;h2&gt;
  
  
  The deploy script
&lt;/h2&gt;

&lt;p&gt;On the old instance a deploy meant copying files with scp to /tmp and then running sudo cp into the config folder, by hand. The new instance gets one script in the repository with four steps. It backs up configuration.yaml and packages/ on the machine and keeps the last 10 states. It runs rsync for only the files that are maintained in git, so secrets, .storage and the themes and cards installed through HACS stay untouched. It runs check_config inside the container and does not reload if that fails. The fourth step is optional in the full script, a reload of selected domains over the REST API or a full restart. The shortened version below always reloads automations, has no dry-run mode and assumes that configuration.yaml and packages/ already exist on the machine. It does not reload helpers or templates. The full script takes a list of domains, for example --reload automation,input_boolean,template, and I name the domains that a change touches. A change to configuration.yaml or a new integration needs --restart.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/usr/bin/env bash&lt;/span&gt;
&lt;span class="c"&gt;# deploy script, shortened; host, paths and URL are placeholders&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nt"&gt;-euo&lt;/span&gt; pipefail
&lt;span class="nv"&gt;HOST&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;ha-host&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;REMOTE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/path/to/config&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;SRC&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;config&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;HA_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;http://localhost:PORT

&lt;span class="c"&gt;# 1. back up the current config on the machine, keep the last 10 states&lt;/span&gt;
&lt;span class="nv"&gt;TS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt; +%Y%m%d-%H%M%S&lt;span class="si"&gt;)&lt;/span&gt;
ssh &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$HOST&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="s2"&gt;"cd &lt;/span&gt;&lt;span class="nv"&gt;$REMOTE&lt;/span&gt;&lt;span class="s2"&gt; &amp;amp;&amp;amp; mkdir -p .deploy-backups/&lt;/span&gt;&lt;span class="nv"&gt;$TS&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;&lt;span class="s2"&gt;
  &amp;amp;&amp;amp; cp -a configuration.yaml packages .deploy-backups/&lt;/span&gt;&lt;span class="nv"&gt;$TS&lt;/span&gt;&lt;span class="s2"&gt;/ &lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;&lt;span class="s2"&gt;
  &amp;amp;&amp;amp; ls -1dt .deploy-backups/*/ | tail -n +11 | xargs -r rm -rf"&lt;/span&gt;

&lt;span class="c"&gt;# 2. transfer only what is maintained in git; only packages/ is mirrored&lt;/span&gt;
ssh &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$HOST&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="s2"&gt;"mkdir -p &lt;/span&gt;&lt;span class="nv"&gt;$REMOTE&lt;/span&gt;&lt;span class="s2"&gt;/packages"&lt;/span&gt;      &lt;span class="c"&gt;# rsync --dry-run cannot create it&lt;/span&gt;
rsync &lt;span class="nt"&gt;-rlt&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$SRC&lt;/span&gt;&lt;span class="s2"&gt;/configuration.yaml"&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$HOST&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="nv"&gt;$REMOTE&lt;/span&gt;&lt;span class="s2"&gt;/"&lt;/span&gt;
rsync &lt;span class="nt"&gt;-rlt&lt;/span&gt; &lt;span class="nt"&gt;--delete&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$SRC&lt;/span&gt;&lt;span class="s2"&gt;/packages/"&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$HOST&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="nv"&gt;$REMOTE&lt;/span&gt;&lt;span class="s2"&gt;/packages/"&lt;/span&gt;

&lt;span class="c"&gt;# 3. check_config in the container; read the output as well as the exit code&lt;/span&gt;
&lt;span class="nv"&gt;CHECK&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;ssh &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$HOST&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="s2"&gt;"docker exec homeassistant python -m homeassistant &lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;&lt;span class="s2"&gt;
  --script check_config -c /config"&lt;/span&gt; 2&amp;gt;&amp;amp;1&lt;span class="si"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nv"&gt;RC&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$?&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$CHECK&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;RC&lt;/span&gt;&lt;span class="k"&gt;:-}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;]]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-qi&lt;/span&gt; &lt;span class="s2"&gt;"invalid config"&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$CHECK&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
  &lt;span class="c"&gt;# restore the backup, otherwise the next restart loads the broken file&lt;/span&gt;
  ssh &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$HOST&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="s2"&gt;"cd &lt;/span&gt;&lt;span class="nv"&gt;$REMOTE&lt;/span&gt;&lt;span class="s2"&gt; &amp;amp;&amp;amp; rm -rf packages &amp;amp;&amp;amp; cp -a .deploy-backups/&lt;/span&gt;&lt;span class="nv"&gt;$TS&lt;/span&gt;&lt;span class="s2"&gt;/. ."&lt;/span&gt;
  &lt;span class="nb"&gt;exit &lt;/span&gt;1                                     &lt;span class="c"&gt;# nothing is reloaded&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;

&lt;span class="c"&gt;# 4. optional reload over the REST API; the token goes over stdin&lt;/span&gt;
&lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s1"&gt;'Authorization: Bearer %s\n'&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; .ha-token&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | &lt;span class="se"&gt;\&lt;/span&gt;
  ssh &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$HOST&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="s2"&gt;"curl -fsS -X POST -H @- &lt;/span&gt;&lt;span class="nv"&gt;$HA_URL&lt;/span&gt;&lt;span class="s2"&gt;/api/services/automation/reload"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Only packages/ is mirrored, so a package I delete in the repository also disappears on the machine. The token for the reload call goes to the machine over stdin, because on the command line it would be readable in the process list for every process on the host.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the script caught
&lt;/h2&gt;

&lt;p&gt;The first trial run of the full script with --dry-run aborted. In a dry run rsync cannot create a target directory that it is supposed to look into afterwards, so the script now creates packages/ over SSH beforehand. The second surprise was a single file transferred under a different name: the dry-run output showed the source name where the target name should have been. I stopped guessing and now transfer that one file with ssh and cat. That transfer is not in the shortened example. I saw this with the rsync 2.6.9 from 2006 that macOS still ships, and I have not tried a newer version.&lt;/p&gt;

&lt;p&gt;The more important finding came a day later. check_config reported an invalid configuration and still exited with success. The script looked only at the exit code and restarted Home Assistant. Since then it reads the output of check_config and aborts on the words Invalid config, and in that case it restores the backup from step one automatically. Before that change a deploy that failed the check left the faulty file on the machine, where the next restart would have loaded it. A transfer that fails halfway is still not covered, because the script exits before it reaches the restore. I tested both additions with a deliberately broken file, and the script detected it, aborted and rolled back.&lt;/p&gt;

&lt;p&gt;Later the same day the hardened script was needed for real. While building a monitoring package I made an indentation error in the YAML. The script recognised it, aborted and restored the backup before anything was reloaded. After that day I would not deploy a config without the output check and the restore. It follows the same idea as the &lt;a href="https://www.cloudapp.dev/home-assistant-docker-update-rollback" rel="noopener noreferrer"&gt;backup, test and rollback routine I use for container updates&lt;/a&gt;, applied to the config files.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recorder limits from the first day
&lt;/h2&gt;

&lt;p&gt;The recorder settings went in at the same step. I keep 7 days of history instead of 10, and one counter is excluded. The reason is the old instance, where a single sensor, the telegram counter of the KNX interface, accounted for 98 % of all rows in the recorder database, 8.39 of 8.56 million in 7 days. It increases with every bus telegram, and each intermediate value was written as its own row.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;recorder&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;purge_keep_days&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;7&lt;/span&gt;
  &lt;span class="na"&gt;exclude&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;entities&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="c1"&gt;# on the old instance this counter produced 98 % of all recorder rows&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;sensor.knx_telegram_counter&lt;/span&gt;
  &lt;span class="c1"&gt;# no include block: everything is recorded except this counter&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The old instance also had an include list next to the exclude block, on the assumption that it worked as a whitelist. On the new instance I want to record everything except this counter, so I use only an exclude list.&lt;/p&gt;

&lt;p&gt;After the switch to packages a restart reached HTTP 200 after 4 s, measured once per second from docker compose restart. HTTP 200 does not mean that all integrations have finished loading. The instance then had 40 entities, 21 of them demo, and the log showed no errors or warnings apart from the usual note about HACS being a custom integration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Can I still edit automations in the UI when they live in a package?
&lt;/h3&gt;

&lt;p&gt;No. Package automations and their traces are visible in the UI, but changes have to be made in the YAML file.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I avoid double actions when two instances run the same automations?
&lt;/h3&gt;

&lt;p&gt;I transfer every automation with initial_state: false. Per area I then turn the automations off on the old instance, remove initial_state: false on the new one and enable them there.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is the exit code of check_config enough for a deploy script?
&lt;/h3&gt;

&lt;p&gt;In my case it was not. check_config reported an invalid configuration and still exited with code 0. My script now also searches the output for Invalid config and restores the backup when it finds it.&lt;/p&gt;

</description>
      <category>homeassistant</category>
      <category>yaml</category>
      <category>selfhosted</category>
      <category>devops</category>
    </item>
    <item>
      <title>Home Assistant Migration: Old and New in Parallel</title>
      <dc:creator>Michael Bernhart</dc:creator>
      <pubDate>Mon, 26 Oct 2026 09:18:26 +0000</pubDate>
      <link>https://dev.to/cloudapp_dev/home-assistant-migration-old-and-new-in-parallel-53fk</link>
      <guid>https://dev.to/cloudapp_dev/home-assistant-migration-old-and-new-in-parallel-53fk</guid>
      <description>&lt;p&gt;This is the first post of a series about moving my Home Assistant setup from one instance to another. The old instance runs 2024.11.1 on an Azure VM, the new one runs 2026.8.2 in Docker on a Hetzner server (&lt;a href="https://www.cloudapp.dev/home-assistant-server-what-it-costs-to-run" rel="noopener noreferrer"&gt;what that server costs&lt;/a&gt; is a separate post), and I wrote earlier about &lt;a href="https://www.cloudapp.dev/home-assistant-21-releases-behind-rebuild" rel="noopener noreferrer"&gt;why I rebuilt instead of upgrading&lt;/a&gt;. The old instance controls KNX lights, covers and heating and reads a PV inverter over Modbus, in about 4,800 lines of YAML. Both instances run side by side for a while, and the new one takes over one area at a time. This post covers the first steps on the real house.&lt;/p&gt;

&lt;h2&gt;
  
  
  The rule for parallel operation
&lt;/h2&gt;

&lt;p&gt;Both instances are connected to the same KNX bus. If the same automation runs on both, every action happens twice: covers get two commands and my phone gets two push notifications. So every automation I carry over arrives on the new instance with &lt;strong&gt;initial_state: false&lt;/strong&gt;. My notes call that shadow mode. I switch per area and always in the same order. I turn the automation off on the old instance first and enable it on the new one afterwards. On the new one I also remove initial_state: false from the YAML, otherwise the automation is off again after the next restart.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# a package on the NEW instance: carried over, loaded, switched off&lt;/span&gt;
&lt;span class="na"&gt;automation&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;outdoor_light_on&lt;/span&gt;
    &lt;span class="na"&gt;alias&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Timer:&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;outdoor&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;light&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;on"&lt;/span&gt;
    &lt;span class="na"&gt;initial_state&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;   &lt;span class="c1"&gt;# shadow mode, the old instance still switches this&lt;/span&gt;
    &lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;single&lt;/span&gt;
    &lt;span class="na"&gt;triggers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;trigger&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;time&lt;/span&gt;
        &lt;span class="na"&gt;at&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;input_datetime.outdoor_light_start&lt;/span&gt;
    &lt;span class="na"&gt;actions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;switch.turn_on&lt;/span&gt;
        &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;label_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;timer_outdoor_light&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The areas are ordered by risk. Energy and PV came first, because that area mostly calculates and controls nothing on the new instance. Helpers and time-based automations follow, then light, covers and heating. Through all the steps in this post every automation that switches something in the house kept running on the old instance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reading sensors without writing to the bus
&lt;/h2&gt;

&lt;p&gt;Automations on two instances can only be compared in a meaningful way if both see the same states. I carried over 166 of the 170 KNX entities, including the comments from the old config. Two things I left out on purpose. One is expose, because with it Home Assistant reports a state onto the bus by itself, and that is active sending. The other is four switches where an accidental tap in the new dashboard would have real consequences.&lt;/p&gt;

&lt;p&gt;In current versions the KNX connection is a config entry and no longer YAML, so I set it up through the config flow over the REST API. The new instance got the second tunnel address of the KNX interface, and the old one keeps the first. Two things went differently from the plan. The config flow creates the connection with state polling enabled and starts it immediately. The option can only be changed afterwards in the options flow, and by then the new instance had already sent 96 read requests to the bus. Reads are harmless, and I had still planned to start without any.&lt;/p&gt;

&lt;p&gt;The second surprise was that switching state polling off does not mean never reading. After the next restart there were another 52 read requests. A comment in the Home Assistant source spells it out as True -&amp;gt; expire 60; False -&amp;gt; init. Off therefore means reading once at start and never again afterwards. For zero read requests, every single entity needs &lt;strong&gt;sync_state: false&lt;/strong&gt;, and then the states stay unknown until a telegram happens to come by. For shadow mode I kept init: one sync at start, while the ongoing polling stays with the old instance.&lt;/p&gt;

&lt;p&gt;The KNX integration in this version stores telegrams in its own SQLite database, so I could count afterwards what the new instance had sent. The result was 148 read requests and 0 write commands.&lt;/p&gt;

&lt;p&gt;PV needed a different approach, because the PV dongle tolerates only a few Modbus connections. The old instance has long been reading through a small Modbus cache server that polls the dongle every 10 seconds and serves several clients, and I attached the new instance to the same cache. All 17 sensors show the same values as on the old instance, with differences only in the last decimal place.&lt;/p&gt;

&lt;h2&gt;
  
  
  Same entity ids on both instances
&lt;/h2&gt;

&lt;p&gt;Dashboards and automations of the old instance refer to entity ids. If the ids differ on the new instance, every reference has to be touched during the move. Ids are derived from names, and the old instance has years of manual renames. I wrote a small tool that reads the entity registry of both instances over the WebSocket API, matches entries by their unique_id and renames on the new instance. It renamed 28 entities, and afterwards 183 of 183 matched ids were identical.&lt;/p&gt;

&lt;p&gt;Matching by unique_id alone is not enough for KNX. The integration uses the group address as unique_id, so a motion detector that switches a light and the light itself have the same unique_id in different domains. The first run would have renamed six motion detectors into lamps, and the key is now platform plus domain plus unique_id.&lt;/p&gt;

&lt;h2&gt;
  
  
  The first automation that runs on both instances
&lt;/h2&gt;

&lt;p&gt;I expected light to be the biggest area, and Home Assistant turned out to have almost no logic there. The KNX motion detectors switch the lamps themselves, directly on the bus, so the light also works when Home Assistant is down. What Home Assistant had was 7 automations, one per detector, that write the time of the last motion into a helper for a dashboard overview, the pattern from &lt;a href="https://www.cloudapp.dev/home-assistant-last-motion-sensor-input-datetime" rel="noopener noreferrer"&gt;this older post&lt;/a&gt;. The seven differed in two names only, so they became one automation that derives the target helper from the entity id of the triggering detector. The shortened example below lists two of the seven detectors. Each detector needs an existing date and time helper with the matching suffix.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# one automation instead of seven, active on both instances&lt;/span&gt;
&lt;span class="na"&gt;automation&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;remember_last_motion&lt;/span&gt;
    &lt;span class="na"&gt;alias&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Remember&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;last&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;motion&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;per&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;detector"&lt;/span&gt;
    &lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;parallel&lt;/span&gt;           &lt;span class="c1"&gt;# two detectors in the same second&lt;/span&gt;
    &lt;span class="na"&gt;triggers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;trigger&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;state&lt;/span&gt;
        &lt;span class="na"&gt;entity_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;binary_sensor.motion_detector_a&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;binary_sensor.motion_detector_b&lt;/span&gt;
        &lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;off"&lt;/span&gt;          &lt;span class="c1"&gt;# old: only to "on", which also matched unavailable -&amp;gt; on&lt;/span&gt;
        &lt;span class="na"&gt;to&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;on"&lt;/span&gt;
    &lt;span class="na"&gt;actions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;input_datetime.set_datetime&lt;/span&gt;
        &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;entity_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;&amp;gt;-&lt;/span&gt;
            &lt;span class="s"&gt;{{ trigger.entity_id | replace('binary_sensor.motion_detector_', 'input_datetime.last_motion_') }}&lt;/span&gt;
        &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;datetime&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;now().strftime('%Y-%m-%d&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;%H:%M:%S')&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The trigger changed as well. The old automations reacted to on without a from, so they also fired when a detector changed from unavailable to on after a restart or a KNX reconnect. On the old instance, the last-motion value of one detector stood at exactly the second in which the KNX integration had been reloaded that evening.&lt;/p&gt;

&lt;p&gt;This automation is active on both instances right away. It writes only to helpers of its own instance and sends nothing to the bus, so two instances recording the same thing do not interfere. I copied the helper values from the old instance over the REST API and waited for the next real motion, which came at 21:05:54. Both instances stored that motion with the same second. All 7 helpers were equal on both, but I had copied their starting values and had seen only this one event. That was the first point at which the new instance demonstrably did the same as the old one in real time. It had 11 automations at that point, most of them still in shadow mode.&lt;/p&gt;

&lt;h2&gt;
  
  
  The first full state comparison
&lt;/h2&gt;

&lt;p&gt;Covers were the next area, and with 43 covers I had expected a large one. Home Assistant has no logic of its own there either. The covers are driven by KNX push buttons and central functions directly on the bus. I used the step for a comparison of all states between old and new instead, on a Saturday morning after the first night. Counting the entities both instances have in common, 51 of 51 lights had the same state, 11 of 11 thermostats, 43 of 43 covers, 32 of 33 binary sensors and 16 of 29 switches. The two daily energy counters matched to the decimal place. The one differing binary sensor is intended, a contact whose polarity I had corrected at the source on the new instance.&lt;/p&gt;

&lt;p&gt;The comparison uncovered two gaps that exist on both instances. Of the 43 covers, 33 are unknown on both, because the ETS project has no position or end-position feedback assigned for those drives. At that point I assumed this could be fixed in ETS. Reading the actuator programs later showed that for most of these drives it is a hardware limit, which gets its own post in this series. And 25 switches have no status object, so Home Assistant shows the last switching value it saw on the bus, which may no longer be the real state. Where the two instances differ on these, the old one shows off and the new one shows unknown. I consider unknown the more accurate display, since the old off is a remembered value from some earlier time.&lt;/p&gt;

&lt;h2&gt;
  
  
  What must not run twice, and what is open
&lt;/h2&gt;

&lt;p&gt;Notifications are a different case from the motion automation. A push at sunrise and sunset or on arriving home would arrive twice if both instances had it enabled, so those automations stay in shadow mode on the new one. Toggle commands are the most dangerous category in parallel operation. A doubled on for a light is harmless, and a doubled toggle produces the opposite of what was wanted, so such automations always get turned off on the old instance first.&lt;/p&gt;

&lt;p&gt;This post does not show a completed switch of an area that acts on the house. Up to the comparison, the old instance was still doing all the switching. The missing feedback for 25 switches and 33 covers was open at that point. Four days later I set the read flag on the objects of the switch actuators in ETS, and since then Home Assistant reads the state of 52 lights and switches on their switching address at start.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Can two Home Assistant instances use the same KNX interface?
&lt;/h3&gt;

&lt;p&gt;In my setup yes. The new instance got the second tunnel address of the KNX interface and the old one keeps the first. The automatic search needs multicast and found no tunnel from the new instance, so the form went straight to manual entry.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does switching off state polling stop all reads on the KNX bus?
&lt;/h3&gt;

&lt;p&gt;No. The integration still reads once at start, which was 52 read requests here. Only sync_state: false on every entity removes those too, and then a state stays unknown until a telegram arrives.&lt;/p&gt;

&lt;h3&gt;
  
  
  Which automations can be active on both instances at once?
&lt;/h3&gt;

&lt;p&gt;Only those that write to helpers of their own instance and neither control a device nor send a notification.&lt;/p&gt;

</description>
      <category>homeassistant</category>
      <category>knx</category>
      <category>selfhosted</category>
      <category>migration</category>
    </item>
    <item>
      <title>Move KNX Switches From the Home Assistant UI to knx.yaml</title>
      <dc:creator>Michael Bernhart</dc:creator>
      <pubDate>Fri, 16 Oct 2026 09:52:05 +0000</pubDate>
      <link>https://dev.to/cloudapp_dev/move-knx-switches-from-the-home-assistant-ui-to-knxyaml-bj5</link>
      <guid>https://dev.to/cloudapp_dev/move-knx-switches-from-the-home-assistant-ui-to-knxyaml-bj5</guid>
      <description>&lt;p&gt;For about a year I had 33 KNX switches in Home Assistant that existed only in the UI. I had clicked them together in the KNX integration's entity editor when the lighting on two floors, the garage door and two auxiliary switches were wired up, and it was quick. Home Assistant keeps those switches in a JSON file under .storage, which it rewrites itself and which is not in my Git repository. The thermostats, covers and sensors of the same bus have lived in knx.yaml since the beginning, next to the &lt;a href="https://www.cloudapp.dev/home-assistant-knx-thermostat-standby-after-restart-fix" rel="noopener noreferrer"&gt;startup automation&lt;/a&gt; and the &lt;a href="https://www.cloudapp.dev/home-assistant-knx-window-open-heating-off" rel="noopener noreferrer"&gt;window logic&lt;/a&gt;. In September I moved 31 of them over and dropped two that I no longer wanted as switches. I spent a week preparing it, and running it took about ten minutes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I deleted the UI entries before loading the YAML
&lt;/h2&gt;

&lt;p&gt;The KNX integration reads both the UI store and knx.yaml at load time and creates an entity for each definition. A switch defined in both places exists twice, with two entity ids, and nothing warns you. Adding the YAML first and deleting the UI entries afterwards would therefore have created 31 duplicates. I deleted the UI entities first and loaded the YAML after that. In my run the config check of the new file also came after the deletion, as step 2 below shows. A YAML error would have surfaced with the switches already gone, so I would run that check before step 1 next time. Between the deletion and the reload the switches do not exist. During that time they cannot be operated from the dashboard, and automation actions that target them fail.&lt;/p&gt;

&lt;p&gt;Until the migration I kept a deploy variant of knx.yaml on the machine, identical to the repository version but without the block for the 31 switches that were still managed in the UI, and a comment at the top saying so. With that arrangement, deploying the full file by accident would have created every switch twice, which is the second reason I wanted it gone.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a switch looks like in YAML
&lt;/h2&gt;

&lt;p&gt;The YAML holds largely the same settings as the UI editor's JSON file, in a file I can edit and keep in Git. Two details in it were deliberate changes from what I had clicked together a year earlier:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# knx.yaml — two switch definitions, with and without a feedback address&lt;/span&gt;
&lt;span class="na"&gt;switch&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Light&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;1"&lt;/span&gt;
    &lt;span class="na"&gt;address&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;1/2/3"&lt;/span&gt;          &lt;span class="c1"&gt;# group address the actuator listens on&lt;/span&gt;
    &lt;span class="na"&gt;state_address&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;1/3/3"&lt;/span&gt;    &lt;span class="c1"&gt;# feedback object, if the actuator has one&lt;/span&gt;
    &lt;span class="na"&gt;sync_state&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Ceiling&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;light"&lt;/span&gt;
    &lt;span class="na"&gt;address&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;1/2/4"&lt;/span&gt;
    &lt;span class="c1"&gt;# no state_address: the actuator has no feedback object.&lt;/span&gt;
    &lt;span class="c1"&gt;# I removed the central status address because reads to it were never answered.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Nine switches had a central status address as their state address, an address that the actuator never answered on. Home Assistant queried it, got nothing, and showed whatever state it had last assumed. In the YAML I removed that address from all nine. Two of them now use their real feedback object, and the other seven have no state address, so Home Assistant shows what it last sent for those.&lt;/p&gt;

&lt;h2&gt;
  
  
  The tool: four commands over the websocket API
&lt;/h2&gt;

&lt;p&gt;I used a local Node script with four subcommands for this. The commands below are the ones I ran. The script itself and the saved mapping from group address to the old entity id are not part of this post, only the core of the rename step further down. The script uses the same websocket API as the frontend and authenticates with a long-lived access token. Before the first delete I backed up the KNX store, the entity registry and the deployed knx.yaml together. The distinguishing mark between the two kinds of entity is the unique id: UI entities carry an id starting with knx_es_, YAML entities carry the group address itself.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 0. inventory: 33 UI entities, 2 YAML switches expected&lt;/span&gt;
node tools/knx_migrate_ui_switches.mjs list

&lt;span class="c"&gt;# 1. delete the UI entities from the KNX config store (websocket knx/delete_entity)&lt;/span&gt;
node tools/knx_migrate_ui_switches.mjs delete-ui

&lt;span class="c"&gt;# 2. put the full knx.yaml on the machine and validate it&lt;/span&gt;
scp knx.yaml ha-host:/tmp/knx.yaml
ssh ha-host &lt;span class="s1"&gt;'sudo cp /tmp/knx.yaml /home/ha/config/knx.yaml \
  &amp;amp;&amp;amp; sudo docker exec homeassistant python -m homeassistant --script check_config -c /config'&lt;/span&gt;

&lt;span class="c"&gt;# 3. reload the integration (no restart), wait, restore the old entity ids&lt;/span&gt;
node tools/knx_migrate_ui_switches.mjs reload     &lt;span class="c"&gt;# calls knx.reload&lt;/span&gt;
&lt;span class="nb"&gt;sleep &lt;/span&gt;20
node tools/knx_migrate_ui_switches.mjs rename     &lt;span class="c"&gt;# sets the previous entity_id per switch&lt;/span&gt;
node tools/knx_migrate_ui_switches.mjs list       &lt;span class="c"&gt;# every line must say OK&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The delete step uses the knx/delete_entity websocket command per entity, which is what the UI editor calls when you press the trash icon. Home Assistant removes the entity from the KNX store and from the entity registry. That second part is the reason the rename step exists.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keeping the entity ids
&lt;/h2&gt;

&lt;p&gt;When the YAML entities come up after the reload, Home Assistant assigns them fresh entity ids derived from their names. Where a new entity id differed from the old one, I would have had to edit every dashboard card and automation that used it. The rename step avoids that: it holds a mapping from group address to the entity id the UI entity used to have, finds the new YAML entity by its unique id, and renames it through the registry API.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// the core of "rename": entity_registry/update over the websocket API&lt;/span&gt;
&lt;span class="c1"&gt;// MAPPING: group address (write) -&amp;gt; the entity_id the UI entity used to have&lt;/span&gt;
&lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;ga&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;oldId&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;entries&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;MAPPING&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;yamlEntity&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;registry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;platform&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;knx&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;unique_id&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;ga&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;yamlEntity&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;yamlEntity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;entity_id&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;oldId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;continue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;ws&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;config/entity_registry/update&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="na"&gt;entity_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;yamlEntity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;entity_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;new_entity_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;oldId&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I waited 20 seconds between reload and rename. The KNX integration registers its entities asynchronously after the reload call returns, and my script skips any entity it does not find in the registry yet, without an error. I had run list too early once and half the entities were missing. 20 seconds was enough here, and I have not measured how short the wait could be.&lt;/p&gt;

&lt;p&gt;The final list showed 0 UI entities and 33 YAML switches, which are the 31 I carried over plus two that had been in the YAML before. All 31 migrated switches had their previous entity ids again. After the migration all 31 entities were assigned to their previous areas again, and the two labels that a time-control automation filters on were set as before. The rename excerpt above does not show that part.&lt;/p&gt;

&lt;h2&gt;
  
  
  The five automation actions that broke anyway
&lt;/h2&gt;

&lt;p&gt;The entity ids were restored, and five actions in three automations still broke. They had been created in the automation editor as device actions, which bind to the registry's internal device id. Deleting the UI entities deleted those devices, and the actions pointed at nothing. Home Assistant did not fail the three automations for that. It logged a warning when the action ran and skipped it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# before: a device action bound to a registry device id that no longer exists&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;device_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;3f1c…a97e&lt;/span&gt;
  &lt;span class="na"&gt;domain&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;switch&lt;/span&gt;
  &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;turn_on&lt;/span&gt;
  &lt;span class="na"&gt;entity_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;9b2d…c410&lt;/span&gt;

&lt;span class="c1"&gt;# after: the same action on the stable entity id&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;switch.turn_on&lt;/span&gt;
  &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;entity_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;switch.light_1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I replaced all five with plain switch.turn_on and switch.turn_off actions on the entity ids and reloaded automations. Actions that had been disabled stayed disabled. Afterwards a full config check and a scan of the log for unknown entity messages came back clean. Since then I write new automation actions as entity actions with switch.turn_on and switch.turn_off, the way the &lt;a href="https://www.cloudapp.dev/splitting-home-assistant-automations-yaml" rel="noopener noreferrer"&gt;split YAML files&lt;/a&gt; already do.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I tested, and what I could not
&lt;/h2&gt;

&lt;p&gt;I switched four switches on and off from Home Assistant, checked the outgoing bus telegrams and restored the original off state afterwards. For the lamps that have no feedback object that is not an independent confirmation, because Home Assistant only knows what it sent. I tested the garage door on site with two pulses and checked its feedback: 0 while opening, 1 after closing. The doc now says that turn_on sends a pulse and does not fix the direction of travel.&lt;/p&gt;

&lt;p&gt;The recorder logged 28 warnings during the renames, because the old target ids already had history and the short history under the interim names is not merged. I left the database alone. I have never executed the rollback, which would restore the KNX store, the entity registry and the old knx.yaml together from the backup I took before the deletion. For such a restore Home Assistant has to be stopped first, otherwise it overwrites the restored .storage files again. I did not want to try that on the production bus for a migration that had already succeeded.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Can I keep some KNX entities in the UI and others in YAML?
&lt;/h3&gt;

&lt;p&gt;Yes, as long as each switch is defined in only one of the two places. Otherwise it exists twice.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why not just export the UI configuration?
&lt;/h3&gt;

&lt;p&gt;There is no export. The store is a JSON file under .storage/knx that you can read, and its structure maps onto the YAML options closely enough that a script can translate it. The tool's list command is essentially that translation, printed side by side with what the YAML defines.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does knx.reload really avoid a restart?
&lt;/h3&gt;

&lt;p&gt;For the KNX integration itself, yes. It tears down and re-creates its entities and re-reads knx.yaml. Automations that reference the entities keep running during that time, so one can trigger while its target entity is missing. A later change to thermostat state addresses went in with a full restart, so I can only vouch for reload on this switch migration.&lt;/p&gt;

&lt;p&gt;I wrote this for my own blog first, where there are also posts on the &lt;a href="https://www.cloudapp.dev/home-assistant-knx-thermostat-preset-modes" rel="noopener noreferrer"&gt;KNX thermostats&lt;/a&gt; on the same bus and on the &lt;a href="https://www.cloudapp.dev/home-assistant-knx-window-open-heating-off" rel="noopener noreferrer"&gt;automation that turns the heating off when a window opens&lt;/a&gt;. The preparation took a week in September, and the migration itself about ten minutes.&lt;/p&gt;

</description>
      <category>homeassistant</category>
      <category>knx</category>
      <category>yaml</category>
      <category>smarthome</category>
    </item>
    <item>
      <title>One Day of Home Assistant Logs: 775 Errors, Seven Findings</title>
      <dc:creator>Michael Bernhart</dc:creator>
      <pubDate>Fri, 09 Oct 2026 10:17:15 +0000</pubDate>
      <link>https://dev.to/cloudapp_dev/one-day-of-home-assistant-logs-775-errors-seven-findings-4k6c</link>
      <guid>https://dev.to/cloudapp_dev/one-day-of-home-assistant-logs-775-errors-seven-findings-4k6c</guid>
      <description>&lt;p&gt;My production Home Assistant has been running as a Docker container on a small cloud VM since 2024, on version 2024.11.1, with about 570 entities, 73 automations and a KNX bus behind it. I had not read its log in months. In September I made myself do it properly: one full day of log, every error and warning counted and grouped before touching anything, and only then a repair list in order of priority. This post is that list. It includes two findings that needed no repair and one template that briefly reported the garage door as open.&lt;/p&gt;

&lt;p&gt;The numbers for the 24 hours from 12 September, 15:25, to 13 September, 15:25: 10,490 log lines, 775 ERROR entries, 5,077 WARNING entries. Several entries share a cause, so before reading any of them I grouped them by the logger name in square brackets, which is the fifth field in this log format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# one day of log, counted before reading anything&lt;/span&gt;
docker logs &lt;span class="nt"&gt;--since&lt;/span&gt; 24h homeassistant 2&amp;gt;&amp;amp;1 | &lt;span class="nb"&gt;wc&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt;          &lt;span class="c"&gt;# 10490&lt;/span&gt;
docker logs &lt;span class="nt"&gt;--since&lt;/span&gt; 24h homeassistant 2&amp;gt;&amp;amp;1 | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s1"&gt;' ERROR '&lt;/span&gt;   &lt;span class="c"&gt;# 775&lt;/span&gt;
docker logs &lt;span class="nt"&gt;--since&lt;/span&gt; 24h homeassistant 2&amp;gt;&amp;amp;1 | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s1"&gt;' WARNING '&lt;/span&gt; &lt;span class="c"&gt;# 5077&lt;/span&gt;
&lt;span class="c"&gt;# group by logger name (field 5), most frequent first&lt;/span&gt;
docker logs &lt;span class="nt"&gt;--since&lt;/span&gt; 24h homeassistant 2&amp;gt;&amp;amp;1 &lt;span class="se"&gt;\&lt;/span&gt;
  | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-E&lt;/span&gt; &lt;span class="s1"&gt;' (ERROR|WARNING) '&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  | &lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'{print $5}'&lt;/span&gt; | &lt;span class="nb"&gt;sort&lt;/span&gt; | &lt;span class="nb"&gt;uniq&lt;/span&gt; &lt;span class="nt"&gt;-c&lt;/span&gt; | &lt;span class="nb"&gt;sort&lt;/span&gt; &lt;span class="nt"&gt;-rn&lt;/span&gt; | &lt;span class="nb"&gt;head&lt;/span&gt; &lt;span class="nt"&gt;-20&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Ground truth before reading a single error
&lt;/h2&gt;

&lt;p&gt;Before interpreting anything I checked the things that would make the log meaningless if they were off. Container running since 27 August, one historical restart, not OOM-killed. Host with 3.8 GiB RAM, 2.3 GiB free, the container at about 800 MiB. Swap 4 GiB with 1 MiB used. Disk 63 percent full. The recorder database at 60 MiB with a 4.3 MiB write-ahead log, and a read-only SQLite quick_check returning ok. A config check inside the container with no errors. The four configuration files on the VM matched the repository by SHA-256. I also ran a static check of all 73 automations against the entity registry, with one rule for reading the result: an entity that is not registered is not automatically missing.&lt;/p&gt;

&lt;p&gt;That took twenty minutes and ruled out the boring explanations. Memory and disk were sufficient, the database check passed, and the config on the machine matched the repository.&lt;/p&gt;

&lt;h2&gt;
  
  
  Finding 1: the cameras caused 4,524 of the 5,077 warnings
&lt;/h2&gt;

&lt;p&gt;The cameras accounted for most of the warnings. 2,886 were warnings about slow updates from the two Tapo cameras. Another 1,638 came from two automations that set the motion detection parameters on those cameras. Their trigger was a time pattern on second 10, which fires once a minute, and they wrote the same settings every time. Both run in mode single. One call to the camera integration hung, so from that moment on every further run was refused with an already running warning, 1,440 times for one camera and 198 times for the other. The trace of the last accepted run of the first automation was from 6 September, so it had not run for a week and had logged a warning once a minute during that time.&lt;/p&gt;

&lt;p&gt;I repaired this the same afternoon in two steps. Reloading the config entries of the two cameras released the hung calls, without restarting Home Assistant or the cameras. In the automations, a setting is now only written when the entity does not already report the target value, which was 24 places in the file. Trigger and mode stayed as they were. Switching to mode parallel or silencing the warning would have left the hung call in place and removed the only sign of it. I did not add a timeout around the camera calls, so a call that hangs in the library can block these automations again, and the already running warning is how I would notice. The example below shows the condition.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# before: fires every minute at second 10, mode single,&lt;/span&gt;
&lt;span class="c1"&gt;# and writes the same detection settings every time&lt;/span&gt;
&lt;span class="na"&gt;triggers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;trigger&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;time_pattern&lt;/span&gt;
    &lt;span class="na"&gt;seconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;10"&lt;/span&gt;
&lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;single&lt;/span&gt;

&lt;span class="c1"&gt;# after: only write when the setting actually differs&lt;/span&gt;
&lt;span class="na"&gt;conditions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;condition&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;template&lt;/span&gt;
    &lt;span class="na"&gt;value_template&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="s"&gt;{{ not is_state('switch.camera_motion_detection', 'on') }}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Finding 2: a cloud integration that reported loaded and delivered nothing
&lt;/h2&gt;

&lt;p&gt;The FusionSolar integration polls Huawei's cloud kiosk for daily, monthly and yearly energy. 144 failed polls in 24 hours, one every ten minutes, each followed by three errors about missing energy fields, 576 log entries in total. All four of its sensors stood at unknown. The integration itself reported loaded, which is what the integrations page shows, so nothing looked wrong from the UI.&lt;/p&gt;

&lt;p&gt;The local Modbus sensors on the same inverter still reported a daily yield of 22.63 kWh at the same time, so I could read the yield locally while the cloud sensors stood at unknown. Before fixing the kiosk reference I checked whether anything used those four sensors: no automation, no dashboard, not the energy configuration. I disabled the integration instead of repairing it. Home Assistant answered with require_restart and failed_unload, which is its way of saying the disable only completes after a restart. What I take from this is that loaded only describes the integration's setup. Whether its data arrives has to be checked on the sensors. My values have come from the &lt;a href="https://www.cloudapp.dev/home-assistant-huawei-sun2000-modbus-registers" rel="noopener noreferrer"&gt;local Modbus registers&lt;/a&gt; for a year, and the cloud integration was still set up although nothing used its sensors.&lt;/p&gt;

&lt;h2&gt;
  
  
  Finding 3: 123 errors from a REST sensor that could not handle null
&lt;/h2&gt;

&lt;p&gt;The my-PV heating rod exposes its state over a local HTTP endpoint, read by the &lt;a href="https://www.cloudapp.dev/home-assistant-rest-sensor-cloud-api" rel="noopener noreferrer"&gt;REST sensor&lt;/a&gt; pattern. 123 update errors in the day, 110 of them on the battery charge sensor: the API returned null for a field, the template passed it through, and Home Assistant refused the string None as a value with unit W. Eight further timeouts on the same endpoint. The fix treats missing data as unavailable instead of raising an error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# rest.yaml, the sensor that failed 110 times in a day&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Battery&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;charge"&lt;/span&gt;
  &lt;span class="na"&gt;unit_of_measurement&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;W&lt;/span&gt;
  &lt;span class="c1"&gt;# the API returns null while the device reboots; "None" is not a number&lt;/span&gt;
  &lt;span class="na"&gt;value_template&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="s"&gt;{{ value_json.m2sum | default(0, true) | float(0) }}&lt;/span&gt;
  &lt;span class="na"&gt;availability&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="s"&gt;{{ value_json.m2sum is number }}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One detail cost an extra round: my first version fell back to the string unknown, which produced the same conversion error, because Home Assistant 2024.11 writes the native value before it re-evaluates availability. The version above, a numeric fallback plus a separate availability template, went through rest.reload without a restart, and the sensor showed 0 W a minute later. On this core version a transient numeric fallback can still be written during the transition. I have only tested this on 2024.11.&lt;/p&gt;

&lt;h2&gt;
  
  
  Finding 4: eleven KNX addresses that would never answer
&lt;/h2&gt;

&lt;p&gt;Roughly once an hour the KNX integration logged read timeouts for eleven group addresses, the operating mode state addresses of eleven thermostats. The errors predate everything else in the log, so this was not new. I looked the addresses up in the ETS project: they belong to a forced-mode object whose read flag is disabled. Home Assistant was sending a read request to an object that is configured never to answer. There is no readable mode feedback on these devices.&lt;/p&gt;

&lt;p&gt;I removed the eleven state addresses from the YAML instead of guessing replacements or disabling state synchronisation globally. The mode commands, temperature and setpoint feedback are untouched. Home Assistant now has no independent confirmation of which mode a thermostat is in. For that, a proper feedback object would have to be provided in ETS. It is the same problem I wrote about when the &lt;a href="https://www.cloudapp.dev/home-assistant-knx-thermostat-standby-after-restart-fix" rel="noopener noreferrer"&gt;thermostats dropped to standby after every restart&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Finding 5: 100 unavailable entities, and why that number means little
&lt;/h2&gt;

&lt;p&gt;100 of 570 state objects were unavailable, 38 of them restored from the registry with no live source. Grouped: 44 Tapo entities from a camera that is deliberately switched off, 19 from the mobile app on phones, 13 TP-Link, 11 automations that are disabled leftovers, and a handful of templates and helpers. Two of those needed action: a smart plug has been in setup_in_progress since 28 August and is not reachable on its ports, and HACS has been asking for re-authentication since 8 September. The other 90 or so were expected.&lt;/p&gt;

&lt;p&gt;I mention this because bulk-deleting unavailable entities is a popular cleanup step, and here it would have removed entities that automations reference. I checked each group for use before removing anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  Finding 6: the garage door that was reported open
&lt;/h2&gt;

&lt;p&gt;This one came a few days later, during the restart for the KNX changes, and it is the one I consider most serious. The raw door contact went unavailable for a moment while the KNX integration came up. A template sensor derived the door state from it with the expression not is_state(contact, 'on'). Unavailable is not on, so for that moment the template reported the garage door as open, and the dashboard showed it.&lt;/p&gt;

&lt;p&gt;I checked the recorder data from shortly before and after the restart. I found no switch command for the door, no knx.send to its address and no triggered automation. That is no proof that Home Assistant sent nothing, because I have not verified that all of this would have been recorded. Whether the door moved I can neither prove nor rule out, because the bus telegrams were not recorded. The template now has an availability condition and becomes unavailable together with its source instead of inventing a state. That change went live through a template reload, no restart needed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# before: unavailable counted as "open"&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;binary_sensor&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Garage&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;door&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;open"&lt;/span&gt;
      &lt;span class="na"&gt;state&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;not&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;is_state('binary_sensor.garage_contact',&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;'on')&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;

&lt;span class="c1"&gt;# after: the template becomes unavailable together with its source&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;binary_sensor&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Garage&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;door&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;open"&lt;/span&gt;
      &lt;span class="na"&gt;state&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;not&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;is_state('binary_sensor.garage_contact',&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;'on')&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;
      &lt;span class="na"&gt;availability&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="s"&gt;{{ states('binary_sensor.garage_contact') not in ['unknown', 'unavailable'] }}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Finding 7: what the restart itself surfaced
&lt;/h2&gt;

&lt;p&gt;The restart on 16 September, done only after the changes above were prepared and checked, brought up two more. The old Shelly custom integration threw a TypeError on shutdown, made blocking calls in the event loop and left WebSocket errors behind. The boiler temperature sensor had two problems. Its template used float without a fallback for an unavailable source, and it published 701 where the precise sensor showed 70.1 degrees, a scaling error. Three disabled automations compare that sensor against 50 and 55 degrees, so it had to be fixed before any of them is enabled again.&lt;/p&gt;

&lt;p&gt;The boiler template now checks that its source is available and numeric, uses float(0) and has the scaling corrected by a factor of ten. After the reload the sensor showed 66.1 instead of 661 degrees. For the &lt;a href="https://www.cloudapp.dev/home-assistant-shelly-plus-1pm-2pm" rel="noopener noreferrer"&gt;Shelly integration&lt;/a&gt; I wrote a small compatibility module that moves the library import and shutdown into the executor, serialises the connection checks and closes the sockets with a bounded wait, plus four regression tests. It is a local patch on top of a custom component and has to be re-checked after every HACS update of that integration. The second restart came up with zero ERROR lines, the boiler at 66.2 degrees and the garage door closed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Repair order and the restart at the end
&lt;/h2&gt;

&lt;p&gt;The repair order was: unblock the camera automations, disable the dead cloud integration and fix the plug and the HACS login, fix the null handling, remove the KNX addresses that cannot answer, and only then clean up the disabled leftovers by actual use. Two things were off the table as diagnostic steps: a blanket restart, and a blanket deletion of unavailable entities. The restart came last, after the changes, and it was the step that found finding 6 and 7.&lt;/p&gt;

&lt;p&gt;Three of the seven findings affected operation: the hung camera calls, the null handling, and the template that turned unavailable into an open door. The KNX read timeouts and the errors from the restart did not affect operation, but they had causes I could remove. The cloud integration was unused, and most of the 100 unavailable entities were expected. The camera automation had been logging its warning since 6 September, and I only saw it when I read the log. My &lt;a href="https://www.cloudapp.dev/home-assistant-docker-update-rollback" rel="noopener noreferrer"&gt;update workflow&lt;/a&gt; has me read the log for a few minutes after each update. Between updates I had not been reading it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Is 775 errors a day a lot for Home Assistant?
&lt;/h3&gt;

&lt;p&gt;Here it was mostly four causes repeating. I judge the number by the causes behind it and by what stopped working, and that was three things.&lt;/p&gt;

&lt;h3&gt;
  
  
  Should I restart Home Assistant when the log fills up?
&lt;/h3&gt;

&lt;p&gt;Not as a first step. I would save the log and the automation traces first and look at the repeating entries, because a restart changes the state I want to examine.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why does a template report a state when its source is unavailable?
&lt;/h3&gt;

&lt;p&gt;Because not is_state(x, 'on') is also true for unknown and unavailable. An availability template that excludes those two source states fixes it.&lt;/p&gt;

&lt;p&gt;I wrote this for my own blog first, where the other posts about running this instance are, including the update workflow and the backup setup. I read the log on 13 September, and the last of the fixes went in on 16 September.&lt;/p&gt;

</description>
      <category>homeassistant</category>
      <category>devops</category>
      <category>debugging</category>
      <category>selfhosted</category>
    </item>
    <item>
      <title>Custom Cards in Home Assistant: Mushroom and button-card</title>
      <dc:creator>Michael Bernhart</dc:creator>
      <pubDate>Tue, 06 Oct 2026 06:19:41 +0000</pubDate>
      <link>https://dev.to/cloudapp_dev/custom-cards-in-home-assistant-mushroom-and-button-card-2ohk</link>
      <guid>https://dev.to/cloudapp_dev/custom-cards-in-home-assistant-mushroom-and-button-card-2ohk</guid>
      <description>&lt;p&gt;&lt;strong&gt;Correction, November 2026:&lt;/strong&gt; An earlier version of this post showed translated and simplified versions of the code; the excerpts below are now the real code with its German labels. It also called the VM a demo instance, gave the dashboard 300 instead of 481 lines and the fonts 76 instead of about 64 KB, said the battery sensor updates every few seconds (it changes at most once a minute), pointed to a complete YAML file in the templates post that was never there, and ended with advice for a daily dashboard that my own daily dashboard does not follow. While correcting it I also found that the card-mod typography on the value tiles never took effect, although the post said it did. The first correction on 20 November suggested a fix that I had not tested and that would not have worked either; the section now shows the fix I tested on the VM. Those parts are corrected below.&lt;/p&gt;

&lt;p&gt;The stock cards in Home Assistant get you a working dashboard in an afternoon, and I described that one in &lt;a href="https://www.cloudapp.dev/home-assistant-dashboard-from-zero-five-steps" rel="noopener noreferrer"&gt;five build steps&lt;/a&gt;. I built it in August 2026 on the same day as a second dashboard with custom cards, so that I could show the two side by side. What the stock cards do not give you is control over typography, over how a number is drawn, or over a ring that shows a battery level. This post is about the four custom cards in the second dashboard, the theme that holds them together, the four things that broke while building it, and one mistake I only found while correcting this post.&lt;/p&gt;

&lt;p&gt;Both dashboards run on my new Home Assistant instance, a small Hetzner VM, the same one the &lt;a href="https://www.cloudapp.dev/home-assistant-themes-six-compared" rel="noopener noreferrer"&gt;theme comparison&lt;/a&gt; was shot on. Their sensors come from a demo package that calculates a daily curve from the time of day, so none of the values are from my house. Since the house automation moved onto that VM at the end of September, both demo dashboards are hidden from the sidebar; they still load from their YAML files. The instrument dashboard is 481 lines long, and the &lt;a href="https://www.cloudapp.dev/home-assistant-dashboard-templates-to-copy" rel="noopener noreferrer"&gt;templates post&lt;/a&gt; explains why I did not publish it in full. The excerpts below are cut from the real files, with the German labels I use, and cover the parts you cannot see in the screenshot.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh047odseezcos3zb7vme.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh047odseezcos3zb7vme.jpg" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Four cards, loaded without HACS
&lt;/h2&gt;

&lt;p&gt;The four custom cards are card-mod (CSS injection into any card), Mushroom (the compact tile cards), mini-graph-card (the line charts) and button-card (a card that renders whatever JavaScript you hand it). On a normal installation you install them through &lt;a href="https://www.cloudapp.dev/how-to-install-hacs-in-home-assistant" rel="noopener noreferrer"&gt;HACS&lt;/a&gt;, or on Home Assistant 2026.11 or newer through the built-in Marketplace, and it registers the resources for you. On the VM I wanted the setup reproducible from the repository alone, so I downloaded the four bundles into www/cards on 20 August and load them from configuration.yaml:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# configuration.yaml (excerpt)
frontend:
  themes: !include_dir_merge_named themes
  # Custom Cards und die Schrift-Einbindung. extra_module_url laedt ES-Module
  # auf jeder Seite - das ist der Weg, der ohne HACS und ohne die
  # Ressourcen-Verwaltung im Speichermodus auskommt.
  extra_module_url:
    - /local/cards/card-mod.js
    - /local/cards/mushroom.js
    - /local/cards/mini-graph-card-bundle.js
    - /local/cards/button-card.js
    - /local/ha-fonts.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The file has two more entries today, for cards I wrote later. The fifth entry above is not a card. It is the font loader, which I need because a theme cannot contain @font-face rules.&lt;/p&gt;

&lt;h2&gt;
  
  
  Themes cannot declare fonts
&lt;/h2&gt;

&lt;p&gt;The design direction for this dashboard was an instrument panel: labels small, uppercase and widely spaced in Archivo, values large and calm in IBM Plex Mono with tabular figures. I wanted tabular figures because with proportional digits a value like 2,449 W changes width whenever a digit changes, and the number jumps sideways once a minute. You only notice that in the running dashboard; a screenshot does not show it.&lt;/p&gt;

&lt;p&gt;A Home Assistant theme can only set CSS variables. It cannot declare an @font-face rule, so the fonts have to come from somewhere else. A small ES module loaded through extra_module_url appends the rules to the document head, and because @font-face is document-wide it also applies inside the shadow roots of the cards. This is the whole file, with my German comments:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// www/ha-fonts.js
// ha-fonts.js — selbst gehostete Schriften fuer das Instrument-Theme.
//
// Warum eine JS-Datei und kein Theme-Eintrag: HA-Themes setzen CSS-Variablen,
// sie koennen keine @font-face-Regeln deklarieren. Ueber
// `frontend: extra_module_url` wird dieses Modul auf jeder Seite geladen und
// haengt die Regeln in den Document-Head. @font-face ist dokumentweit gueltig
// und wirkt damit auch in den Shadow-Roots der Karten.
//
// Bewusst NICHT ueber fonts.googleapis.com: die Dateien liegen unter
// /local/fonts/ auf derselben Maschine. Kein externer Request, kein Abfluss
// von Besucher-IPs, funktioniert ohne Internet.

const CSS = `
@font-face {
  font-family: 'Archivo';
  src: url('/local/fonts/archivo-var.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/local/fonts/plexmono-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/local/fonts/plexmono-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/local/fonts/plexmono-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}

/* Tabellenziffern global: Messwerte sollen beim Aktualisieren nicht springen.
   Das ist der Unterschied zwischen einer Anzeige und einem Zappeln. */
html {
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
`;

const style = document.createElement('style');
style.id = 'instrument-fonts';
style.textContent = CSS;
if (!document.getElementById('instrument-fonts')) {
  document.head.appendChild(style);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The last rule switches tabular figures on for the whole page, which turned out to matter, because the card-mod blocks further down were meant to do the same for the tiles and did not work until I fixed them in November 2026. The font files are served from /local/fonts on the same machine: one Archivo file and three IBM Plex Mono weights, about 64 KB together. The browser loads them from the VM and sends no request to fonts.googleapis.com. One surprise on the way: Google's font API returned the same variable font file for all four Archivo weights I requested. When I compared the checksums, I found that I had downloaded the same 35 KB file four times.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mushroom template cards as value tiles
&lt;/h2&gt;

&lt;p&gt;The three tiles next to and below the generation graph, consumption (Verbrauch), feed-in (Einspeisung) and grid import (Netzbezug), are Mushroom template cards. The template card takes a primary and a secondary text, both Jinja, an icon and an icon colour that can also be a template. That last part makes the tiles readable at a glance: grid import turns red only while there is any, feed-in turns teal only while there is any, otherwise both are grey. Consumption stays grey. These are the options of the older template card. Current Mushroom releases rebuilt the template card on top of Home Assistant's tile card, with color and vertical instead of icon_color and layout, and keep the old one as mushroom-legacy-template-card. The bundle I downloaded still renders my older options, as the screenshot shows.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fot4hiljyxo8s201rx134.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fot4hiljyxo8s201rx134.jpg" width="800" height="246"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# dashboards/instrument.yaml as built in August (excerpt: first and third tile)
- type: custom:mushroom-template-card
  primary: Verbrauch
  secondary: "{{ states('sensor.demo_hausverbrauch') | int }} W"
  icon: mdi:home-lightning-bolt
  icon_color: grey
  layout: vertical
  card_mod: &amp;amp;werteblock
    style: |
      ha-card {
        border: 1px solid var(--ha-card-border-color);
        padding-bottom: 4px;
      }
      mushroom-state-info$: |
        .primary {
          font-family: Archivo, sans-serif !important;
          font-size: 0.68rem !important; font-weight: 600 !important;
          letter-spacing: 0.16em; text-transform: uppercase;
          color: var(--secondary-text-color) !important;
        }
        .secondary {
          font-family: 'IBM Plex Mono', monospace !important;
          font-size: 1.28rem !important; font-weight: 500 !important;
          color: var(--primary-text-color) !important;
          font-variant-numeric: tabular-nums;
          margin-top: 2px;
        }

- type: custom:mushroom-template-card
  primary: Netzbezug
  secondary: "{{ states('sensor.demo_netzbezug') | int }} W"
  icon: mdi:transmission-tower-export
  icon_color: &amp;gt;
    {{ 'red' if states('sensor.demo_netzbezug') | int &amp;gt; 0 else 'grey' }}
  layout: vertical
  card_mod: *werteblock
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The card-mod block was meant to set the typography: small uppercase labels in Archivo, values in IBM Plex Mono. The screenshot shows that it never did. The labels are neither uppercase nor spaced, and the values are not in the monospaced font. With style: | the whole block is one CSS string, and the line mushroom-state-info$: | inside it is not CSS. The browser discards the rule it belongs to, and the .secondary rule after it finds no element at that level. Only the border on ha-card applied. The mistake was in both anchors, werteblock for the four value tiles and raumkarte for the seven environment and climate tiles, eleven template cards in all, and I only noticed it while correcting this post. My first correction suggested the mapping form from the card-mod documentation, with mushroom-state-info$ as a key. That would not have helped either. In the browser's developer tools the template card in the Mushroom version on my VM contains no mushroom-state-info element at all. Because it is built on the tile card, its two texts are span elements with slot=primary and slot=secondary inside ha-tile-info, in the same shadow root as the style that card-mod injects. A plain CSS string with direct selectors reaches them. In November 2026 I changed the anchor to this and checked the computed styles on all eleven template cards:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# dashboards/instrument.yaml (excerpt: the fixed anchor, November 2026)
card_mod: &amp;amp;werteblock
  # Template-Card ab Mushroom 5: Text steht in ha-tile-info, im selben
  # Shadow Root wie dieser Style, deshalb ohne $-Pfad.
  style: |
    ha-card {
      border: 1px solid var(--ha-card-border-color);
      padding-bottom: 4px;
    }
    ha-tile-info [slot=primary] {
      font-family: Archivo, sans-serif !important;
      font-size: 0.68rem !important; font-weight: 600 !important;
      letter-spacing: 0.16em !important; text-transform: uppercase;
      color: var(--secondary-text-color) !important;
    }
    ha-tile-info [slot=secondary] {
      font-family: 'IBM Plex Mono', monospace !important;
      font-size: 1.28rem !important; font-weight: 500 !important;
      color: var(--primary-text-color) !important;
      font-variant-numeric: tabular-nums;
      margin-top: 2px;
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw466ck9i4f4b26h7aknm.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw466ck9i4f4b26h7aknm.jpg" width="800" height="256"&gt;&lt;/a&gt;&lt;br&gt;
The raumkarte anchor is also used by three entity cards and a select card in the controls section, and those still render mushroom-state-info with its own shadow root. So that anchor is now a mapping: a dot for the card's own shadow root with the same span selectors, and mushroom-state-info$ for the other cards. The number card for the target temperature had the same mistake and got the same form. On those cards the letter spacing only applied with !important.&lt;/p&gt;
&lt;h2&gt;
  
  
  The battery ring as an SVG stroke
&lt;/h2&gt;

&lt;p&gt;The storage tile shows the state of charge as a ring. My first version was a button-card with a conic-gradient background and a smaller circle on top of it, whose background was set to var(--ha-card-background) to punch the hole. That produced a full disc. The inner circle stayed transparent and the gradient showed through. At the time I put it down to the variable not resolving inside the shadow DOM of button-card, and I did not look into it further.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1wezjltdaw9wz4awf1ug.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1wezjltdaw9wz4awf1ug.jpg" width="800" height="334"&gt;&lt;/a&gt;&lt;br&gt;
The version that works draws the ring as an SVG circle and uses stroke-dasharray to show the filled portion, so there is no inner circle that needs a background. The colour switches at 60 and 25 percent, and the ring is a custom field in button-card, computed in JavaScript from the sensor state. The card also has a second custom field for the charge flow below the ring and a block of styles that sets fill: none and a stroke width of 9 on both circles. Without those styles the circles are drawn as filled black discs. Both are left out of this excerpt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# dashboards/instrument.yaml (excerpt: the ring field)
- type: custom:button-card
  entity: sensor.demo_batterie_ladestand
  show_name: false
  show_state: false
  show_icon: false
  custom_fields:
    ring: |
      [[[
        const soc = Math.max(0, Math.min(100, Number(states['sensor.demo_batterie_ladestand'].state) || 0));
        const col = soc &amp;gt;= 60 ? '#54cabe' : (soc &amp;gt;= 25 ? '#f0a44a' : '#e0685f');
        const R = 52, C = 2 * Math.PI * R;
        const dash = (soc / 100) * C;
        return `
          &amp;lt;svg class="ring" viewBox="0 0 120 120"&amp;gt;
            &amp;lt;circle class="track" cx="60" cy="60" r="${R}"/&amp;gt;
            &amp;lt;circle class="val"   cx="60" cy="60" r="${R}"
                    stroke="${col}"
                    stroke-dasharray="${dash.toFixed(1)} ${(C - dash).toFixed(1)}"
                    transform="rotate(-90 60 60)"/&amp;gt;
            &amp;lt;text class="num" x="60" y="58"&amp;gt;${soc}&amp;lt;/text&amp;gt;
            &amp;lt;text class="pct" x="60" y="58" dx="${soc &amp;gt;= 100 ? 30 : 22}"&amp;gt;%&amp;lt;/text&amp;gt;
            &amp;lt;text class="lbl" x="60" y="76"&amp;gt;LADESTAND&amp;lt;/text&amp;gt;
          &amp;lt;/svg&amp;gt;`;
      ]]]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Two more things that broke
&lt;/h2&gt;

&lt;p&gt;Markdown cards as section headings broke the grid. I had used markdown cards for the small uppercase section labels. A markdown card counts as a grid cell, so the tiles below it wrapped onto the wrong columns. In the sections layout the native heading card takes a full-width row of its own, so the cards below it start on the next row. Every section label on the dashboard is now a heading card with card-mod for the letter spacing.&lt;/p&gt;

&lt;p&gt;The slider stayed neon yellow. The target temperature control at the bottom right is a Mushroom number card on a demo input_number. I had set Mushroom's own colour variable in the theme, and the slider ignored it. It takes its colour from Home Assistant's --rgb-state-number variable, which I found by reading the computed styles in the running frontend. The theme now sets both, plus the input_number variant:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbq1rpnyekgseej36zdsy.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbq1rpnyekgseej36zdsy.jpg" width="800" height="404"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# themes/instrument.yaml (excerpt)
Instrument:
  modes:
    dark:
      mush-rgb-state-number: "240, 164, 74"
      # HA faerbt input_number-Regler ueber --rgb-state-number, nicht ueber
      # die Mushroom-Variablen. Ohne diese Zeile bleibt der Regler neongelb.
      rgb-state-number: "240, 164, 74"
      rgb-state-input-number: "240, 164, 74"
    light:
      mush-rgb-state-number: "180, 106, 18"
      rgb-state-number: "180, 106, 18"
      rgb-state-input-number: "180, 106, 18"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The fourth one is a testing problem rather than a design problem. Light mode kept showing Home Assistant's default white instead of my theme. The frontend.set_theme service only sets the server default per mode, and as long as a user profile says backend-selected, I could not reliably control in my screenshot runs which mode applies. For reproducible screenshots the theme has to be set explicitly, which my screenshot script does by writing selectedTheme into localStorage before it loads the page.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it costs, and what my daily dashboard uses
&lt;/h2&gt;

&lt;p&gt;The instrument dashboard needs four custom cards and 481 lines of YAML, comments included, for what the stock version does with 23 cards, no plugins and 172 lines. The two screenshots in the &lt;a href="https://www.cloudapp.dev/home-assistant-dashboard-templates-to-copy" rel="noopener noreferrer"&gt;templates post&lt;/a&gt; show the difference. After an update of any of the four cards I would have to check whether my styling still works. Each of the four cards is a separate project with its own release cycle, and card-mod reaches into shadow DOM selectors that the Mushroom maintainers can rename in any release. The template card is an example: the mushroom-state-info selector that older card-mod examples use does not match it in the version I installed. The four bundles on the VM are still the ones I downloaded on 20 August, and I have not tested an update yet.&lt;/p&gt;

&lt;p&gt;The earlier version of this post ended with what I would use for a daily dashboard: Mushroom alone, without card-mod. When I built the dashboard the house actually runs on, at the end of September, I did something else. It is generated by a script and consists mostly of button-card with seven templates of my own, plus mini-graph-card for the trends and card-mod for details. It uses no Mushroom card and no battery ring. What it took over from this dashboard is the Instrument theme and the two fonts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Do I need HACS or the Marketplace to use Mushroom or button-card?
&lt;/h3&gt;

&lt;p&gt;No. The cards are plain JavaScript modules. Put the file under config/www, which Home Assistant serves as /local/, and add its /local/ URL either under frontend: extra_module_url in configuration.yaml or as a JavaScript module in the dashboard resources. HACS or the Marketplace only do the download and the registration for you. Without them, nothing tells you about new versions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why does card-mod need the dollar sign in the selector?
&lt;/h3&gt;

&lt;p&gt;In a card-mod style mapping, a key ending in a dollar sign enters that element's shadow root, which my Mushroom entity, select and number cards need for their texts. My template cards use direct CSS selectors instead, because their text spans sit in the same shadow root as the injected style.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does the SVG ring update live?
&lt;/h3&gt;

&lt;p&gt;Yes, button-card updates the ring without a page reload when the bound sensor changes state. My demo sensor calculates its value from the time of day and changes at most once a minute.&lt;/p&gt;

</description>
      <category>homeassistant</category>
      <category>dashboard</category>
      <category>javascript</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Where Home Assistant Runs: One Small VM, Measured</title>
      <dc:creator>Michael Bernhart</dc:creator>
      <pubDate>Fri, 02 Oct 2026 08:22:10 +0000</pubDate>
      <link>https://dev.to/cloudapp_dev/where-home-assistant-runs-one-small-vm-measured-28bi</link>
      <guid>https://dev.to/cloudapp_dev/where-home-assistant-runs-one-small-vm-measured-28bi</guid>
      <description>&lt;p&gt;I moved Home Assistant onto a machine of its own this month — a small cloud VM, nothing sitting at home. Before I did, I wanted a straight answer to something the documentation does not give you: what does it actually need?&lt;/p&gt;

&lt;p&gt;What I settled on is a Hetzner cx23. Two vCPU, 4 GB of memory, 40 GB of disk, in Nuremberg, on Ubuntu 24.04. That comes to 7.09 euro a month before tax. Home Assistant 2026.8.2 runs in a container on Docker 29.7.2, with &lt;strong&gt;network_mode: host&lt;/strong&gt;.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2pr9dbdoicndtvtoqwp5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2pr9dbdoicndtvtoqwp5.jpg" width="800" height="500"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;What the machine serves: a dashboard built from stock cards, running on demo sensors.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What it actually uses
&lt;/h2&gt;

&lt;p&gt;With the container stopped, the machine sits at 611 MB. That is Ubuntu plus the Docker daemon and nothing else. Two minutes after starting Home Assistant it reads 960 MB, and the container accounts for 339 MB of that.&lt;/p&gt;

&lt;p&gt;The figure moves, which is why the timing belongs next to it. Immediately after start it reads 850 MB. After 22 hours of uptime I measured between 969 and 985 MB. Anyone quoting a memory number for Home Assistant should say when they took it; I got all three of these on the same machine.&lt;/p&gt;

&lt;p&gt;From &lt;strong&gt;docker compose up&lt;/strong&gt; to an HTTP 200 on port 8123 took 6.6 seconds, measured in half-second steps. The interface answers before the integrations have finished initialising, so the 6.6 seconds measure the web server coming up. The integrations take longer.&lt;/p&gt;

&lt;p&gt;The image is 625 MB. After the base setup the disk sat at 5.4 GB of 38 available, and at 9.4 GB once I added a 4 GB swap file. The jump is the swap file.&lt;/p&gt;

&lt;p&gt;Two vCPU and 4 GB is more than a container install with no add-ons needs today. I would not go lower, because the recorder database grows steadily and swap on a 4 GB machine is what keeps an upgrade from being killed for memory.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this is not running on the Kubernetes cluster
&lt;/h2&gt;

&lt;p&gt;I already run a single-node k3s for other things, so the obvious question was whether Home Assistant belonged there. I measured that machine first: 11.7 percent CPU as a baseline across seven days, before any workload of mine runs at all, and 1 to 1.5 GB of memory for the control plane sitting idle.&lt;/p&gt;

&lt;p&gt;What decided it was networking. Home Assistant needs mDNS and broadcast traffic to find devices on the network. In Docker that is &lt;strong&gt;network_mode: host&lt;/strong&gt;, one line. The Kubernetes equivalent is &lt;strong&gt;hostNetwork: true&lt;/strong&gt;, and that gives up the network isolation which was the reason to run Kubernetes in the first place.&lt;/p&gt;

&lt;p&gt;One correction while I am here, because it comes up often: there is no Docker in K3s. K3s runs containerd, and the Docker backend has been deprecated for a while. The image is the same OCI image; only the runtime underneath differs.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a standard setup leaves open
&lt;/h2&gt;

&lt;p&gt;I went over the machine the day after cloud-init built it, and found four things that were worth fixing. None of them shows up as an error.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ufw was installed and never enabled.&lt;/strong&gt; The package was in the cloud-init list, and without an explicit enable the result is a firewall reporting &lt;strong&gt;inactive&lt;/strong&gt;. It does not matter while the provider firewall in front of it filters everything, and it starts mattering the moment ports 80 and 443 open for TLS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;sshd had password authentication on&lt;/strong&gt;, which is the Ubuntu default. Root itself is key-only, so nothing was exposed yet — but any additional user created later could have logged in with a password.&lt;/p&gt;

&lt;p&gt;There was &lt;strong&gt;no swap&lt;/strong&gt; on a 4 GB machine, and the SSH allow-list held exactly one address: a home connection whose IP rotates. I have locked myself out that way on another project, so a fixed second address went in as an anchor.&lt;/p&gt;

&lt;p&gt;All four are fixed on the running machine and written back into the cloud-init file, so rebuilding does not quietly undo them.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a machine in a data centre cannot do
&lt;/h2&gt;

&lt;p&gt;This is the part most posts about hosting Home Assistant leave out, and it is the first thing you should check before copying my setup. Your devices are on your home network. A VM in Nuremberg is not, and mDNS discovery stops at your router. Anything that speaks only on the local network — Zigbee sticks, KNX, most cheap WiFi plugs — is unreachable from there.&lt;/p&gt;

&lt;p&gt;For this build that is on purpose. It binds no device at all in its first phase; it exists to be set up cleanly and photographed. The house is still run by the old instance, which sits where it can see the hardware.&lt;/p&gt;

&lt;p&gt;If you want a cloud machine and local devices, you need a tunnel back home, and then the tunnel becomes the part most likely to fail, rather than the server. A machine at home avoids that entirely. What it costs you instead is the uptime, the backups and the upgrade discipline that the provider otherwise handles.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would keep
&lt;/h2&gt;

&lt;p&gt;The container install, because nothing about it has needed attention. No Supervisor, no add-ons, one compose file, and an upgrade is a changed image tag. What I gave up is the add-on ecosystem, and for a machine that does nothing but run Home Assistant I have not missed it yet. Worth separating two things that get confused here: add-ons are a Supervisor feature and a container install has none, while &lt;a href="https://www.cloudapp.dev/why-the-home-assistant-community-store-hacs-is-a-must-have-for-every-ha-user" rel="noopener noreferrer"&gt;HACS&lt;/a&gt; works fine in a container and gives you integrations, cards and themes.&lt;/p&gt;

&lt;p&gt;If you want the install itself rather than the machine choice, I wrote that up separately for &lt;a href="https://www.cloudapp.dev/home-assistant-how-to-install-via-docker-on-an-azure-linux-vm" rel="noopener noreferrer"&gt;Docker on a Linux VM&lt;/a&gt;. And once it runs, the first thing worth doing is &lt;a href="https://www.cloudapp.dev/home-assistant-backup-strategy-full-host" rel="noopener noreferrer"&gt;a backup that covers the whole host&lt;/a&gt;, not just the config folder.&lt;/p&gt;

</description>
      <category>homeassistant</category>
      <category>docker</category>
      <category>selfhosted</category>
      <category>kubernetes</category>
    </item>
    <item>
      <title>21 Releases Behind: I Rebuilt Instead of Upgrading</title>
      <dc:creator>Michael Bernhart</dc:creator>
      <pubDate>Thu, 01 Oct 2026 18:29:14 +0000</pubDate>
      <link>https://dev.to/cloudapp_dev/21-releases-behind-i-rebuilt-instead-of-upgrading-3lnl</link>
      <guid>https://dev.to/cloudapp_dev/21-releases-behind-i-rebuilt-instead-of-upgrading-3lnl</guid>
      <description>&lt;p&gt;The Home Assistant that runs my house is on 2024.11.1, released in November 2024. The current version is 2026.8.2. That is roughly 21 monthly releases of distance, and it has been running the whole time without complaining.&lt;/p&gt;

&lt;p&gt;Before deciding anything I checked what was actually in there, against the running instance's own REST API rather than from memory: &lt;strong&gt;751 entities, 150 components, no themes at all&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  I did not try to upgrade
&lt;/h2&gt;

&lt;p&gt;This matters more than the rest of the post, so it goes first. There was no failed upgrade. Nothing broke, because nothing was attempted: I decided against upgrading before trying it.&lt;/p&gt;

&lt;p&gt;The reasons were unglamorous and they accumulated. The old instance runs from a plain &lt;strong&gt;docker run&lt;/strong&gt; with no compose file, so there is no single document describing how it starts. Its configuration has grown for two years and nobody has read all of it recently. And a rollback would have meant restoring a VM snapshot, which takes the whole machine back, including anything else on it. That is the failure I would fix first on any instance meant to last: &lt;a href="https://www.cloudapp.dev/splitting-home-assistant-automations-yaml" rel="noopener noreferrer"&gt;splitting the automations into separate YAML files&lt;/a&gt; is what keeps a configuration readable long enough to upgrade it.&lt;/p&gt;

&lt;p&gt;None of that is impossible. Together it was enough that a clean build on a new machine looked like less work than an upgrade whose failure mode I could not describe in advance.&lt;/p&gt;

&lt;h2&gt;
  
  
  The screen that shows this was a choice
&lt;/h2&gt;

&lt;p&gt;When you start a fresh Home Assistant, the very first screen offers two things side by side: create a new home, or restore from a backup. The restore option gets the same weight as the other one.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm3o1y8fefo4g3arxi1ij.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm3o1y8fefo4g3arxi1ij.jpg" width="800" height="500"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The first screen. Restoring from a backup sits next to creating a new home.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I mention it because it weakens my own case. The way back was directly available, and I did not take it. I preferred a clean start, and nothing needed rescuing.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a fresh install starts with
&lt;/h2&gt;

&lt;p&gt;Three things surprised me on the way through, and each takes one sentence in a guide, so guides tend to skip them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The pre-selected country is the United States.&lt;/strong&gt; That screen has exactly one field and it starts wrong for most of the people reading this. Click through without looking and you get imperial units and dollars.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftno5cngfyldt3phrx9xv.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftno5cngfyldt3phrx9xv.jpg" width="800" height="500"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;One field, pre-set to the United States.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The language selector is on the welcome screen, before you create the user.&lt;/strong&gt; Switching it there saves you from having field names and area names created in English and then living with them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Home Assistant creates three areas by itself&lt;/strong&gt; — living room, kitchen, bedroom — and puts them on the first dashboard next to an empty summaries column. That is where a fresh install actually starts.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4ihooluuuf2yclna80e2.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4ihooluuuf2yclna80e2.jpg" width="800" height="500"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The first dashboard: three invented areas and an empty summaries column.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What rebuilding costs
&lt;/h2&gt;

&lt;p&gt;The part I underestimated is that a rebuild means dealing with all 751 entities again, one way or another. Every entity in the old instance exists because an integration was added and configured at some point, and none of that comes along. The new machine starts with the three areas Home Assistant invents and nothing else.&lt;/p&gt;

&lt;p&gt;The history goes too. Two years of recorder data stays with the old instance, so every long-run statistic starts from zero on the new one — energy totals, temperature trends, anything with a graph behind it. A backup restore would have kept all of it, which is exactly the trade being made here.&lt;/p&gt;

&lt;p&gt;The third cost is the tuning. Automations that were adjusted over two years because they fired at the wrong moment carry no record of why they look the way they do. Copying them across is easy. Working out which of the odd-looking conditions were deliberate takes much longer.&lt;/p&gt;

&lt;p&gt;So the honest summary is that I chose a clean machine over two years of accumulated state, on a house that is not urgently broken. If the old instance were failing, I would have restored the backup and dealt with the mess afterwards.&lt;/p&gt;

&lt;h2&gt;
  
  
  The old one is still running
&lt;/h2&gt;

&lt;p&gt;The new build binds no device in its first phase. The old instance continues to run the house, untouched, which is the only reason this was a comfortable decision at all. There is no cutover date yet and I am not setting one until the new machine has done something useful for a few weeks.&lt;/p&gt;

&lt;p&gt;If you are in the same position, the thing I would check first is whether your current instance can be described. If one file describes how it starts, an upgrade is usually an afternoon's work. If there is no such file, I would fix that first, and rebuilding is one way to do it.&lt;/p&gt;

&lt;p&gt;What made this safe was having a restore path I trusted. I wrote up &lt;a href="https://www.cloudapp.dev/home-assistant-backup-strategy-full-host" rel="noopener noreferrer"&gt;what a backup has to cover&lt;/a&gt; separately, and it is worth reading before you touch a two-year-old instance.&lt;/p&gt;

</description>
      <category>homeassistant</category>
      <category>docker</category>
      <category>selfhosted</category>
      <category>devops</category>
    </item>
    <item>
      <title>Splitting a 2,000-Line automations.yaml into 8 Files</title>
      <dc:creator>Michael Bernhart</dc:creator>
      <pubDate>Tue, 29 Sep 2026 10:08:22 +0000</pubDate>
      <link>https://dev.to/cloudapp_dev/splitting-a-2000-line-automationsyaml-into-8-files-24cn</link>
      <guid>https://dev.to/cloudapp_dev/splitting-a-2000-line-automationsyaml-into-8-files-24cn</guid>
      <description>&lt;p&gt;My automations.yaml had quietly grown into a 60 KB monster. 2,144 lines. 63 automations stacked end to end in a single file, averaging about 34 lines each. Scrolling it was a chore, editing it made me nervous, and finding one particular heating automation meant a full-text search. The file worked, so there was never any pressure to touch it, and there was a good reason not to: when you refactor a live config you can silently drop the automation that keeps the heating from freezing or the alarm from missing a sensor.&lt;/p&gt;

&lt;p&gt;So this is a small story about a refactor I almost didn't do, and the one thing that made me trust it: I wrote a 40-line script to split the file, and then I wrote a second, longer script whose only job was to prove the first one hadn't lost anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why one file stops scaling
&lt;/h2&gt;

&lt;p&gt;Home Assistant wires automations in through one line in &lt;strong&gt;configuration.yaml&lt;/strong&gt;: &lt;strong&gt;automation: !include automations.yaml&lt;/strong&gt;. That single include is convenient while the file is small. With 63 automations in there, a few groups had formed without my planning them. Heating was by far the biggest concern — 21 automations, a third of the whole file, driving 11 thermostats with day and night modes and room-by-room overrides. Alarm was the next slab at 13. Then a cluster around the AC·THOR power diverter, a handful of camera and detection rules, time-based switching, system housekeeping, and a long tail of one-offs.&lt;/p&gt;

&lt;p&gt;None of that structure was visible. It was just 2,144 lines in the order I'd happened to add each one. I wanted the heating rules in a heating file and the ability to open exactly the slice I was working on.&lt;/p&gt;

&lt;h2&gt;
  
  
  A 40-line splitter that classifies by name
&lt;/h2&gt;

&lt;p&gt;The splitter is deliberately boring. It's about 40 lines of pure standard-library Python — just &lt;strong&gt;yaml&lt;/strong&gt;, &lt;strong&gt;os&lt;/strong&gt;, and a &lt;strong&gt;defaultdict&lt;/strong&gt;. It loads the YAML list, walks each automation, decides which bucket it belongs to, and dumps one file per bucket into an &lt;strong&gt;automations/&lt;/strong&gt; directory.&lt;/p&gt;

&lt;p&gt;Here's the honest quirk: the classification isn't driven by any tag or metadata field, because there isn't one. It's substring matching on the automation's German &lt;strong&gt;alias&lt;/strong&gt;. If the alias contains "Heizung" it's heating; "Alarm" goes to alarm; "AC Thor" (in any of its hyphenated spellings) to ac_thor; camera and detection words to cameras; push and notification words to notifications; the time-control vocabulary to time_control; sync and reachability words to system; and everything the rules don't catch falls through to a misc bucket. So the classification depends entirely on how consistently I named things.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;categories&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;defaultdict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;automation&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;automations&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;alias&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;automation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;alias&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Unknown&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Heizung&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;alias&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;categories&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;heating&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;automation&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Alarm&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;alias&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;categories&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;alarm&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;automation&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;AC Thor&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;alias&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;AC-Thor&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;alias&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;categories&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;ac_thor&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;automation&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# ... cameras / notifications / time_control / system / misc
&lt;/span&gt;    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;categories&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;misc&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;automation&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;category&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;autos&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;categories&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;automations/&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;category&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;.yaml&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;w&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;yaml&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dump&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;autos&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;default_flow_style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                  &lt;span class="n"&gt;allow_unicode&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sort_keys&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two of the dump arguments are worth explaining. &lt;strong&gt;allow_unicode=True&lt;/strong&gt; keeps the German umlauts intact instead of mangling them into escape sequences, so a name like "Büro" survives the round trip. And &lt;strong&gt;sort_keys=False&lt;/strong&gt; preserves the original key order inside each automation — the trigger, condition and action stay in the order I wrote them, instead of getting alphabetised into nonsense.&lt;/p&gt;

&lt;h2&gt;
  
  
  Eight buckets the data chose for itself
&lt;/h2&gt;

&lt;p&gt;I didn't pick eight up front; I had half expected to hand-carve a dozen or so files. The committed splitter emits eight category files: heating, alarm, ac_thor, cameras, notifications, time_control, system, and misc. The distribution is lopsided: heating is 21 automations (33%), alarm is 13 (21%), AC·THOR is 5 (8%), and then it thins fast into pairs and singletons. By estimated size the heating file lands around 700 lines on its own, alarm around 440, cameras around 270, ac_thor around 170.&lt;/p&gt;

&lt;p&gt;A 700-line heating file controlling 11 thermostats with near-identical day/night/presence logic is an obvious candidate for templating into a handful of parameterised scripts, and with it isolated I can see what that would look like. The AC·THOR file, by contrast, came out clean and self-contained: temperature monitoring, power management, and a bit of system detection, all in one place.&lt;/p&gt;

&lt;h2&gt;
  
  
  The validator
&lt;/h2&gt;

&lt;p&gt;Before I changed a single line of &lt;strong&gt;configuration.yaml&lt;/strong&gt;, I wrote a second script — about 160 lines — whose entire purpose is to re-read the original file and every split file and assert the round trip is lossless. It runs five checks. One: the total automation count matches. Two: the set of unique aliases matches, with no automation missing and none invented. Three: any duplicate aliases are identical between original and split. Four: every automation &lt;strong&gt;id&lt;/strong&gt; value matches as a set. Five: a per-alias deep dictionary comparison to catch silent content drift.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;original_count&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;split_count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;COUNT CHECK: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;split_count&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; automations (matches original)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;missing_in_split&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;original_aliases&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;split_aliases&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;extra_in_split&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;split_aliases&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;original_aliases&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# IDs compared as sets; per-alias deep compare flags content drift
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;alias&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;original_alias_set&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;alias&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;split_by_alias&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;original_by_alias&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;alias&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;split_by_alias&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;alias&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
        &lt;span class="n"&gt;content_mismatches&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;alias&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The script separates errors from warnings. A count mismatch, a missing alias, an extra alias, an id-set divergence — those are hard errors, and the script exits 1 and refuses to bless the new layout. But the per-automation deep comparison is treated as a warning, and it exits 0 anyway. I did that on purpose: when you re-serialize YAML through the library, the bytes reformat — quoting style shifts, some flow collapses to block — but the parsed structure is functionally identical. If I treated every reformat as a failure, the validator would scream on every clean split and I'd learn to ignore it. In practice a lost automation aborts the run, and a change in quoting style only produces a warning.&lt;/p&gt;

&lt;h2&gt;
  
  
  Switching over
&lt;/h2&gt;

&lt;p&gt;With the validator passing, the switch is one line in &lt;strong&gt;configuration.yaml&lt;/strong&gt;: &lt;strong&gt;!include automations.yaml&lt;/strong&gt; becomes &lt;strong&gt;!include_dir_merge_list automations/&lt;/strong&gt;, and Home Assistant now merges every file in that directory into one automation list, exactly as if they were still concatenated.&lt;/p&gt;

&lt;p&gt;Then you reload without a full restart: a &lt;strong&gt;ha core check&lt;/strong&gt; to validate the config first, then a call to the &lt;strong&gt;homeassistant.reload&lt;/strong&gt; service against the automation entity — for me that's a small POST to the REST API at something like &lt;a href="http://homeassistant.local:8123" rel="noopener noreferrer"&gt;http://homeassistant.local:8123&lt;/a&gt;, no reboot, no downtime. The automations come back exactly as they were, just spread across eight readable files instead of one 2,144-line wall.&lt;/p&gt;

&lt;p&gt;If you take one habit from this, make it a naming convention: prefix new aliases with their category, like "Heating:  night mode", so the substring classifier stays deterministic as the config grows. Otherwise a new automation with an unusual name ends up in misc. The rest of this setup, &lt;a href="https://www.cloudapp.dev/home-assistant-how-to-install-via-docker-on-an-azure-linux-vm" rel="noopener noreferrer"&gt;from the Docker-on-Azure install&lt;/a&gt; on up, was built in similar small steps. The next one is templating the 700-line heating file.&lt;/p&gt;

</description>
      <category>homeassistant</category>
      <category>automation</category>
      <category>yaml</category>
      <category>smarthome</category>
    </item>
    <item>
      <title>Home Assistant Thermostat on KNX: Base vs. Active Setpoint</title>
      <dc:creator>Michael Bernhart</dc:creator>
      <pubDate>Wed, 23 Sep 2026 17:31:36 +0000</pubDate>
      <link>https://dev.to/cloudapp_dev/knx-thermostat-preset-modes-in-home-assistant-3co8</link>
      <guid>https://dev.to/cloudapp_dev/knx-thermostat-preset-modes-in-home-assistant-3co8</guid>
      <description>&lt;p&gt;&lt;strong&gt;Update, October 2026.&lt;/strong&gt; The first version of this post, from June, explained a symptom on my KNX room controllers with a cause I had never checked. It said that only the Auto preset lets you set a target temperature from Home Assistant, that the Comfort and Economy setpoints are fixed in the device, and that the controller overrules whatever you write. The tests on 23 October showed that writing the base changed the reported setpoint without any mode command before it. I could not read the controller's actual mode during the tests, and I never tested the advice to switch to Auto first.&lt;/p&gt;

&lt;p&gt;On the standard Home Assistant thermostat card I set a temperature, and a moment later the card showed a different value, in my tests one or two degrees lower. My writes reached the controller while Home Assistant showed Comfort; the controller's actual mode I could not read from the device. The value the card shows afterwards is a different one, reported by the controller. This post covers the tests from 23 October and the script and dashboard card I built for the 11 room controllers in the house.&lt;/p&gt;

&lt;h2&gt;
  
  
  The five HVAC modes on a KNX climate entity
&lt;/h2&gt;

&lt;p&gt;The controllers take the standard KNX HVAC mode (DPT 20.102) with five states: Auto, Comfort, Standby, Economy and Building Protection. Home Assistant shows them as preset modes. My automations use Comfort for the day, Economy for the night and Building Protection while a window is open. According to the controller documentation, Standby is a setback mode. The earlier version of this post treated it as heating off, which the documentation does not support.&lt;/p&gt;

&lt;p&gt;The card cannot tell you which mode the controller is really in. In the ETS project my controllers have no readable status object for the operating mode. Home Assistant sends mode changes to the command object. After a restart, reading that object returns Standby even if Home Assistant had sent Comfort before, and the controller's actual mode cannot be checked through it. The preset shown is only reliable when Home Assistant wrote it itself, which is the background of the &lt;a href="https://www.cloudapp.dev/home-assistant-knx-thermostat-standby-after-restart-fix" rel="noopener noreferrer"&gt;Standby-after-restart post&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two values behind one Home Assistant thermostat card
&lt;/h2&gt;

&lt;p&gt;According to the manufacturer documentation and the ETS export, each of the 11 JUNG controllers has a writable input for the &lt;strong&gt;comfort base temperature&lt;/strong&gt; and a readable output for the &lt;strong&gt;current setpoint&lt;/strong&gt;. Home Assistant uses the first as target temperature address and the second as target temperature state address. The controller adds the operating mode and any local shift at the device on top of the base. The climate entities live in knx.yaml, like the switches since I &lt;a href="https://www.cloudapp.dev/home-assistant-knx-ui-switches-to-yaml" rel="noopener noreferrer"&gt;moved them out of the UI&lt;/a&gt;. The excerpt shows them under the knx: key, as in a package file; with knx: !include knx.yaml that outer key is left out. The new sensor is the second block:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# knx.yaml — one room controller (group addresses are placeholders)&lt;/span&gt;
&lt;span class="na"&gt;knx&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;climate&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Thermostat&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Room&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;A"&lt;/span&gt;
      &lt;span class="na"&gt;temperature_address&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;9/0/3"&lt;/span&gt;               &lt;span class="c1"&gt;# room temperature (read)&lt;/span&gt;
      &lt;span class="na"&gt;target_temperature_address&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;9/1/3"&lt;/span&gt;        &lt;span class="c1"&gt;# comfort base temperature (write)&lt;/span&gt;
      &lt;span class="na"&gt;target_temperature_state_address&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;9/2/3"&lt;/span&gt;  &lt;span class="c1"&gt;# active setpoint the controller reports&lt;/span&gt;
      &lt;span class="na"&gt;operation_mode_address&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;9/3/3"&lt;/span&gt;            &lt;span class="c1"&gt;# HVAC mode command, no readable status&lt;/span&gt;
      &lt;span class="na"&gt;temperature_step&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.5&lt;/span&gt;
      &lt;span class="na"&gt;min_temp&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;18.0&lt;/span&gt;
      &lt;span class="na"&gt;max_temp&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;25.0&lt;/span&gt;
  &lt;span class="na"&gt;sensor&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# separate read-only sensor on the same active-setpoint address&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;RC&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;setpoint&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Room&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;A"&lt;/span&gt;
      &lt;span class="na"&gt;state_address&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;9/2/3"&lt;/span&gt;
      &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;temperature&lt;/span&gt;
      &lt;span class="na"&gt;sync_state&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;init&lt;/span&gt;
      &lt;span class="na"&gt;always_callback&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;   &lt;span class="c1"&gt;# every answer updates last_updated, even with an unchanged value&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reading the base back does not work here. The comfort input was not meant to be read, its read flag was added in the ETS later, and the answers decode to values like 0.21 °C, for reasons I have not found. The only reliable feedback is the active setpoint.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the tests on 23 October showed
&lt;/h2&gt;

&lt;p&gt;On the controller I tested I wrote a base of 23 °C, without any mode command. Home Assistant showed Comfort, which as described above is no confirmation from the device. The controller reported 21 °C, on its own and on a fresh read request. A base of 25 °C gave 23 °C, which looked like a fixed difference of −2 K.&lt;/p&gt;

&lt;p&gt;Then I raised the setpoint by one degree at the controller itself, and it reported 24 °C. From the Home Assistant dialog I lowered it to 23 °C, Home Assistant wrote a base of 23 °C, and the controller reported 22 °C. The difference was now −1 K, so an automation that always adds 2 K would have been wrong after one button press on the wall. Whether the original −2 K came from the operating mode or a local shift I do not know.&lt;/p&gt;

&lt;p&gt;Half degrees did not arrive exactly. Aiming for 23.5 °C, a base of 23.5 gave 23, a base of 24 gave 23, and a base of 24.5 gave 24. I tested this on one controller only and limited the new control to whole degrees for all of them.&lt;/p&gt;

&lt;p&gt;I did not switch any controller to Auto during these tests and have not tested what Auto does to the reported setpoint. The documentation also describes writing the comfort base in Comfort mode; in my test, writing worked without first sending a mode command, though I could not verify the controller's mode.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix: a read-back sensor and a correcting script
&lt;/h2&gt;

&lt;p&gt;Each controller now has its own read-only KNX sensor on the active-setpoint address. With always_callback set, every answer updates the sensor's last_updated timestamp, even when the value is unchanged, so the script can tell a fresh answer from a value Home Assistant already had.&lt;/p&gt;

&lt;p&gt;The script takes a room and a wanted temperature in whole degrees from 18 to 25 °C. It requests a fresh value and waits up to 5 seconds. If the controller already reports the wanted value, it stops without writing. Otherwise it writes a base, waits one second and reads again. For the next attempt, the script adds the difference between the wanted and the reported value to the last base it wrote; it determines that difference again on every call. After three writes, or when the next base would leave 18–25 °C, it stops with an error and the last reported value. It reports success only after the controller has returned the wanted setpoint twice, one second apart. The excerpt below shows only the correction loop; the room mapping, the variable setup and the separate read script are left out.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# packages/raumcontroller.yaml — shortened&lt;/span&gt;
&lt;span class="na"&gt;script&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;rc_set_temperature&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;single&lt;/span&gt;                 &lt;span class="c1"&gt;# one job at a time, no competing correction loops&lt;/span&gt;
    &lt;span class="na"&gt;fields&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;entity_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{}&lt;/span&gt;              &lt;span class="c1"&gt;# climate entity of the room&lt;/span&gt;
      &lt;span class="na"&gt;temperature&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{}&lt;/span&gt;            &lt;span class="c1"&gt;# wanted active setpoint, whole degrees 18–25&lt;/span&gt;
    &lt;span class="na"&gt;sequence&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="c1"&gt;# fresh read: knx.read, then wait up to 5 s for a newer last_updated&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="nl"&gt;&amp;amp;read_fresh&lt;/span&gt;
        &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;script.rc_read_setpoint&lt;/span&gt;
        &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;address&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;room.address&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;sensor&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;room.sensor&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
        &lt;span class="na"&gt;response_variable&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;reading&lt;/span&gt;
      &lt;span class="c1"&gt;# (already right -&amp;gt; report success without writing; omitted here)&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;repeat&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;count&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3&lt;/span&gt;
          &lt;span class="na"&gt;sequence&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;candidate&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;18&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;or&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;candidate&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;25&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;
              &lt;span class="na"&gt;then&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
                &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;stop&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Not&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;reachable&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;within&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;the&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;base&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;limits&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;18–25&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;°C."&lt;/span&gt;
                  &lt;span class="na"&gt;response_variable&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;result&lt;/span&gt;   &lt;span class="c1"&gt;# ok: false plus the last reported setpoint&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;climate.set_temperature&lt;/span&gt;   &lt;span class="c1"&gt;# writes the comfort base&lt;/span&gt;
              &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;entity_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;entity_id&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
              &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;temperature&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;candidate&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;delay&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;seconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;1&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="nv"&gt;*read_fresh&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;variables&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
                &lt;span class="na"&gt;actual&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;reading.actual&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;   &lt;span class="c1"&gt;# use the new reading for the next step&lt;/span&gt;
            &lt;span class="c1"&gt;# (no fresh answer -&amp;gt; error result; omitted)&lt;/span&gt;
            &lt;span class="c1"&gt;# (match -&amp;gt; wait 1 s, read again, success only on a second match; omitted)&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;variables&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
                &lt;span class="na"&gt;candidate&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;(candidate&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;+&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;wanted&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;-&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;actual)&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;|&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;round(2)&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;}}"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The script runs in single mode, and it does not hold the temperature afterwards: later changes at the controller or by the schedule apply as usual. With the measured difference of −1 K, an active setpoint of 25 °C would need a base of 26 °C, which Home Assistant is not allowed to write, so the card shows an error. Any other climate.set_temperature call, from another dashboard or a voice assistant, still writes the base directly and skips all of this, so automations should call the script.&lt;/p&gt;

&lt;h2&gt;
  
  
  The dashboard card and the tests
&lt;/h2&gt;

&lt;p&gt;All 11 standard thermostat tiles on my main dashboard are replaced by a small custom card with the room temperature, the active setpoint from the new sensor, and a field with plus and minus buttons in whole degrees. An empty field starts from the last reported setpoint. Nothing is sent until Apply starts the script. During a job the controls are locked, at 18 and 25 °C the respective button is disabled, and the result stays on the card, errors included.&lt;/p&gt;

&lt;p&gt;Eleven automated tests run the script's actual YAML sequences against a simulated bus: positive, negative and changing differences, a value that is already right, missing answers at each step, the base limits, too many attempts and invalid input. Browser tests cover the card. On the real controller I requested 24 °C and read back 24 °C after a base of 25 °C; the next request for 23 °C read back 23 °C at a base of 24 °C.&lt;/p&gt;

&lt;h2&gt;
  
  
  Automations that switch presets
&lt;/h2&gt;

&lt;p&gt;The heating automations never write a temperature, only the preset, so the setpoint problem did not affect them. A helper called heating night mode goes on at 21:00 and off at 05:00, which sets all 11 controllers to Economy or Comfort. The earlier version said 06:00 because the old automation's entity id says so, though it has always run at 05:00. Night was Standby in one place and Economy in two. On the new instance I set all three to Economy and made the helper keep its state across a restart.&lt;/p&gt;

&lt;p&gt;The window logic covers eight rooms. After a window has been open for 5 seconds, that room goes to Building Protection, and 5 seconds after closing it returns to the mode that currently applies. On the old instance this was 16 copied UI automations, and closing always set Comfort, also at night. On the new instance it is one automation with a table from window to controller, and the day and night automations skip rooms with an open window. More in the &lt;a href="https://www.cloudapp.dev/home-assistant-knx-window-open-heating-off" rel="noopener noreferrer"&gt;window post&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Without a readable mode status, sending the mode again after a start is the only way to a known state. The startup automation waits 30 seconds, then sets the night or day mode, again skipping open windows. On the old instance it has been disabled since January. The new heating automations described in this section are set up on the new instance but stay disabled until I move heating over; until then the old instance runs the schedule and the window logic. The setpoint sensors, the script and the card are already in use on the new instance. Whether I keep that day-or-night choice at startup when I move heating over is not decided yet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Why does my KNX thermostat show a different temperature than I set in Home Assistant?
&lt;/h3&gt;

&lt;p&gt;On controllers like mine, Home Assistant sends the comfort base and then displays the setpoint the controller reports, which includes the operating mode and any local shift. The standard card has room for one target value only.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do I have to switch to Auto before changing the temperature?
&lt;/h3&gt;

&lt;p&gt;My writes reached the JUNG controller without switching modes first. I have not tested Auto itself or its effect on the reported setpoint.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I compensate the difference with a fixed offset?
&lt;/h3&gt;

&lt;p&gt;Not reliably. The difference I measured went from −2 K to −1 K after one local adjustment, which is why the script recalculates it from fresh read-backs on every call and gives up after three attempts.&lt;/p&gt;

</description>
      <category>homeassistant</category>
      <category>knx</category>
      <category>smarthome</category>
      <category>automation</category>
    </item>
  </channel>
</rss>
