<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
    <channel>
      <title>The Helpful Idiot</title>
      <link>https://thehelpfulidiot.com</link>
      <description>Idiots don&#39;t have time for cable management.</description>
      <generator>Zola</generator>
      <language>en</language>
      <atom:link href="https://thehelpfulidiot.com/rss.xml" rel="self" type="application/rss+xml"/>
      <lastBuildDate>Mon, 05 Oct 2026 00:00:00 +0000</lastBuildDate>
      <item>
          <title>Cleaning Up Six Years of Home Assistant with Claude</title>
          <pubDate>Mon, 05 Oct 2026 00:00:00 +0000</pubDate>
          <author>thehelpfulidiot</author>
          <link>https://thehelpfulidiot.com/cleaning-up-six-years-of-home-assistant-with-claude/</link>
          <guid>https://thehelpfulidiot.com/cleaning-up-six-years-of-home-assistant-with-claude/</guid>
          <description xml:base="https://thehelpfulidiot.com/cleaning-up-six-years-of-home-assistant-with-claude/">&lt;p&gt;My Home Assistant setup has been running since at least 2020. Some of my automations still have IDs like &lt;code&gt;1588516677003&lt;/code&gt;, which is just the time I clicked &quot;save&quot; in May 2020. Since then I have added a little bit at a time and removed basically nothing.&lt;/p&gt;
&lt;p&gt;By this fall it had &lt;strong&gt;421 automations&lt;/strong&gt; and &lt;strong&gt;206 scripts&lt;/strong&gt;. Two versions of my voice media controls (v7 &lt;em&gt;and&lt;/em&gt; v8) were both turned on, so saying &quot;volume up&quot; turned the volume up twice. One automation ran every single second, all day, just to refresh a sensor. And I had a sneaking suspicion that a few things only worked by accident.&lt;/p&gt;
&lt;p&gt;It worked, mostly. My family uses it every day. And that was exactly why I never wanted to touch it.&lt;/p&gt;
&lt;p&gt;So I did what I did with &lt;a href=&quot;/goodbye-wordpress-hello-zola&quot;&gt;this blog&lt;/a&gt;: I sat down with Claude, an AI from Anthropic, and we cleaned it up together. Claude did most of the reading, writing and testing. I made the decisions, answered a lot of questions about my house, and pasted commands into my server. Here&#39;s how that went.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/2026/10/ha-numbers-final.png&quot; alt=&quot;Before and after: automations went from 421 to 237, scripts from 206 to 98, YAML from about 32,150 lines to about 21,000, scheduled automation runs from about 389,000 a day to about 5,900, and history rows written from about 1.9 million a day to about 1.1 million&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;The end result, after 103 commits over three days&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&quot;step-zero-get-it-into-git&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#step-zero-get-it-into-git&quot; aria-label=&quot;Anchor link for: step-zero-get-it-into-git&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Step Zero: Get It Into Git&lt;/h2&gt;
&lt;p&gt;Before anything else, the config had to go into Git. My Home Assistant runs in Docker, and the config folder is just a folder on the server. Turning it into a Git repo means every change becomes a commit: I can read it, ask questions about it, and roll it back.&lt;/p&gt;
&lt;p&gt;The catch is that a Home Assistant config folder is full of things that should never leave the house: &lt;code&gt;secrets.yaml&lt;/code&gt;, the &lt;code&gt;.storage&lt;/code&gt; folder (which has tokens in it), the database, logs, SSH keys, camera snapshots, and whatever else integrations have dropped in there over six years. A normal &lt;code&gt;.gitignore&lt;/code&gt; lists the things to leave out, which means anything you forgot about goes in. Mine works the other way around: it ignores &lt;em&gt;everything&lt;/em&gt; and then opts in only the files I actually want tracked. Here it is, trimmed a little:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# ALLOWLIST: ignore everything, then opt in what we track&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;/*&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# repo files&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;!/.gitignore&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;!/README.md&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;!/REVIEW.md&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;!/CLAUDE.md&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;!/.github/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# top-level config and scripts&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;!/*.yaml&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;!/*.py&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# folders&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;!/packages/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;!/blueprints/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;!/themes/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;!/python_scripts/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;!/scripts/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;!/custom_sentences/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# www: ignore its contents, allow only code&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;!/www/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;/www/*&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;!/www/dashboard/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;!/www/intercom-card.js&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;!/www/icons/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# RE-EXCLUDE anything sensitive that matches the allows above.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# These must stay below the allows.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;/secrets.yaml&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;**/secrets.yaml&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;/known_devices.yaml&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;/ip_bans.yaml&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;*.backup*&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;*.bak&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;*.db&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;*.db-*&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;*.log*&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;.env&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;*.pem&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;*.key&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;id_rsa*&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A few things worth pointing out:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;/*&lt;/code&gt; comes first.&lt;/strong&gt; Every file and folder at the top level is ignored until a &lt;code&gt;!&lt;/code&gt; line lets it back in.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;www/&lt;/code&gt; gets the same treatment one level down.&lt;/strong&gt; That folder is where Home Assistant serves files from, so it collects camera snapshots and downloaded images. Only my dashboard code and a couple of icons and cards are tracked.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The re-excludes come last.&lt;/strong&gt; &lt;code&gt;!/*.yaml&lt;/code&gt; would happily let &lt;code&gt;secrets.yaml&lt;/code&gt; in, so it&#39;s ignored again &lt;em&gt;below&lt;/em&gt; the allow. Order matters in a &lt;code&gt;.gitignore&lt;/code&gt;: the last matching line wins.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;.storage/&lt;/code&gt;, the database and my ESPHome folder are never mentioned at all&lt;/strong&gt;, so they&#39;re never tracked.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;There&#39;s a &lt;code&gt;secrets.example.yaml&lt;/code&gt;&lt;/strong&gt; with every key my config expects and fake values. It&#39;s what lets Claude load my config without the real secrets (more on that below).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That way, if some integration drops a new file full of credentials in there next year, Git ignores it by default.&lt;/p&gt;
&lt;p&gt;The private repo lives on GitHub, which is also where Claude works from. Claude Code has a &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://claude.ai/code&quot;&gt;cloud version&lt;/a&gt; that clones a repo into a sandbox, works on its own branch, and pushes there. That turned out to be the key to this whole project.&lt;/p&gt;
&lt;h2 id=&quot;how-changes-got-to-the-house&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#how-changes-got-to-the-house&quot; aria-label=&quot;Anchor link for: how-changes-got-to-the-house&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
How Changes Got to the House&lt;/h2&gt;
&lt;p&gt;I didn&#39;t want an AI anywhere near my live Home Assistant, and it never was. Claude worked on a copy of the config in the cloud. It could install the exact same Home Assistant version I run, load my YAML into a throwaway instance with fake secrets, and test things against that. It never had a token for my house.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/2026/10/ha-workflow.png&quot; alt=&quot;The workflow: a Claude Code session in the cloud edits, validates and simulates, then pushes to a feature branch on GitHub. On the server, I pull, check the config, restart, run the plan as a dry run, apply it, and push back to master.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;The loop for every change. The only step that touches the house is the one I paste.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Every round ended with a block of commands for me to paste on the server, something like this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-11 z-i&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ~/docker/homeassistant/data&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; pull origin claude/some-branch&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;docker&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; exec homeassistant python3 -m homeassistant --script check_config -c /config&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;docker&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; restart homeassistant&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;docker&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; exec homeassistant python3 /config/scripts/ha_admin.py /config/scripts/plans/2026-10-automation-merge-2.json&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;docker&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; exec homeassistant python3 /config/scripts/ha_admin.py /config/scripts/plans/2026-10-automation-merge-2.json --apply&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; push origin master&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Pull the branch, let Home Assistant check its own config, restart, apply the &quot;plan&quot; (more on that in a second), and push the result back to &lt;code&gt;master&lt;/code&gt; so GitHub always matches what&#39;s actually running.&lt;/p&gt;
&lt;h3 id=&quot;things-that-aren-t-in-yaml&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#things-that-aren-t-in-yaml&quot; aria-label=&quot;Anchor link for: things-that-aren-t-in-yaml&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Things That Aren&#39;t in YAML&lt;/h3&gt;
&lt;p&gt;Not everything lives in YAML files. Entity names, areas, helpers, automation categories, which entities are exposed to voice: all of that is stored in Home Assistant&#39;s &lt;code&gt;.storage&lt;/code&gt; folder, which I&#39;m &lt;em&gt;not&lt;/em&gt; putting in Git.&lt;/p&gt;
&lt;p&gt;Normally that means clicking around the UI. With 180 automations getting deleted or merged, that&#39;s a lot of clicking, and a lot of chances to click the wrong thing. So Claude wrote a small script, &lt;code&gt;ha_admin.py&lt;/code&gt;, that runs inside the Home Assistant container and applies a &quot;plan&quot;: a JSON list of changes made through Home Assistant&#39;s own websocket API. Here&#39;s part of one:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;steps&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;&amp;quot;: [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;    {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;op&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;&amp;quot;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;registry_remove_orphans&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;note&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;&amp;quot;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;per-room motion light automations now merged into one per room&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;entity_ids&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;&amp;quot;: [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        &amp;quot;automation.laundry_room_lights_on_with_motion&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        &amp;quot;automation.laundry_room_lights_off_when_motion_stops&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      ]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;    },&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;    {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;op&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;&amp;quot;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;automation_categories&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;categories&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;&amp;quot;: [{ &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;&amp;quot;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Lighting – Indoor&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;, &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;icon&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;&amp;quot;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;mdi:lightbulb&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; }],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;assign&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;&amp;quot;: { &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;motion_lights_laundry&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;&amp;quot;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Lighting – Indoor&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;    }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  ]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;By default it&#39;s a &lt;strong&gt;dry run&lt;/strong&gt;. It prints exactly what it would change and changes nothing. Only &lt;code&gt;--apply&lt;/code&gt; actually does it. Plans are also safe to run twice, so if something failed halfway, I just ran it again.&lt;/p&gt;
&lt;h2 id=&quot;letting-claude-see-the-running-house&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#letting-claude-see-the-running-house&quot; aria-label=&quot;Anchor link for: letting-claude-see-the-running-house&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Letting Claude See the Running House&lt;/h2&gt;
&lt;p&gt;The YAML in Git is only half the picture. It says what an automation &lt;em&gt;should&lt;/em&gt; do, but not what&#39;s actually out there: which entities exist, which are unavailable, which automations I&#39;d disabled in the UI years ago, which helpers a dashboard still uses, what&#39;s in the error log. Claude had no way into my house, so it needed me to bring the house to it.&lt;/p&gt;
&lt;p&gt;That&#39;s what a handful of small, &lt;strong&gt;read-only&lt;/strong&gt; Python scripts are for. They all run on the server, inside the Home Assistant container, and none of them changes anything.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;export_for_review.py&lt;/code&gt;&lt;/strong&gt; is the big one. It takes a snapshot of the running system and writes it to one compressed file:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the live state of every entity, through Home Assistant&#39;s own API&lt;/li&gt;
&lt;li&gt;the entity, device, area and category registries&lt;/li&gt;
&lt;li&gt;every integration, helper, person, zone and voice pipeline&lt;/li&gt;
&lt;li&gt;every dashboard&#39;s full configuration&lt;/li&gt;
&lt;li&gt;which custom components are installed&lt;/li&gt;
&lt;li&gt;a summary of the error log: each distinct error or warning, with how often it happened&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The important part is what it &lt;em&gt;leaves out&lt;/em&gt;. It only reads an allowlist of &lt;code&gt;.storage&lt;/code&gt; files, and only an allowlist of fields from each one. Then it redacts anything that looks like a password, token, email address, MAC address, public IP or GPS coordinate. As a final safety net, it goes through &lt;code&gt;secrets.yaml&lt;/code&gt; line by line and removes every one of those values from the output, then tells me how many it found. Here&#39;s what it printed the last time I ran it:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;wrote review-export.json.gz (14775 KiB uncompressed)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;states: 2214 from core.restore_state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;entities: 7812  devices: 793  integrations: 256  dashboards: 35&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;secrets.yaml values found and removed from output: 0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That last zero is the one I like to see: the earlier redaction steps had already caught everything, so the safety net had nothing left to remove.&lt;/p&gt;
&lt;p&gt;I run it, hand Claude the file, and Claude can answer questions like &quot;is anything still using &lt;code&gt;input_boolean.jon_iphone&lt;/code&gt;?&quot; without ever seeing a password. A lot of the cleanup came straight out of these exports: disabled integrations nobody remembered, an old phone that was still reporting 85 entities, helpers that nothing had read in ages, dashboards with buttons that called scripts that didn&#39;t exist.&lt;/p&gt;
&lt;p&gt;Three smaller scripts filled in the gaps:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;ha_check.py&lt;/code&gt;&lt;/strong&gt; prints the current state of whatever entities I give it, plus every open repair issue. It has a few extras: &lt;code&gt;--homekit&lt;/code&gt; lists what each of my HomeKit bridges exposes (so nothing CarPlay or the Home app uses gets deleted), &lt;code&gt;--z2m&lt;/code&gt; lists every Zigbee device, and &lt;code&gt;--changes=&amp;lt;entity&amp;gt;&lt;/code&gt; shows how often something changed in the last 24 hours. This was the &quot;did it work?&quot; check after every deploy.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;export_history.py&lt;/code&gt;&lt;/strong&gt; exports the recorded history of a few entities, up to the 10 days my database keeps. This is how my master bath shower fan got tuned: Claude replayed 16 real showers from my humidity sensors against different rules and showed me the numbers before building anything.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;recorder_noise.py&lt;/code&gt;&lt;/strong&gt; reads the database and lists which entities write the most rows. More on what that found below.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;first-a-review&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#first-a-review&quot; aria-label=&quot;Anchor link for: first-a-review&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
First, a Review&lt;/h2&gt;
&lt;p&gt;Before changing anything, Claude read the whole thing and wrote a review: a 500-line &lt;code&gt;REVIEW.md&lt;/code&gt; sorted by how much each problem mattered. Honestly, this alone was worth it. Some highlights from the first read:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Someone else&#39;s presence sensor was counting &lt;em&gt;my&lt;/em&gt; phone.&lt;/strong&gt; A copy-paste from years ago. If I was at a certain place, the house thought Mom was there too.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A safety check that could never work.&lt;/strong&gt; Seven &quot;sync&quot; automations were supposed to skip when a light was unavailable. They compared a whole state &lt;em&gt;object&lt;/em&gt; to the string &lt;code&gt;&#39;Unavailable&#39;&lt;/code&gt; (with a capital U, which Home Assistant never uses), so the check never did anything.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A voice command that called a script that didn&#39;t exist.&lt;/strong&gt; &quot;Call the master bedroom&quot; would say &quot;Calling…&quot; and then quietly do nothing.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Five passwords and tokens sitting in plain text&lt;/strong&gt; in &lt;code&gt;configuration.yaml&lt;/code&gt;. They&#39;re in &lt;code&gt;secrets.yaml&lt;/code&gt; now.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Security went first. One of my automations would unlock a door if someone arrived home and then &lt;em&gt;anything&lt;/em&gt; moved near a door in the next ten minutes, including a cat or a delivery driver. It&#39;s been replaced with a proper &quot;arrival window&quot; that only unlocks the door the person is actually at, closes after the first unlock, and sends me a notification every time it does. The voice PIN unlock now only accepts the PIN from the speaker that asked for it, and locks itself out after three wrong tries.&lt;/p&gt;
&lt;h2 id=&quot;the-rules&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#the-rules&quot; aria-label=&quot;Anchor link for: the-rules&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
The Rules&lt;/h2&gt;
&lt;p&gt;The most useful thing I did in this whole project was write down some rules before any of the big changes. They live in a &lt;code&gt;CLAUDE.md&lt;/code&gt; file in the repo, so every new Claude session reads them first. The most important one:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Family first.&lt;/strong&gt; Automations should feel helpful, never commanding or overbearing, especially for the kids. Every way a family member already interacts with the house must keep working: wall switches, Hue app, buttons, voice phrases, dashboards. Changes may only &lt;em&gt;add&lt;/em&gt; things to learn, never take any away. If a change would alter something a person would notice, &lt;strong&gt;ask first&lt;/strong&gt; and explain it in family terms.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;And the second most important one: refactors have to be &lt;strong&gt;proven&lt;/strong&gt; to behave exactly like the original, and real bug fixes are done separately and called out one by one. That one changed how the rest of the project went.&lt;/p&gt;
&lt;h2 id=&quot;merging-automations-with-proof&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#merging-automations-with-proof&quot; aria-label=&quot;Anchor link for: merging-automations-with-proof&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Merging Automations, With Proof&lt;/h2&gt;
&lt;p&gt;A lot of my automations came in pairs. &quot;Laundry room lights on with motion&quot; and &quot;Laundry room lights off when motion stops.&quot; Kitchen, hallway, attic, master bath: same thing, two automations per room.&lt;/p&gt;
&lt;p&gt;Home Assistant can do both in one automation using trigger IDs and a &lt;code&gt;choose&lt;/code&gt;. Each original automation becomes one branch, with its triggers, conditions and actions copied over exactly.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/2026/10/ha-merge.png&quot; alt=&quot;22 per-room motion automations became 11, one per room. Each has two triggers with IDs, and a choose with one branch per original automation, running in parallel mode.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Same logic, half the automations, and each room&#39;s motion lights are in one place&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Here&#39;s the trick that made me trust it: for every merge, Claude spun up a test instance of Home Assistant with the &lt;em&gt;old&lt;/em&gt; automations and another with the &lt;em&gt;new&lt;/em&gt; one, with every service call stubbed out so nothing real happened. Then it fed both the same random sequence of motion and light changes (with the 10-minute delays sped up to 1 second) and compared every single service call. They had to match exactly.&lt;/p&gt;
&lt;p&gt;The door auto-locks got the most thorough version of this. Nine automations ran the front and back door countdowns (start when the door closes, cancel when it opens, lock when the timer ends, restart at 10 minutes on arrival), and they became one per door. To check it, Claude modeled the old nine and the new two, and ran both through &lt;strong&gt;40,000 random sequences&lt;/strong&gt; of doors opening, locks changing, people arriving, Home Assistant restarting and time passing. They locked at exactly the same moments every time.&lt;/p&gt;
&lt;p&gt;I&#39;ll admit that when I saw &quot;40,000 simulations&quot; go by for my back door, I laughed out loud. Is that overkill for a door lock? Absolutely. It&#39;s also the automation I least want to be wrong about, and it cost me nothing but a few minutes of waiting.&lt;/p&gt;
&lt;p&gt;It also knew when &lt;em&gt;not&lt;/em&gt; to merge. One of my kids&#39; bedroom lights and the half bath both end with a long &lt;code&gt;delay&lt;/code&gt; used as a &quot;hold.&quot; Merged into one automation, that hold would have blocked the other branch from running, so they stayed separate. Same for a couple of automations that read their own &lt;code&gt;last_triggered&lt;/code&gt; time.&lt;/p&gt;
&lt;p&gt;The merges, all told:&lt;/p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Before&lt;/th&gt;&lt;th&gt;After&lt;/th&gt;&lt;th&gt;How it was checked&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;9 &quot;light switch control&quot; automations, one per room&lt;/td&gt;&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt; &quot;Light switch buttons&quot;&lt;/td&gt;&lt;td&gt;every switch × every button press, identical light calls&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;9 front and back door auto-lock automations&lt;/td&gt;&lt;td&gt;&lt;strong&gt;2&lt;/strong&gt;, one per door&lt;/td&gt;&lt;td&gt;40,000 random event sequences, identical lock decisions&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;22 motion-light automations&lt;/td&gt;&lt;td&gt;&lt;strong&gt;11&lt;/strong&gt;, one per room&lt;/td&gt;&lt;td&gt;random motion and light sequences in every room&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;9 circadian and hallway-dimming automations&lt;/td&gt;&lt;td&gt;&lt;strong&gt;3&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;old vs new, identical calls&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;14 fan and speaker-volume automations&lt;/td&gt;&lt;td&gt;&lt;strong&gt;3&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;old vs new, identical calls&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;10 kids&#39; automations (a Mira copy and a Simon copy of each)&lt;/td&gt;&lt;td&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;old vs new, identical calls&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;8 outdoor light automations&lt;/td&gt;&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt; schedule&lt;/td&gt;&lt;td&gt;each decision tested step by step&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;7 attic AC automations and 5 basement heater automations&lt;/td&gt;&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt; each&lt;/td&gt;&lt;td&gt;occupancy, manual changes, a late power reading, a missed IR signal&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;3 TV auto-off automations and 2 TV power watchdogs&lt;/td&gt;&lt;td&gt;merged into the new TV setup&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;3 voice weather automations, 2 &quot;where is Mom/Dad&quot; copies&lt;/td&gt;&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt; each&lt;/td&gt;&lt;td&gt;identical spoken replies to 18 weather questions and 9 &quot;where is&quot; situations&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;A few of these deserve a closer look.&lt;/p&gt;
&lt;h3 id=&quot;the-light-switches&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#the-light-switches&quot; aria-label=&quot;Anchor link for: the-light-switches&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
The light switches&lt;/h3&gt;
&lt;p&gt;I have ESPHome wall dimmers in most rooms. Each room had its own &quot;light switch control&quot; automation for what the up and down buttons do, and a separate &quot;sync&quot; automation per switch that checked every 5 seconds whether the switch and the bulbs agreed. That&#39;s well over a dozen automations, all doing roughly the same thing with slightly different copy-paste.&lt;/p&gt;
&lt;p&gt;Now there&#39;s one &quot;Light switch buttons&quot; automation. Each switch&#39;s button events are a trigger with an ID, and a small table says which lights that switch controls. The syncing moved into the switches themselves (more on that below). Claude simulated all 9 switches with all 4 button commands, old and new, and the light calls matched exactly. That one merge removed about 660 lines.&lt;/p&gt;
&lt;h3 id=&quot;the-attic-ac&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#the-attic-ac&quot; aria-label=&quot;Anchor link for: the-attic-ac&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
The attic AC&lt;/h3&gt;
&lt;p&gt;This one wasn&#39;t a merge so much as a rewrite, because the old automations disagreed with each other. My attic office has a window AC that only understands an IR &quot;power toggle,&quot; which I can&#39;t tell is on or off except by looking at its smart plug&#39;s power draw. Seven automations all poked at it: some changed the thermostat&#39;s target on every presence blip, some switched the AC directly behind the thermostat&#39;s back. With a button that only toggles, anything that acts without checking can just as easily turn the AC off as on.&lt;/p&gt;
&lt;p&gt;Now one automation, &quot;Attic climate,&quot; is the only thing that sets the attic&#39;s target temperature: 72 when someone&#39;s up there, 80 when it&#39;s empty. It only acts when that changes, so if I set it to 70 by hand, it stays at 70 until I leave. The actual on/off goes through one script that only sends the IR toggle if the plug says the AC is in the wrong state, waits up to a minute to see it worked, and tries once more if not. The basement heater got the same treatment: five automations became one.&lt;/p&gt;
&lt;h3 id=&quot;voice-media-controls&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#voice-media-controls&quot; aria-label=&quot;Anchor link for: voice-media-controls&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Voice: Media Controls&lt;/h3&gt;
&lt;p&gt;The biggest automation I have left is &quot;Voice: Media Controls&quot; at about 1,200 lines and 44 sentence triggers. It handles &quot;pause,&quot; &quot;skip,&quot; &quot;volume up,&quot; &quot;stop the music in the kitchen&quot; and so on, figures out which room you meant, and asks an LLM &quot;did you mean…?&quot; when it can&#39;t tell. When we started, there were two copies of it running at once (v7 and v8), plus a separate &quot;Stop All Media&quot; automation that also fired on &quot;stop.&quot; It&#39;s one automation now. It&#39;s big, but it&#39;s &lt;em&gt;one&lt;/em&gt; big thing in one place, instead of three things quietly fighting.&lt;/p&gt;
&lt;h2 id=&quot;stop-polling-everything&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#stop-polling-everything&quot; aria-label=&quot;Anchor link for: stop-polling-everything&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Stop Polling Everything&lt;/h2&gt;
&lt;p&gt;This was the big one for me. A lot of my automations had a &lt;code&gt;time_pattern&lt;/code&gt; trigger: &quot;every 5 seconds, check if the light switch and the bulbs agree, and fix it if they don&#39;t.&quot; Twenty of them were running every few seconds. One ran &lt;strong&gt;every second&lt;/strong&gt;, all day, forever.&lt;/p&gt;
&lt;p&gt;Added up, my Home Assistant was running about &lt;strong&gt;270 scheduled automations per minute&lt;/strong&gt;, roughly 389,000 a day, mostly to check things that hadn&#39;t changed.&lt;/p&gt;
&lt;p&gt;The fix was to react to things changing instead of constantly asking if they changed. For my ESPHome light switches, the &quot;sync&quot; moved into the switch firmware itself: the dimmer just follows its room&#39;s light. For the rest, a template trigger fires only when the two sides actually disagree for a few seconds. A template trigger only fires when its result changes, so there&#39;s nothing left to poll.&lt;/p&gt;
&lt;p&gt;Now it&#39;s about 4 runs a minute, and those few are deliberate 1–5 minute safety nets. That&#39;s about &lt;strong&gt;66 times fewer&lt;/strong&gt; scheduled runs.&lt;/p&gt;
&lt;h2 id=&quot;faster-too&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#faster-too&quot; aria-label=&quot;Anchor link for: faster-too&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Faster, Too&lt;/h2&gt;
&lt;p&gt;Cleaner code is nice, but what I actually notice day to day is that the house is quicker and less busy. A few of the speed-ups:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;The light switches react on their own.&lt;/strong&gt; The &quot;sync&quot; between a wall switch and its room&#39;s lights used to be a round trip through Home Assistant, backed up by a 5-second poll. Now each ESPHome dimmer follows its room&#39;s light in its own firmware (&lt;code&gt;follow_entity&lt;/code&gt;). Home Assistant doesn&#39;t have to do anything at all for the switch to catch up.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Kodi&#39;s Back and Home buttons lost a 2-second lag.&lt;/strong&gt; The remote waited for Kodi to report which screen it was on before doing anything. It turns out Kodi answers &lt;em&gt;during&lt;/em&gt; the request, so the wait never saw the answer and every press sat out its full 2-second timeout. In the simulation, a press went from &lt;strong&gt;2.05 seconds to 0.15&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The database writes about 40% less.&lt;/strong&gt; &lt;code&gt;recorder_noise.py&lt;/code&gt; showed my database was writing about &lt;strong&gt;1.9 million rows a day&lt;/strong&gt;. About 420,000 of them were CPU and memory readings for every Docker container, which nothing used. Another 212,000 were my mmWave sensors reporting exactly where in the room each person was standing, constantly. Then camera snapshots, signal-strength readings, and calculated humidity averages. None of it changed what&#39;s on a dashboard or what an automation does; Home Assistant just stopped saving history nobody looked at, which means less work for the database on every single change.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The shower fan catches the shower in about a minute.&lt;/strong&gt; Using 10 days of humidity history, the new rule caught all 16 recorded showers about a minute in. The old rule had missed one entirely and caught another 7 minutes late.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;No more restart storms.&lt;/strong&gt; Between the backed-off watchdogs below and nothing being restarted unconditionally at startup, a reboot of Home Assistant no longer kicks off a wave of service restarts.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;watchdogs-that-back-off&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#watchdogs-that-back-off&quot; aria-label=&quot;Anchor link for: watchdogs-that-back-off&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Watchdogs That Back Off&lt;/h2&gt;
&lt;p&gt;I have a bunch of automations that restart things when they go down: the UPS monitor, the Ring bridge, my fridge&#39;s integration, cameras. They all worked the same way: if it&#39;s down, restart it. Five minutes later, if it&#39;s still down, restart it again. And again. Forever.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/2026/10/ha-backoff.png&quot; alt=&quot;Before: a restart every 5 minutes, forever, 288 a day. After: retries at 0, 5, 15, 35 and 75 minutes and then every 2 hours, with one notification after the third failed try and one when it recovers.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;If something isn&#39;t coming back, hammering it every five minutes doesn&#39;t help&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Now there&#39;s one shared script, &lt;code&gt;script.watchdog_backoff&lt;/code&gt;. It restarts the thing, waits, and doubles the wait each time up to two hours. After three failed attempts it sends me &lt;strong&gt;one&lt;/strong&gt; notification, and one more when it recovers. Each watchdog just hands it the details:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; action&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.watchdog_backoff&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Family room UPS (NUT)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    entities&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; sensor.cyberpower1_status&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    down_states&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; unavailable&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    restart_action&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.restart_nut&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    first_wait_minutes&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 5&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;While we were in there, it turned out one automation restarted a couple of services and rebooted my Frigate container &lt;em&gt;every time Home Assistant started&lt;/em&gt;, whether they needed it or not. That&#39;s gone too.&lt;/p&gt;
&lt;h2 id=&quot;bugs-hiding-in-plain-sight&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#bugs-hiding-in-plain-sight&quot; aria-label=&quot;Anchor link for: bugs-hiding-in-plain-sight&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Bugs Hiding in Plain Sight&lt;/h2&gt;
&lt;p&gt;Since everything was being compared and simulated anyway, a lot of old bugs fell out. Here are some favorites.&lt;/p&gt;
&lt;h3 id=&quot;the-weather-check-that-only-knew-one-kind-of-weather&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#the-weather-check-that-only-knew-one-kind-of-weather&quot; aria-label=&quot;Anchor link for: the-weather-check-that-only-knew-one-kind-of-weather&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
The weather check that only knew one kind of weather&lt;/h3&gt;
&lt;p&gt;My porch lights are supposed to turn on during the day when it&#39;s gloomy. The old check looked like this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ states(&amp;#39;weather.home&amp;#39;) == (&amp;#39;partlycloudy&amp;#39; or &amp;#39;sunny&amp;#39; or &amp;#39;windy&amp;#39;) }}&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That reads fine in English. But &lt;code&gt;(&#39;partlycloudy&#39; or &#39;sunny&#39; or &#39;windy&#39;)&lt;/code&gt; isn&#39;t a list: &lt;code&gt;or&lt;/code&gt; just returns the first thing that isn&#39;t empty, which is &lt;code&gt;&#39;partlycloudy&#39;&lt;/code&gt;. So this only ever matched &quot;partly cloudy.&quot; On a sunny morning, the porch lights decided it was gloomy and stayed on. For years. The new version has an actual list of bright conditions, and anything else (except unknown) counts as gloomy.&lt;/p&gt;
&lt;h3 id=&quot;nest-never-knew-we-left&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#nest-never-knew-we-left&quot; aria-label=&quot;Anchor link for: nest-never-knew-we-left&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Nest never knew we left&lt;/h3&gt;
&lt;p&gt;When we both left the house, Home Assistant was supposed to set the Nest thermostat to &quot;away.&quot; But the trigger fired when the &lt;em&gt;first&lt;/em&gt; person left. Another automation, which puts Nest back to &quot;home&quot; when anyone is home, immediately undid it. Then when the second person left, nothing fired at all. So Nest never found out the house was empty. It now waits until nobody is home, and since the kids can be home without us, &quot;nobody&quot; also means the downstairs cameras haven&#39;t seen a person for 30 minutes.&lt;/p&gt;
&lt;h3 id=&quot;the-printer-protection-that-couldn-t-happen&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#the-printer-protection-that-couldn-t-happen&quot; aria-label=&quot;Anchor link for: the-printer-protection-that-couldn-t-happen&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
The printer protection that couldn&#39;t happen&lt;/h3&gt;
&lt;p&gt;The window AC in my attic office shares a circuit with my laser printer, so the AC is supposed to pause while the printer heats up, or the two of them trip the breaker. The old automation only paused the AC if the AC was drawing more than 600 W. Its compressor draws 400 to 500. So it never paused anything.&lt;/p&gt;
&lt;h3 id=&quot;one-space-one-silently-dead-automation&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#one-space-one-silently-dead-automation&quot; aria-label=&quot;Anchor link for: one-space-one-silently-dead-automation&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
One space, one silently dead automation&lt;/h3&gt;
&lt;p&gt;This one was Claude&#39;s mistake, and it&#39;s my favorite lesson from the whole project. During one of the merges, a single trigger ID got indented one level too far. That turned it into a condition instead of part of the trigger. Home Assistant&#39;s &lt;code&gt;check_config&lt;/code&gt; passed, the restart worked fine... and Home Assistant quietly &lt;strong&gt;disabled&lt;/strong&gt; the whole automation with an error in the log.&lt;/p&gt;
&lt;p&gt;It turns out &lt;code&gt;check_config&lt;/code&gt; doesn&#39;t fail on an invalid automation. It just logs it. So now there&#39;s a &lt;code&gt;validate_automations.py&lt;/code&gt; that loads every automation and script through Home Assistant&#39;s own validator, and nothing gets pushed until that passes. Every automation and script passes it today.&lt;/p&gt;
&lt;h2 id=&quot;voice-got-a-lot-smarter&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#voice-got-a-lot-smarter&quot; aria-label=&quot;Anchor link for: voice-got-a-lot-smarter&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Voice Got a Lot Smarter&lt;/h2&gt;
&lt;p&gt;I have voice satellites in most rooms: Home Assistant Voice PE units and a couple of Linux boxes. Voice had the messiest problems of all, because of one thing I didn&#39;t know:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;When you say something, every automation with a matching sentence fires.&lt;/strong&gt; And they all run &lt;em&gt;before&lt;/em&gt; Home Assistant&#39;s built-in commands, so they block those too.&lt;/p&gt;
&lt;p&gt;My media controls automation had sentences like &lt;code&gt;stop [in] [the] {area}&lt;/code&gt;. In a sentence trigger, &lt;code&gt;{area}&lt;/code&gt; is a wildcard that matches &lt;em&gt;any words&lt;/em&gt;. And since everything in brackets is optional, &quot;stop the timer&quot; matched it, with &quot;timer&quot; as the room. So did &quot;stop the fan.&quot; &quot;Volume up&quot; also matched &quot;volume {level}&quot; and set the volume to 50%.&lt;/p&gt;
&lt;p&gt;To find all of these, Claude took every sample sentence from every voice trigger in my config (&lt;strong&gt;2,823&lt;/strong&gt; of them) and ran each one through Home Assistant&#39;s own conversation agent to see which automations it actually reached. Then fixed them until every sentence only went where it was supposed to. Room names now have to come after a fixed word like &quot;in,&quot; so the wildcard can&#39;t swallow the rest of the sentence.&lt;/p&gt;
&lt;h3 id=&quot;goodbye-1-082-lines-of-custom-timers&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#goodbye-1-082-lines-of-custom-timers&quot; aria-label=&quot;Anchor link for: goodbye-1-082-lines-of-custom-timers&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Goodbye, 1,082 lines of custom timers&lt;/h3&gt;
&lt;p&gt;Years ago, before Home Assistant had built-in voice timers, I built my own: 9 automations, 2 scripts, 16 timers, and 32 helpers. Today every one of my satellites supports Home Assistant&#39;s built-in timers, which do everything mine did and more.&lt;/p&gt;
&lt;p&gt;The catch was the family. Everyone was used to saying things &lt;em&gt;their&lt;/em&gt; way, like &quot;set a pasta timer for 5 minutes&quot; or &quot;how many timers do I have.&quot; Following rule #1, none of those could stop working. So the old system was replaced with a small file of extra phrasings for the built-in timers:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;language&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; en&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;intents&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  HassStartTimer&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; sentences&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;set [a|the] {timer_name:name} timer for &amp;lt;timer_duration&amp;gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;(set|start) [a] &amp;lt;timer_duration&amp;gt; {timer_name:name} timer&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  HassUnpauseTimer&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; sentences&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;(resume|unpause|continue) [the|my] timer&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Out of the 312 phrasings the old system understood, 310 still work. The two that don&#39;t collided with &quot;remove 5 minutes from the timer,&quot; which seemed like a fair trade.&lt;/p&gt;
&lt;h2 id=&quot;a-detour-packages-vs-the-ui&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#a-detour-packages-vs-the-ui&quot; aria-label=&quot;Anchor link for: a-detour-packages-vs-the-ui&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
A Detour: Packages vs. the UI&lt;/h2&gt;
&lt;p&gt;Not everything went in a straight line. Early on, Claude moved most of my automations out of &lt;code&gt;automations.yaml&lt;/code&gt; and into feature &quot;packages&quot; (one YAML file for lighting, one for media, and so on). Very tidy. But automations in packages can&#39;t be edited in Home Assistant&#39;s UI, and I still like making quick tweaks from my phone.&lt;/p&gt;
&lt;p&gt;So they went back. Now &lt;code&gt;automations.yaml&lt;/code&gt; and &lt;code&gt;scripts.yaml&lt;/code&gt; stay UI-editable, organized into &lt;strong&gt;19 categories&lt;/strong&gt; in the UI (Lighting, Climate &amp;amp; Fans, Kids&#39; Bedtime, Voice, and so on). Only the settled, rarely-touched stuff like locks, presence, and the voice PIN lives in packages.&lt;/p&gt;
&lt;p&gt;Claude also rewrote both files using &lt;strong&gt;Home Assistant&#39;s own YAML writer&lt;/strong&gt;, converted to the current syntax (&lt;code&gt;triggers:&lt;/code&gt;, &lt;code&gt;actions:&lt;/code&gt;), and checked that every automation came out identical. That sounds boring, but it matters: when I save an automation in the UI now, Git shows only the lines I actually changed, instead of Home Assistant reformatting the entire file.&lt;/p&gt;
&lt;h2 id=&quot;by-the-numbers&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#by-the-numbers&quot; aria-label=&quot;Anchor link for: by-the-numbers&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
By the Numbers&lt;/h2&gt;
&lt;p&gt;Since every change is a commit, Git keeps score. The first commit, my config exactly as it was, went in on a Saturday at 2 pm. The last one in this round landed Monday at 4 pm. In between: &lt;strong&gt;103 commits in about 50 hours&lt;/strong&gt; (13 on Saturday, 36 on Sunday, 54 on Monday).&lt;/p&gt;
&lt;p&gt;Across those commits, about &lt;strong&gt;46,400 lines were added and 54,000 removed&lt;/strong&gt;. That overstates it a little, because one commit rewrote both &lt;code&gt;automations.yaml&lt;/code&gt; and &lt;code&gt;scripts.yaml&lt;/code&gt; in the current syntax, which touches nearly every line. Comparing just the first and last versions, 96 files changed: &lt;strong&gt;22,111 lines in, 29,707 lines out&lt;/strong&gt;. (That doesn&#39;t count the wall-tablet dashboards, which have &lt;a href=&quot;/rewriting-my-home-assistant-dashboards-in-plain-html&quot;&gt;their own post&lt;/a&gt;.)&lt;/p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;/th&gt;&lt;th&gt;Start&lt;/th&gt;&lt;th&gt;Now&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Automations&lt;/td&gt;&lt;td&gt;421&lt;/td&gt;&lt;td&gt;&lt;strong&gt;237&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Scripts&lt;/td&gt;&lt;td&gt;206&lt;/td&gt;&lt;td&gt;&lt;strong&gt;98&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Lines of YAML (config and packages)&lt;/td&gt;&lt;td&gt;~32,150&lt;/td&gt;&lt;td&gt;&lt;strong&gt;~21,000&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;automations.yaml&lt;/code&gt;&lt;/td&gt;&lt;td&gt;19,197 lines&lt;/td&gt;&lt;td&gt;&lt;strong&gt;12,165&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;scripts.yaml&lt;/code&gt;&lt;/td&gt;&lt;td&gt;4,892 lines&lt;/td&gt;&lt;td&gt;&lt;strong&gt;2,507&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Feature packages&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;&lt;strong&gt;18&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Scheduled automation runs&lt;/td&gt;&lt;td&gt;~389,000 a day&lt;/td&gt;&lt;td&gt;&lt;strong&gt;~5,900&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Automations polling every few seconds&lt;/td&gt;&lt;td&gt;20 (one every second)&lt;/td&gt;&lt;td&gt;&lt;strong&gt;0&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;History rows written&lt;/td&gt;&lt;td&gt;~1.9 million a day&lt;/td&gt;&lt;td&gt;&lt;strong&gt;~1.1 million&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;Even after all of this, the house is big: today Home Assistant knows about &lt;strong&gt;7,812 entities on 793 devices&lt;/strong&gt;, across &lt;strong&gt;256 integrations and helpers&lt;/strong&gt;. Here&#39;s what went away along the way:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;28 integrations and config entries&lt;/strong&gt;: disabled leftovers (MyQ, VeSync, AdGuard, Glances, three remote Home Assistant links), two Samsung TV integrations, Waze (it had stopped working; travel times now come from my own routing server), Node-RED, an extra ChatGPT conversation agent, two old phones, and a HomeKit bridge with nothing left in it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;More than 600 orphaned entity registry entries&lt;/strong&gt;, the ghosts automations and integrations leave behind when they&#39;re deleted. The old Pixel alone had 85.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;About 100 helpers and timers&lt;/strong&gt; that nothing read anymore, including the 48 from my old homemade timer system.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;5 dashboards&lt;/strong&gt; nobody used, including a &quot;Test ground&quot; whose buttons called a script that never existed.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;What got &lt;em&gt;added&lt;/em&gt; is mostly tooling: 38 plans, a validator, a side-by-side comparison script, the voice routing checker and the read-only export scripts: about 1,800 lines of new Python in all. That&#39;s the part I expect to keep using.&lt;/p&gt;
&lt;h2 id=&quot;so-how-was-working-with-claude&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#so-how-was-working-with-claude&quot; aria-label=&quot;Anchor link for: so-how-was-working-with-claude&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
So, How Was Working With Claude?&lt;/h2&gt;
&lt;p&gt;Honestly? Great, with some caveats.&lt;/p&gt;
&lt;p&gt;What it was good at:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Reading everything.&lt;/strong&gt; I have never read all 32,000 lines of my own config. It did, more than once, and found things I&#39;d forgotten I&#39;d built.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Proving things.&lt;/strong&gt; Every merge came with a simulation, every syntax conversion with a before/after comparison. That&#39;s the part I would have skipped if I were doing this alone, and it&#39;s the part that let me merge 180 automations&#39; worth of changes without my family noticing.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Explaining.&lt;/strong&gt; Every commit message says what changed, why, and how it was tested. Months from now, that&#39;s what I&#39;ll actually read.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;What it needed from me:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Knowing the house.&lt;/strong&gt; Which room the window AC is in, what &quot;the green light&quot; means to my kids, which sensors are flaky, that the basement is still being put back together after a flood. It asked a lot, and when it didn&#39;t, it was usually because the rules file already said.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Decisions.&lt;/strong&gt; &quot;Should the porch light stay on when it&#39;s hot out?&quot; isn&#39;t a code question.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Running things.&lt;/strong&gt; It never touched the live house. Every change went through me pasting a block of commands.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It also made mistakes: the indentation bug above, the packages detour, and one plan run that failed because Home Assistant&#39;s registry was bigger than the websocket library&#39;s 4 MB default message size. None of those made it past the dry run or the validator into something my family noticed, which is the whole point of building it this way.&lt;/p&gt;
&lt;h2 id=&quot;what-s-left&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#what-s-left&quot; aria-label=&quot;Anchor link for: what-s-left&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
What&#39;s Left&lt;/h2&gt;
&lt;p&gt;There&#39;s still a short list in &lt;code&gt;REVIEW.md&lt;/code&gt;: a week of reading the log for warnings, a camera server that keeps dropping its streams, and the basement, which is still being set back up after the flood. (The last once-a-minute checks and the noisy database, which were on this list when I started writing, are done.) But the hard part is done. The config is in Git, every automation passes the validator, and the next time I want to change something, I don&#39;t have to be afraid of it.&lt;/p&gt;
&lt;p&gt;The wall tablets got the same treatment, and I wrote that one up separately: &lt;a href=&quot;/rewriting-my-home-assistant-dashboards-in-plain-html&quot;&gt;Rewriting My Home Assistant Dashboards in Plain HTML&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you&#39;ve got a Home Assistant install that&#39;s been growing for years and you&#39;re scared to touch it, I&#39;d really recommend this approach: get it into Git, write down your rules, and make every change prove itself before it goes anywhere near your house. Let me know in the comments if you have questions.&lt;/p&gt;
&lt;p&gt;Thanks for reading.&lt;/p&gt;
</description>
      </item>
      <item>
          <title>Rewriting My Home Assistant Dashboards in Plain HTML</title>
          <pubDate>Sun, 04 Oct 2026 00:00:00 +0000</pubDate>
          <author>thehelpfulidiot</author>
          <link>https://thehelpfulidiot.com/rewriting-my-home-assistant-dashboards-in-plain-html/</link>
          <guid>https://thehelpfulidiot.com/rewriting-my-home-assistant-dashboards-in-plain-html/</guid>
          <description xml:base="https://thehelpfulidiot.com/rewriting-my-home-assistant-dashboards-in-plain-html/">&lt;p&gt;There are tablets on the walls all over my house. A Fire HD 10 in the family room, another one in the basement, a Lenovo StarView next to the TV that works as a remote, and one in each of the kids&#39; rooms. (I&#39;ve &lt;a href=&quot;/custom-3d-printed-mount-for-fire-tablet-2015&quot;&gt;3D printed mounts for these before&lt;/a&gt;.) They are how most of my family actually uses Home Assistant.&lt;/p&gt;
&lt;p&gt;For years they all ran regular Home Assistant dashboards (Lovelace) in a kiosk browser. And on these tablets, Lovelace was &lt;em&gt;heavy&lt;/em&gt;. Every one of them was loading the entire Home Assistant app just to show a few buttons. Taps would hang for a while before anything happened, and the pages kept reloading on their own, usually right when someone was trying to turn off a light.&lt;/p&gt;
&lt;p&gt;So the dashboards got rewritten as plain HTML and JavaScript. No framework, no build step, no npm. Each tablet loads one small page that talks directly to Home Assistant.&lt;/p&gt;
&lt;p&gt;And in the spirit of this blog&#39;s name, I should be upfront: I didn&#39;t write the code for these dashboards. Claude (the AI from Anthropic) basically wrote all of it. I told it what each tablet needed to do, tried every version on the actual tablets, and reported back what was broken or annoying. Then it fixed it. More on how that went at the end.&lt;/p&gt;
&lt;p&gt;Here&#39;s the main one, in the family room:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/2026/10/dash-family-room.jpg&quot; alt=&quot;The family room dashboard: weather and a five-day forecast, upcoming calendar events, the four door locks, a thermostat dial with room temperatures, the TV remote, a list of floors with how many lights are on, and two kid faces showing sleep status&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;The family room Fire HD 10. All of the data here is fake, from a mock Home Assistant (more on that at the end).&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&quot;what-s-on-the-screen&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#what-s-on-the-screen&quot; aria-label=&quot;Anchor link for: what-s-on-the-screen&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
What&#39;s on the Screen&lt;/h2&gt;
&lt;p&gt;Each box is a &quot;card,&quot; and most of them do a little more than they look like they do:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Weather&lt;/strong&gt; with a five-day forecast, sunrise and sunset.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Calendar&lt;/strong&gt;, which shows everyone&#39;s calendars together. When one of us is away from home, the same spot turns into a &lt;strong&gt;map&lt;/strong&gt; showing where we are, then turns back into the calendar when we&#39;re both home.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Locks.&lt;/strong&gt; Tap one to lock it. Each icon knows if the door is open too, so it won&#39;t try to throw a deadbolt into an open door. If the garage door is open, the whole row turns into a big red &quot;Garage open, tap to close&quot; button.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Thermostat&lt;/strong&gt;, with the room temperatures from around the house underneath.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;TV.&lt;/strong&gt; While the TV is on, it&#39;s a remote with shortcuts for each input. When the TV is off, it turns into a big date and clock.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Light controls&lt;/strong&gt;, one row per floor. More on that one below.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The kids.&lt;/strong&gt; At night, each kid gets a face: red means they&#39;re in bed with their sound machine on, and green means their &quot;OK to wake&quot; light has turned on. Long-press a face to toggle that kid&#39;s sound machine. During the day this spot shows a camera instead.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The light menu counts the lights that are on per floor (2/4 means two of four). Tap the count and that whole floor turns off. Tap the name and you get the lights on that floor:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/2026/10/dash-light-menu.jpg&quot; alt=&quot;The light controls opened to the first floor, with a row for each room&amp;#39;s lights showing its brightness and a slider&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Tapping &quot;First Floor&quot; opens a slider for each room. It goes back to the floor list on its own after two minutes.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Here&#39;s the part I like: those floor counts come from &lt;strong&gt;Home Assistant&#39;s areas&lt;/strong&gt;. I don&#39;t keep a list of lights on the dashboard. If I add a new bulb to the kitchen area in Home Assistant, the first-floor count just includes it. Lights hidden in Home Assistant (like the individual bulbs behind a light group) are left out so they aren&#39;t counted twice.&lt;/p&gt;
&lt;h2 id=&quot;the-other-tablets&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#the-other-tablets&quot; aria-label=&quot;Anchor link for: the-other-tablets&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
The Other Tablets&lt;/h2&gt;
&lt;p&gt;The portrait tablets all share the same building blocks. Here are the kid&#39;s room, the basement, and the family room TV remote:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/2026/10/dash-kid-room.jpg&quot; alt=&quot;A kid&amp;#39;s room dashboard: weather and room temperature at the top, the bedroom light and a color light strip with sliders, a ceiling fan with speed buttons, and All On, All Off and Calls buttons&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;A kid&#39;s room. Big buttons, nothing that can break anything important.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/2026/10/dash-basement.jpg&quot; alt=&quot;The basement dashboard: big bulb icons for the stairs and basement lights with brightness and color temperature sliders, the string lights with a color slider and scene pickers, and TV and game console buttons&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;The basement. Same layout as the old Lovelace version, so nobody had to relearn it.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/2026/10/dash-starview-remote.png&quot; alt=&quot;The StarView TV remote: Kodi, Roku and Apple TV source buttons on top, big volume buttons on the left, a direction pad, and play, stop, all off and intercom buttons at the bottom&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;The StarView next to the TV is just a remote. The active source is highlighted.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;That last one matters. My one hard rule was that nothing my family already knows how to use is allowed to change on them. So each new page started as a copy of the old Lovelace layout, button for button, and only then got cleaned up.&lt;/p&gt;
&lt;h3 id=&quot;a-whole-house-intercom&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#a-whole-house-intercom&quot; aria-label=&quot;Anchor link for: a-whole-house-intercom&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
A Whole-House Intercom&lt;/h3&gt;
&lt;p&gt;Swipe left on any of the portrait tablets (or tap the green Calls button) and you get page two: an &lt;strong&gt;intercom&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/2026/10/dash-intercom.png&quot; alt=&quot;The intercom page listing Dad, Mom, the family room, both kids&amp;#39; bedrooms and the attic, each with a status like Tap to call or Asleep, tap to wake&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Rooms show up on their own. A tablet that&#39;s asleep can be woken up from here.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;It&#39;s a real voice call, right in the browser. Each room&#39;s page signs in to an Asterisk server I run, using &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://sipjs.com/&quot;&gt;SIP.js&lt;/a&gt;. During the day, calls are answered automatically with a beep (it&#39;s an intercom, after all). At night they wait quietly so nobody wakes a sleeping kid. The rooms aren&#39;t a hard-coded list either: a small monitor publishes each room to Home Assistant over MQTT, and the page finds them there.&lt;/p&gt;
&lt;h2 id=&quot;how-it-works&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#how-it-works&quot; aria-label=&quot;Anchor link for: how-it-works&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
How It Works&lt;/h2&gt;
&lt;p&gt;Every page is tiny. Here&#39;s roughly what one looks like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;html&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; rel&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;stylesheet&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; href&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;lib/theme.css?v=20261002-3&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; class&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;dash&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1&quot;&gt;  &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; class&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;card&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;weather&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1&quot;&gt;  &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; class&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;card&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;doors&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; src&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;lib/icons.js?v=20261002-3&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; src&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;lib/core.js?v=20261002-3&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; src&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;lib/cards/weather.js?v=20261002-3&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt; src&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;lib/cards/locks.js?v=20261002-3&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Dash&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;card&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;#39;#weather&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;weather&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;, {&lt;/span&gt;&lt;span&gt; entity&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;weather.home&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; }&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Dash&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;card&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;#39;#doors&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;locks&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;, {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  locks&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span&gt; [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;    {&lt;/span&gt;&lt;span&gt; name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;Front Door&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;span&gt; lock&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;lock.front_door&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; },&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;    {&lt;/span&gt;&lt;span&gt; name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;Back Door&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;span&gt;  lock&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;lock.back_door&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; },&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;}&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Dash&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;start&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;{&lt;/span&gt;&lt;span&gt; haUrl&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; }&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;   // blank = the Home Assistant that served this page&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The files live in Home Assistant&#39;s own &lt;code&gt;www&lt;/code&gt; folder, so Home Assistant serves them at &lt;code&gt;/local/dashboard/&amp;lt;page&amp;gt;.html&lt;/code&gt;. There&#39;s no extra web server to run.&lt;/p&gt;
&lt;p&gt;All the real work is in &lt;code&gt;core.js&lt;/code&gt;, which is about 400 lines:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/2026/10/dash-flow.png&quot; alt=&quot;How it works: the tablet loads one HTML page, opens one websocket to Home Assistant, subscribes to only the entities the page shows, and when one changes, redraws only the card that uses it&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;No polling, no refresh timer. The tablet just waits for Home Assistant to tell it something changed.&lt;/em&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;It opens &lt;strong&gt;one websocket&lt;/strong&gt; to Home Assistant.&lt;/li&gt;
&lt;li&gt;It looks through every card&#39;s settings for anything shaped like an entity ID (&lt;code&gt;light.kitchen&lt;/code&gt;, &lt;code&gt;lock.front_door&lt;/code&gt;...) and subscribes to &lt;strong&gt;only those&lt;/strong&gt;. The tablet never hears about the other few thousand entities in my house.&lt;/li&gt;
&lt;li&gt;When one of them changes, it redraws &lt;strong&gt;only the cards that use it&lt;/strong&gt;. Everything else on the screen stays put.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Each card type is just a function in its own file that returns some HTML. Here&#39;s the &quot;faces&quot; card from the family room (the one that shows if the kids are asleep), simplified a little:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-14&quot;&gt;D&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;.&lt;/span&gt;&lt;span&gt;types&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;faces&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; function&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; (&lt;/span&gt;&lt;span class=&quot;z-12 z-i&quot;&gt;el&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;z-12 z-i&quot;&gt; cfg&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;  const&lt;/span&gt;&lt;span&gt; list&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span&gt; cfg&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;.&lt;/span&gt;&lt;span&gt;list&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ||&lt;/span&gt;&lt;span&gt; []&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;  return&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    deps&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; ()&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; =&amp;gt;&lt;/span&gt;&lt;span&gt; list&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;flatMap&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span class=&quot;z-12 z-i&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; =&amp;gt;&lt;/span&gt;&lt;span&gt; [k&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;.&lt;/span&gt;&lt;span&gt;machine&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;span&gt; k&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;.&lt;/span&gt;&lt;span&gt;green])&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;filter&lt;/span&gt;&lt;span&gt;(Boolean)&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    render&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;() {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;      return&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; `&amp;lt;div class=&amp;quot;faces&amp;quot;&amp;gt;`&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; +&lt;/span&gt;&lt;span&gt; list&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;map&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span class=&quot;z-12 z-i&quot;&gt;k&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; =&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        const&lt;/span&gt;&lt;span&gt; m&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; st&lt;/span&gt;&lt;span&gt;(k&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;.&lt;/span&gt;&lt;span&gt;machine)&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;span&gt; color&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span&gt; m&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ===&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;on&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ?&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;st&lt;/span&gt;&lt;span&gt;(k&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;.&lt;/span&gt;&lt;span&gt;green)&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ===&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;on&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ?&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;var(--green)&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; :&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;var(--red)&amp;#39;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; :&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;#e0e0e0&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        return&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; `&amp;lt;button class=&amp;quot;face&amp;quot; data-hold=&amp;quot;toggle&amp;quot; data-e=&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;${&lt;/span&gt;&lt;span&gt;k&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;.&lt;/span&gt;&lt;span&gt;machine&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot; style=&amp;quot;color:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;${&lt;/span&gt;&lt;span&gt;color&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;I&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;(&lt;/span&gt;&lt;span&gt;k&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;.&lt;/span&gt;&lt;span&gt;icon&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;} ${&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;esc&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;(&lt;/span&gt;&lt;span&gt;k&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;.&lt;/span&gt;&lt;span&gt;name&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;lt;/button&amp;gt;`&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      }&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;join&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; +&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;&amp;lt;/div&amp;gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;    },&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  };&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;};&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;deps()&lt;/code&gt; says which entities should trigger a redraw, &lt;code&gt;render()&lt;/code&gt; returns the HTML, and &lt;code&gt;data-hold=&quot;toggle&quot;&lt;/code&gt; is all it takes to make a long-press toggle the sound machine. That&#39;s basically the whole card.&lt;/p&gt;
&lt;h3 id=&quot;how-small-is-it&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#how-small-is-it&quot; aria-label=&quot;Anchor link for: how-small-is-it&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
How Small Is It?&lt;/h3&gt;
&lt;p&gt;The family room page, with every script and stylesheet it loads, is about &lt;strong&gt;130 KB&lt;/strong&gt; across 13 files, and around &lt;strong&gt;42 KB&lt;/strong&gt; compressed. About a third of that is the icons, which are the &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://pictogrammers.com/library/mdi/&quot;&gt;Material Design Icons&lt;/a&gt; I actually use, built into one file by a little script so the tablets don&#39;t download thousands of icons they&#39;ll never show.&lt;/p&gt;
&lt;h3 id=&quot;logging-in&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#logging-in&quot; aria-label=&quot;Anchor link for: logging-in&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Logging In&lt;/h3&gt;
&lt;p&gt;A page needs a Home Assistant &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.home-assistant.io/docs/authentication/#your-account-profile&quot;&gt;long-lived access token&lt;/a&gt;. You open it once with the token at the end of the address:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;https://&amp;lt;your-home-assistant&amp;gt;/local/dashboard/basement.html#token=eyJ...&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The page saves the token in the tablet&#39;s browser storage and immediately removes it from the address bar, so it doesn&#39;t end up in history or a screenshot. After that it just works. If you build something like this yourself, make a separate, &lt;strong&gt;non-admin&lt;/strong&gt; Home Assistant user just for the tablets and use that user&#39;s token. A tablet on a wall is the easiest thing in the house to walk off with.&lt;/p&gt;
&lt;h2 id=&quot;the-boring-stuff-that-makes-it-reliable&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#the-boring-stuff-that-makes-it-reliable&quot; aria-label=&quot;Anchor link for: the-boring-stuff-that-makes-it-reliable&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
The Boring Stuff That Makes It Reliable&lt;/h2&gt;
&lt;p&gt;Getting a dashboard to &lt;em&gt;show up&lt;/em&gt; is easy. Getting it to keep working on a tablet that sits on a wall for months, through Wi-Fi drops, power cuts and Home Assistant restarts, is the hard part. A lot of the work with Claude went into exactly that, and each fix came from something that actually happened:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;The intercom gave up after a power cut.&lt;/strong&gt; The tablets boot faster than the server that hosts the intercom&#39;s SIP.js file. The page checked once, didn&#39;t find it, and showed &quot;Intercom unavailable&quot; until someone reloaded it by hand. Now it keeps retrying (5, 10, 20, 40, 60 seconds) and starts the intercom the moment the file shows up.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A websocket stuck in &quot;connecting&quot; forever.&lt;/strong&gt; If the tablet&#39;s Wi-Fi drops in the middle of connecting, the socket can just sit there for minutes. Now it gets 15 seconds to log in, or it&#39;s closed and tried again.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;An empty list means everything.&lt;/strong&gt; If you ask Home Assistant to subscribe to an empty list of entities, it doesn&#39;t send you nothing. It sends you &lt;strong&gt;every entity in the house&lt;/strong&gt;. A page with nothing to show now doesn&#39;t subscribe at all.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The month-long cache.&lt;/strong&gt; Home Assistant tells browsers to keep files from &lt;code&gt;/local/&lt;/code&gt; for 31 days. So after I changed &lt;code&gt;core.js&lt;/code&gt;, a tablet could keep running the old one for a month. Every page loads its scripts with a version stamp (the &lt;code&gt;?v=20261002-3&lt;/code&gt; above), and a little script updates the stamp on every page at once after a change:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;node&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; tools/bump-version.js&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;            # re-stamp every page after editing lib/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;node&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; tools/bump-version.js --check&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;    # just report if any page is out of date&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;My PC stole the kids&#39; calls.&lt;/strong&gt; If I opened a kid&#39;s page on my computer to test something, my computer signed in to the intercom &lt;em&gt;as that kid&#39;s room&lt;/em&gt;, and their calls could ring on my desk instead. Now adding &lt;code&gt;?intercom=dialer&lt;/code&gt; to the address lets a PC make calls without ever taking them, and &lt;code&gt;?intercom=off&lt;/code&gt; turns the intercom off completely.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There&#39;s also a screensaver: after a minute or two of no touches, the tablet shows a photo slideshow from my self-hosted &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://immich.app/&quot;&gt;Immich&lt;/a&gt;, and wakes back to the controls on the first tap. It&#39;s never allowed to kick in during a call.&lt;/p&gt;
&lt;h2 id=&quot;about-those-screenshots&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#about-those-screenshots&quot; aria-label=&quot;Anchor link for: about-those-screenshots&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
About Those Screenshots&lt;/h2&gt;
&lt;p&gt;Every screenshot in this post came from the real dashboard code, but not from my real house. I didn&#39;t want to post my actual calendar, door states, or kids&#39; names on the internet. So Claude wrote a small fake Home Assistant: a script that loads each page in a headless browser and answers the page&#39;s websocket messages with made-up data (a partly cloudy 68°, a back door that&#39;s unlocked, soccer practice at 5:30).&lt;/p&gt;
&lt;p&gt;That fake turned out to be useful for more than blog posts. Most of the fixes above were tested exactly that way: a stand-in Home Assistant, and a stand-in intercom that fails to load twice before it works, to check that the page recovers on its own.&lt;/p&gt;
&lt;h2 id=&quot;letting-claude-write-it&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#letting-claude-write-it&quot; aria-label=&quot;Anchor link for: letting-claude-write-it&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Letting Claude Write It&lt;/h2&gt;
&lt;p&gt;I&#39;m not a web developer. I can read JavaScript well enough to follow along, but about 3,500 lines of it, plus an in-browser intercom, was never going to come out of me.&lt;/p&gt;
&lt;p&gt;The dashboards live in their own Git repo on GitHub, and Claude worked on them the same way every time: it worked on a branch, explained what it changed and how it tested it, and I merged it and copied the folder into Home Assistant&#39;s &lt;code&gt;www&lt;/code&gt; folder. Then I went and poked at the actual tablets.&lt;/p&gt;
&lt;p&gt;That last part was my real job. Claude can test a page in a headless browser all day, but it can&#39;t tell that a button is too small for a kid&#39;s finger, or that the intercom stops working after the power goes out at 3 AM. Most of the fixes in the section above started with me saying &quot;this thing did something weird,&quot; and Claude figuring out why.&lt;/p&gt;
&lt;h2 id=&quot;was-it-worth-it&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#was-it-worth-it&quot; aria-label=&quot;Anchor link for: was-it-worth-it&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Was It Worth It?&lt;/h2&gt;
&lt;p&gt;For us, yes. Taps respond right away, the random reloads are gone, the tablets come back on their own after the power goes out, and every page shows exactly what that room needs and nothing else. And because each page is just a short HTML file, changing a button is a one-line edit, not a trip through the dashboard editor on a tablet.&lt;/p&gt;
&lt;p&gt;Would I tell everyone to do this? Probably not. Lovelace is still the right answer for most people, especially on a decent tablet or a phone, and it doesn&#39;t need any code. But if you have some older tablets on your walls that hang and reload like mine did, a page that only knows about the twenty entities it shows is a surprisingly small amount of code.&lt;/p&gt;
&lt;p&gt;Let me know in the comments if you&#39;d like me to go deeper on any of these cards, or the intercom.&lt;/p&gt;
&lt;p&gt;Thanks for reading.&lt;/p&gt;
</description>
      </item>
      <item>
          <title>Goodbye WordPress, Hello Zola</title>
          <pubDate>Sat, 03 Oct 2026 00:00:00 +0000</pubDate>
          <author>thehelpfulidiot</author>
          <link>https://thehelpfulidiot.com/goodbye-wordpress-hello-zola/</link>
          <guid>https://thehelpfulidiot.com/goodbye-wordpress-hello-zola/</guid>
          <description xml:base="https://thehelpfulidiot.com/goodbye-wordpress-hello-zola/">&lt;p&gt;It has been a while. My last post was the &lt;a href=&quot;/making-an-automatic-email-backup-updated-9-15-2024&quot;&gt;email backup update&lt;/a&gt; back in September 2024, and since then this blog has mostly just... sat there. Running. Asking me for updates.&lt;/p&gt;
&lt;p&gt;That last part is the problem.&lt;/p&gt;
&lt;p&gt;When I started this blog, it lived in a managed WordPress container on IONOS. Eventually it dawned on me that I already self host basically everything else, and I already had Traefik with Let&#39;s Encrypt certificates set up. Why was I paying someone else to host a blog? So I used a backup plugin to pack the whole site up, brought it home, and restored it into a TurnKey Linux WordPress LXC sitting behind Traefik.&lt;/p&gt;
&lt;p&gt;That saved some money, but now &lt;em&gt;I&lt;/em&gt; was the one keeping WordPress, Apache, PHP, MySQL, a theme, and a handful of plugins up to date, all to serve a few posts that almost never change. Every time I logged in there was a new red bubble asking me to update something.&lt;/p&gt;
&lt;p&gt;Then I was listening to &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://linuxunplugged.com/683&quot;&gt;Linux Unplugged episode 683&lt;/a&gt;, heard them talking about Zola, and figured it was worth a shot. If you&#39;re reading this, you&#39;re looking at the result.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/2026/10/before-after.png&quot; alt=&quot;Three stages of this blog: managed WordPress on IONOS, then a TurnKey WordPress LXC behind Traefik at home, and now Zola&amp;#39;s static files served by an nginx container behind the same Traefik&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Same blog, three homes, a lot fewer moving parts&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&quot;why-zola&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#why-zola&quot; aria-label=&quot;Anchor link for: why-zola&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Why Zola&lt;/h2&gt;
&lt;p&gt;A static site generator takes a folder of Markdown files and spits out plain HTML. No database, no PHP, no admin login for bots to hammer on. The web server just hands out files.&lt;/p&gt;
&lt;p&gt;There are a lot of these (&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://gohugo.io/&quot;&gt;Hugo&lt;/a&gt;, &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://jekyllrb.com/&quot;&gt;Jekyll&lt;/a&gt;, etc.), but I went with &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.getzola.org/&quot;&gt;Zola&lt;/a&gt;. It&#39;s a single binary with no dependencies, and it builds this whole site in a few seconds. I tried it out on a practice site first before committing to moving this one.&lt;/p&gt;
&lt;p&gt;For the theme, I went with &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/welpo/tabi&quot;&gt;tabi&lt;/a&gt;. I had been using a different theme on the practice site, but when I actually counted, this blog has &lt;strong&gt;110 code blocks&lt;/strong&gt; and &lt;strong&gt;64 images&lt;/strong&gt;. It&#39;s basically a pile of config files with some words in between. tabi comes with search, tag and category pages, and syntax highlighting with a copy button already built in. The other theme would have needed all three made by hand.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/2026/10/code-block-phone.png&quot; alt=&quot;A YAML code block from one of my Home Assistant posts, with a YAML label and a copy button in its header&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Every code block now gets a language label and a copy button. This is on my phone.&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&quot;not-doing-it-the-normal-way&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#not-doing-it-the-normal-way&quot; aria-label=&quot;Anchor link for: not-doing-it-the-normal-way&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Not Doing It the Normal Way&lt;/h2&gt;
&lt;p&gt;The normal way to leave WordPress is to export everything to an XML file (WXR) and run it through a converter, or to just crawl your own site and scrape the HTML. Both of those make you un-mangle whatever the theme and the exporter did to your posts.&lt;/p&gt;
&lt;p&gt;Since I have root on the container, I skipped all that. &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://wp-cli.org/&quot;&gt;WP-CLI&lt;/a&gt; can read the raw post content straight out of the database, exactly as the editor saved it. So the whole migration came down to three scripts:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/img/2026/10/pipeline.png&quot; alt=&quot;The migration pipeline: MySQL, then wp-recon.sh, then wp2zola.py, then postfix.py, then Zola with the tabi theme&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;The whole migration, start to finish&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I&#39;ll be honest, I did not sit down and write a block-aware WordPress converter in Python by myself. I leaned on Claude (the AI) pretty heavily for this whole project. It wrote most of the scripts, and I made the decisions, ran things, and broke things. Seems fitting for a blog called The Helpful Idiot.&lt;/p&gt;
&lt;h2 id=&quot;look-before-you-leap&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#look-before-you-leap&quot; aria-label=&quot;Anchor link for: look-before-you-leap&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Look Before You Leap&lt;/h2&gt;
&lt;p&gt;The first script, &lt;code&gt;wp-recon.sh&lt;/code&gt;, doesn&#39;t change anything. It just surveys what&#39;s actually in there. I&#39;m really glad we did this first, because it changed several decisions:&lt;/p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;What I assumed&lt;/th&gt;&lt;th&gt;What was actually there&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;A mix of old and new editor content&lt;/td&gt;&lt;td&gt;100% Gutenberg blocks, zero classic HTML&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;A bunch of image galleries to untangle&lt;/td&gt;&lt;td&gt;No galleries at all, just 64 regular image blocks&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;146M of uploads to move&lt;/td&gt;&lt;td&gt;~95M. The other 51M was GeoIP databases from a stats plugin&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;A quick find-and-replace for my server&#39;s local IP&lt;/td&gt;&lt;td&gt;It shows up 11 times, and some of those are &lt;em&gt;supposed&lt;/em&gt; to be there&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;That last one is the best example. The WordPress container&#39;s local IP had leaked into a few posts through image links. Claude&#39;s first suggestion was a database-wide search-and-replace. But recon showed that same IP is also sitting inside a few of my tutorials as a perfectly legitimate example config value. A blind find-and-replace would have quietly broken the instructions people actually copy and paste.&lt;/p&gt;
&lt;p&gt;So instead, the converter only rewrites URLs inside image, link, and file blocks, and leaves code blocks byte-for-byte identical.&lt;/p&gt;
&lt;h2 id=&quot;converting-the-posts&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#converting-the-posts&quot; aria-label=&quot;Anchor link for: converting-the-posts&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Converting the Posts&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;wp2zola.py&lt;/code&gt; is the real workhorse. Gutenberg saves each block with a little comment that says exactly what it is (paragraph, heading, code, image...), so conversion is mostly just &quot;see the block, write the Markdown.&quot; Code blocks come out unescaped, images keep their captions, and every post gets its front matter written in TOML.&lt;/p&gt;
&lt;p&gt;The thing I cared about most was &lt;strong&gt;not breaking any links.&lt;/strong&gt; Some of these posts get linked from forums, and they&#39;re indexed by Google. So:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Posts keep their flat WordPress URLs (&lt;code&gt;/some-post-name&lt;/code&gt;) by giving each one an explicit &lt;code&gt;path&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Categories and tags are named &lt;code&gt;category&lt;/code&gt; and &lt;code&gt;tag&lt;/code&gt; (singular!) so Zola builds &lt;code&gt;/category/self-hosting/&lt;/code&gt; and &lt;code&gt;/tag/home-assistant/&lt;/code&gt;, exactly like WordPress did&lt;/li&gt;
&lt;li&gt;Images stay at &lt;code&gt;/wp-content/uploads/...&lt;/code&gt; so not a single image link had to change&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here&#39;s what the top of a converted post looks like now:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;toml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+++&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;title&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Playing a sound directly from Home Assistant Operating System&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;date&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span&gt; 2021-10-02&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;path&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;playing-a-sound-directly-from-home-assistant-operating-system&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;description&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Playing a door chime through a speaker plugged into the Home Assistant box itself, using the VLC add-on over telnet.&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;[&lt;/span&gt;&lt;span&gt;taxonomies&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;category&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; [&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;Smart Home&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tag&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; [&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;home assistant&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;nest&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;vlc&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;+++&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Result: 19 files, zero blocks the converter didn&#39;t know how to handle.&lt;/p&gt;
&lt;h2 id=&quot;things-that-broke-anyway&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#things-that-broke-anyway&quot; aria-label=&quot;Anchor link for: things-that-broke-anyway&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Things That Broke Anyway&lt;/h2&gt;
&lt;p&gt;Of course it wasn&#39;t that easy. Everything below only showed up by actually running builds, not by reading documentation.&lt;/p&gt;
&lt;h3 id=&quot;home-assistant-templates-broke-the-build&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#home-assistant-templates-broke-the-build&quot; aria-label=&quot;Anchor link for: home-assistant-templates-broke-the-build&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Home Assistant templates broke the build&lt;/h3&gt;
&lt;p&gt;Zola looks for its own template tags in your posts, &lt;em&gt;including inside code blocks&lt;/em&gt;. Home Assistant uses almost the exact same &lt;code&gt;{{ }}&lt;/code&gt; syntax, so a line like this from my &lt;a href=&quot;/fully-local-universal-remote-control-with-home-assistant&quot;&gt;remote control post&lt;/a&gt; made the build fall over:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_POWER&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The fix is to wrap any code block with curly braces in Zola&#39;s &lt;code&gt;raw&lt;/code&gt; tags so it leaves them alone. Four posts needed it.&lt;/p&gt;
&lt;h3 id=&quot;my-series-were-numbered-backwards&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#my-series-were-numbered-backwards&quot; aria-label=&quot;Anchor link for: my-series-were-numbered-backwards&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
My series were numbered backwards&lt;/h3&gt;
&lt;p&gt;Zola sorts by date newest-first, so the first post of my email backup series proudly announced itself as &quot;Part 4 of 4.&quot; tabi&#39;s documented fix is a little strange, but it works:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;toml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sort_by&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;date&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;paginate_by&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 9999&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;paginate_reversed&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; true&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Both series now live under &lt;a href=&quot;/series&quot;&gt;/series&lt;/a&gt;, with automatic &quot;Part 1 of 4&quot; labels and next/previous links, while the posts themselves kept their old URLs.&lt;/p&gt;
&lt;h3 id=&quot;analytics-were-silently-blocked&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#analytics-were-silently-blocked&quot; aria-label=&quot;Anchor link for: analytics-were-silently-blocked&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Analytics were silently blocked&lt;/h3&gt;
&lt;p&gt;tabi ships with a strict Content Security Policy, which basically tells the browser &quot;only run scripts that are files on this server.&quot; That&#39;s great for security, but it meant the little inline script that starts my analytics (&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://plausible.io/&quot;&gt;Plausible&lt;/a&gt;, no cookies) just... didn&#39;t run. No error on the page, nothing. Moving it into its own &lt;code&gt;.js&lt;/code&gt; file fixed it.&lt;/p&gt;
&lt;h3 id=&quot;nginx-doesn-t-like-curly-braces-either&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#nginx-doesn-t-like-curly-braces-either&quot; aria-label=&quot;Anchor link for: nginx-doesn-t-like-curly-braces-either&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
nginx doesn&#39;t like curly braces either&lt;/h3&gt;
&lt;p&gt;The old sidebar linked to WordPress&#39;s monthly archives (&lt;code&gt;/2021/09/&lt;/code&gt; and so on), and Google has those indexed. Zola doesn&#39;t make those pages, so they redirect to the &lt;a href=&quot;/archive&quot;&gt;archive page&lt;/a&gt; instead. My first attempt broke the nginx config, because nginx reads &lt;code&gt;{&lt;/code&gt; as the start of a block, even inside a regex. The whole regex needs to be in quotes:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;nginx&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ~&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;^/[0-9]&lt;/span&gt;&lt;span&gt;{4}(/[0-9]{2})?(/[0-9]{2})?/?$&amp;quot; {&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; return&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 301&lt;/span&gt;&lt;span&gt; /archive/; }&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Lesson learned (again): run &lt;code&gt;nginx -t&lt;/code&gt; &lt;em&gt;before&lt;/em&gt; restarting, not after.&lt;/p&gt;
&lt;h2 id=&quot;keeping-old-links-alive&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#keeping-old-links-alive&quot; aria-label=&quot;Anchor link for: keeping-old-links-alive&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Keeping Old Links Alive&lt;/h2&gt;
&lt;p&gt;Everything that matters (posts, categories, tags, page 2, images) has the exact same URL as before, so it needs no rules at all. The nginx config in front of the site only has to deal with the WordPress leftovers.&lt;/p&gt;
&lt;p&gt;The most important one is the feed, since WordPress served it at &lt;code&gt;/feed/&lt;/code&gt; and people actually subscribe to it:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;nginx&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /feed  &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; return&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 301&lt;/span&gt;&lt;span&gt; /rss.xml; }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /feed/ &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; return&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 301&lt;/span&gt;&lt;span&gt; /rss.xml; }&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The rest is WordPress&#39;s admin and login pages. Bots probe these constantly, and they now get a &lt;code&gt;410 Gone&lt;/code&gt; instead of a login page:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;nginx&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ^~&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /wp-admin    &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; return&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 410&lt;/span&gt;&lt;span&gt;; }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ^~&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /wp-includes &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; return&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 410&lt;/span&gt;&lt;span&gt;; }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /wp-login.php &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; return&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 410&lt;/span&gt;&lt;span&gt;; }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /xmlrpc.php   &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; return&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 410&lt;/span&gt;&lt;span&gt;; }&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;410&lt;/code&gt; tells search engines the page is gone for good, and it&#39;s a tiny response instead of a full styled 404 page for every bot that comes knocking. Just be careful not to block all of &lt;code&gt;/wp-content/&lt;/code&gt;, since that&#39;s where every image on this site still lives.&lt;/p&gt;
&lt;h2 id=&quot;cleaning-up&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#cleaning-up&quot; aria-label=&quot;Anchor link for: cleaning-up&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Cleaning Up&lt;/h2&gt;
&lt;p&gt;The last script, &lt;code&gt;postfix.py&lt;/code&gt;, did the cleanup. It always runs as a dry run first, and it&#39;s safe to run twice. It:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Reworded a few sentences that only made sense next to WordPress comments&lt;/li&gt;
&lt;li&gt;Pulled one workaround that only existed in a comment thread back into the post itself&lt;/li&gt;
&lt;li&gt;Gave categories to ten posts that never had one&lt;/li&gt;
&lt;li&gt;Built the two series&lt;/li&gt;
&lt;li&gt;Added languages to 66 of the 110 code blocks, so they actually get syntax highlighting now&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After that, there was a round of polishing: comments are now handled by &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://giscus.app/&quot;&gt;giscus&lt;/a&gt; (they live in GitHub Discussions instead of my database), the site follows your phone&#39;s light/dark mode, the six images I had been hosting off my Synology got moved onto the site itself, and the phone menu got fixed after it refused to close on my iPhone.&lt;/p&gt;
&lt;h2 id=&quot;was-it-worth-it&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#was-it-worth-it&quot; aria-label=&quot;Anchor link for: was-it-worth-it&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Was It Worth It?&lt;/h2&gt;
&lt;p&gt;Absolutely. The whole site is now a folder of text files in a Git repo. To write a post, I write a Markdown file. To publish, I pull and rebuild. There&#39;s no database to back up, no plugins to update, and no login page for bots to brute force.&lt;/p&gt;
&lt;p&gt;And apparently, a new platform was all it took to get me writing again.&lt;/p&gt;
&lt;p&gt;If you&#39;re sitting on a WordPress blog that you mostly just maintain rather than write on, I&#39;d highly recommend it. Let me know in the comments if you have any questions.&lt;/p&gt;
&lt;p&gt;Thanks for reading.&lt;/p&gt;
</description>
      </item>
      <item>
          <title>Making an Automatic Email Backup (Updated 9/15/2024)</title>
          <pubDate>Sun, 15 Sep 2024 00:00:00 +0000</pubDate>
          <author>thehelpfulidiot</author>
          <link>https://thehelpfulidiot.com/making-an-automatic-email-backup-updated-9-15-2024/</link>
          <guid>https://thehelpfulidiot.com/making-an-automatic-email-backup-updated-9-15-2024/</guid>
          <description xml:base="https://thehelpfulidiot.com/making-an-automatic-email-backup-updated-9-15-2024/">&lt;p&gt;This is basically an update to the project I discussed in these three previous posts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;/making-an-automatic-email-backup&quot;&gt;Part 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;/making-an-automatic-email-backup-part-2&quot;&gt;Part 2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;/making-an-automatic-email-backup-part-3&quot;&gt;Part 3&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I have been using this method of backing up emails for the past several years and have been very please with the reliability. It has not required any modification or tinkering and has just seemed to work.&lt;/p&gt;
&lt;p&gt;Having said that, even though it works reliably and doesn&#39;t need to be fixed, that doesn&#39;t mean I shouldn&#39;t try.&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/jon6fingrs/mbsync-dovecot&quot;&gt;https://github.com/jon6fingrs/mbsync-dovecot&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Enter this newest interation of my docker images for Mbsync and Dovecot. It uses updated versions of the software of course, but I have also made a few big changes which may be of use to some of you.&lt;/p&gt;
&lt;h2 id=&quot;solr&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#solr&quot; aria-label=&quot;Anchor link for: solr&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Solr&lt;/h2&gt;
&lt;p&gt;Now includes Solr integration!&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://solr.apache.org/&quot;&gt;Solr&lt;/a&gt; is an indexing and search platform. Previously, if performing a remote IMAP search through a generic IMAP client (some search their offline index), it would search each email sequentially and so could take a LONG time. Now, by deploying Solr at the same time, the search is MARKEDLY improved when I search using the Apple Mail app.&lt;/p&gt;
&lt;p&gt;The solr docker container I have made includes the necessary setup for Dovecot, and the Dovecot container will look for the Solr container and so neither will now work without the other.&lt;/p&gt;
&lt;p&gt;The solr container also includes cron and will write commits every 5 minutes and will optimize the database each night.&lt;/p&gt;
&lt;h2 id=&quot;mbsync-timing&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#mbsync-timing&quot; aria-label=&quot;Anchor link for: mbsync-timing&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Mbsync Timing&lt;/h2&gt;
&lt;p&gt;Previously, the mbsync container would run once and then quit. Now, it will run to synchronize the mailbox, and then afterwards, it will open cron as the primary process, which will check for mail each 5 minutes. This avoids having to set a manual cronjob and keeps the container running.&lt;/p&gt;
&lt;p&gt;If you want your own sync schedule, you can deactivate the built in cron with an environment variable and use whatever interval you would like.&lt;/p&gt;
&lt;h2 id=&quot;better-environment-variables&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#better-environment-variables&quot; aria-label=&quot;Anchor link for: better-environment-variables&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Better Environment Variables&lt;/h2&gt;
&lt;p&gt;Some of the environment variables are now optional, and more intuitive. The run scripts are more robust.&lt;/p&gt;
&lt;h2 id=&quot;what-s-the-point&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#what-s-the-point&quot; aria-label=&quot;Anchor link for: what-s-the-point&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
What&#39;s the point?&lt;/h2&gt;
&lt;p&gt;But why did I do this? What&#39;s the point? Well, I would love to have my own mail server, but I am too worried about the administrative burden and dropped emails. This way, I feel like I am able to offload some of my dependence on the cloud by downloading and archiving every email, and just periodically purging my cloud provide inbox.&lt;/p&gt;
&lt;p&gt;I have a complete email archive with all emails since my accounts opened. This is offline and does not require increasing my available cloud storage more and more.&lt;/p&gt;
&lt;p&gt;Also, because I could.&lt;/p&gt;
&lt;p&gt;So check it out if that sounds interesting and let me know how it works:&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/jon6fingrs/mbsync-dovecot&quot;&gt;https://github.com/jon6fingrs/mbsync-dovecot&lt;/a&gt;&lt;/p&gt;
</description>
      </item>
      <item>
          <title>Nextcloud Docker with Nginx Proxy Manager</title>
          <pubDate>Sun, 31 Mar 2024 00:00:00 +0000</pubDate>
          <author>thehelpfulidiot</author>
          <link>https://thehelpfulidiot.com/nextcloud-docker-with-nginx-proxy-manager/</link>
          <guid>https://thehelpfulidiot.com/nextcloud-docker-with-nginx-proxy-manager/</guid>
          <description xml:base="https://thehelpfulidiot.com/nextcloud-docker-with-nginx-proxy-manager/">&lt;p&gt;Nextcloud has become an integral part of my work flow these days. I love having a &quot;place&quot; to go that&#39;s totally mine. I have been running it from a &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://hub.docker.com/_/nextcloud&quot;&gt;docker container&lt;/a&gt; since before the &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/nextcloud/all-in-one&quot;&gt;AIO images&lt;/a&gt; were available and so have not had a reason to change.&lt;/p&gt;
&lt;p&gt;The container comes in two flavors- Apache vs php-fpm. The I had been running the Apache version since it is generally easier, but always hated the idea of using Nginx Proxy Manager in front of Apache. It just seemed like a redundancy. Finally, I started to get some weird behaviors in Nextcloud which I tracked down as some webserver problem.&lt;/p&gt;
&lt;p&gt;So now I have the perfect opportunity to fix something that really isn&#39;t breaking by doing wayyyy too much work.&lt;/p&gt;
&lt;p&gt;I decided to try the php-fpm version and really wanted to take advantage of Nginx Proxy Manager and not have to use a second Nginx container!&lt;/p&gt;
&lt;p&gt;Looking far and wide on the internet, most people said it was impossible, but I found really this single post that laid is out pretty nicely.&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://help.nextcloud.com/t/docker-nextcloud-fpm-behind-nginx-proxy-manager-do-i-need-another-nginx-container/133431/6&quot;&gt;https://help.nextcloud.com/t/docker-nextcloud-fpm-behind-nginx-proxy-manager-do-i-need-another-nginx-container/133431/6&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It turned out to be much easier than expected and I was essentially able to seamlessly swap out the Apache image for the php-fpm image by updating the docker compose file.&lt;/p&gt;
&lt;p&gt;I did, however, update the nginx proxy configuration a bit from what was in that link to resolve various errors, to add the built-in collabora server, and to add push notifications.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;nginx&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;	# set max upload size&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        client_max_body_size&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 512M&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        fastcgi_buffers&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 64 4K&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;	include&lt;/span&gt;&lt;span&gt; mime.types&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;	types&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		application/javascript mjs&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # Enable gzip but do not remove ETag headers&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        gzip&lt;/span&gt;&lt;span class=&quot;z-11&quot;&gt; on&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        gzip_vary&lt;/span&gt;&lt;span class=&quot;z-11&quot;&gt; on&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        gzip_comp_level&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 4&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        gzip_min_length&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 256&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        gzip_proxied&lt;/span&gt;&lt;span&gt; expired no-cache no-store private no_last_modified no_etag auth&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        gzip_types&lt;/span&gt;&lt;span&gt; application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # Pagespeed is not supported by Nextcloud, so if your server is built&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # with the `ngx_pagespeed` module, uncomment this line to disable it.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        #pagespeed off;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # HTTP response headers borrowed from Nextcloud `.htaccess`&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        add_header&lt;/span&gt;&lt;span&gt; Referrer-Policy                      &lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;no-referrer&amp;quot;&lt;/span&gt;&lt;span&gt;       always&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        add_header&lt;/span&gt;&lt;span&gt; X-Content-Type-Options               &lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;nosniff&amp;quot;&lt;/span&gt;&lt;span&gt;           always&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        add_header&lt;/span&gt;&lt;span&gt; X-Download-Options                   &lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;noopen&amp;quot;&lt;/span&gt;&lt;span&gt;            always&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        add_header&lt;/span&gt;&lt;span&gt; X-Frame-Options                      &lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;SAMEORIGIN&amp;quot;&lt;/span&gt;&lt;span&gt;        always&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        add_header&lt;/span&gt;&lt;span&gt; X-Permitted-Cross-Domain-Policies    &lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;none&amp;quot;&lt;/span&gt;&lt;span&gt;              always&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        add_header&lt;/span&gt;&lt;span&gt; X-Robots-Tag                         &lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;noindex, nofollow&amp;quot;&lt;/span&gt;&lt;span&gt; always&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        add_header&lt;/span&gt;&lt;span&gt; X-XSS-Protection                     &lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;1; mode=block&amp;quot;&lt;/span&gt;&lt;span&gt;     always&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # Remove X-Powered-By, which is an information leak&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        fastcgi_hide_header&lt;/span&gt;&lt;span&gt; X-Powered-By&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # Path to the root of your installation&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        root&lt;/span&gt;&lt;span&gt; /var/www/html&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # Specify how to handle directories -- specifying `/index.php$request_uri`&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # here as the fallback means that Nginx always exhibits the desired behaviour&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # when a client requests a path that corresponds to a directory that exists&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # on the server. In particular, if that directory contains an index.php file,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # that file is correctly served; if it doesn&amp;#39;t, then the request is passed to&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # the front-end controller. This consistent behaviour means that we don&amp;#39;t need&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # to specify custom rules for certain paths (e.g. images and other assets,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # `/updater`, `/ocm-provider`, `/ocs-provider`), and thus&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # `try_files $uri $uri/ /index.php$request_uri`&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # always provides the desired behaviour.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        index&lt;/span&gt;&lt;span&gt; index.php index.html /index.php$request_uri&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # Rule borrowed from `.htaccess` to handle Microsoft DAV clients&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        location&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; / &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            if&lt;/span&gt;&lt;span&gt; ( $http_user_agent&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ~ &lt;/span&gt;&lt;span&gt;^DavClnt ) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;                return&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 302&lt;/span&gt;&lt;span&gt; /remote.php/webdav/$is_args$args;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        location&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /robots.txt &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            allow&lt;/span&gt;&lt;span class=&quot;z-11&quot;&gt; all&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            log_not_found&lt;/span&gt;&lt;span class=&quot;z-11&quot;&gt; off&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            access_log&lt;/span&gt;&lt;span class=&quot;z-11&quot;&gt; off&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # Make a regex exception for `/.well-known` so that clients can still&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # access it despite the existence of the regex rule&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # `location ~ /(\.|autotest|...)` which would otherwise handle requests&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # for `/.well-known`.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        location&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ^~&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /.well-known &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;            # The rules in this block are an adaptation of the rules&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;            # in `.htaccess` that concern `/.well-known`.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            location&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /.well-known/carddav &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; return&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 301&lt;/span&gt;&lt;span&gt; /remote.php/dav/; }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            location&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /.well-known/caldav  &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; return&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 301&lt;/span&gt;&lt;span&gt; /remote.php/dav/; }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            location&lt;/span&gt;&lt;span&gt; /.well-known/acme-challenge    {&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; try_files&lt;/span&gt;&lt;span&gt; $uri $uri/ &lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt;=404&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;span&gt; }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            location&lt;/span&gt;&lt;span&gt; /.well-known/pki-validation    {&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; try_files&lt;/span&gt;&lt;span&gt; $uri $uri/ &lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt;=404&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;span&gt; }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;            # Let Nextcloud&amp;#39;s API for `/.well-known` URIs handle all other&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;            # requests by passing them to the front-end controller.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            return&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 301&lt;/span&gt;&lt;span&gt; /index.php$request_uri;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # Rules borrowed from `.htaccess` to hide certain paths from clients&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        location&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ~&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/)  &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; return&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 404&lt;/span&gt;&lt;span&gt;; }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        location&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ~&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ^/(?:\.|autotest|occ|issue|indie|db_|console)                &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; return&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 404&lt;/span&gt;&lt;span&gt;; }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # Ensure this block, which passes PHP files to the PHP process, is above the blocks&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # which handle static assets (as seen below). If this block is not declared first,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # then Nginx will encounter an infinite rewriting loop when it prepends `/index.php`&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # to the URI, resulting in a HTTP 500 error response.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        location&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ~&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; \.php(?:$|/) &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;            # Required for legacy support&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            rewrite&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy) /index.php$&lt;/span&gt;&lt;span&gt;request_uri&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            fastcgi_split_path_info&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ^(.+?\.php)(/.*)$&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            set&lt;/span&gt;&lt;span&gt; $path_info $fastcgi_path_info&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            try_files&lt;/span&gt;&lt;span&gt; $fastcgi_script_name&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; =404&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            include&lt;/span&gt;&lt;span&gt; fastcgi_params&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            fastcgi_param&lt;/span&gt;&lt;span&gt; SCRIPT_FILENAME $document_root$fastcgi_script_name&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            fastcgi_param&lt;/span&gt;&lt;span&gt; PATH_INFO $path_info&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;            #fastcgi_param HTTPS on;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            fastcgi_param&lt;/span&gt;&lt;span&gt; modHeadersAvailable &lt;/span&gt;&lt;span class=&quot;z-11&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;         # Avoid sending the security headers twice&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            fastcgi_param&lt;/span&gt;&lt;span&gt; front_controller_active &lt;/span&gt;&lt;span class=&quot;z-11&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;     # Enable pretty urls&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            fastcgi_pass&lt;/span&gt;&lt;span&gt; nextcloud-nextcloud-1:9000&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            fastcgi_intercept_errors&lt;/span&gt;&lt;span class=&quot;z-11&quot;&gt; on&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            fastcgi_request_buffering&lt;/span&gt;&lt;span class=&quot;z-11&quot;&gt; off&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;    	location&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ~&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; \.(?:css|js|mjs|svg|gif|png|jpg|ico|wasm|tflite|map|ogg|flac)$ &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            try_files&lt;/span&gt;&lt;span&gt; $uri /index.php$request_uri&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            expires&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 6M&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;         # Cache-Control policy borrowed from `.htaccess`&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            access_log&lt;/span&gt;&lt;span class=&quot;z-11&quot;&gt; off&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;     # Optional: Don&amp;#39;t log access to assets&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        location&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ~&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; \.woff2?$ &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            try_files&lt;/span&gt;&lt;span&gt; $uri /index.php$request_uri&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            expires&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 7d&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;         # Cache-Control policy borrowed from `.htaccess`&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            access_log&lt;/span&gt;&lt;span class=&quot;z-11&quot;&gt; off&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;     # Optional: Don&amp;#39;t log access to assets&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;        # Rule borrowed from `.htaccess`&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        location&lt;/span&gt;&lt;span&gt; /remote {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            return&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 301&lt;/span&gt;&lt;span&gt; /remote.php$request_uri;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;	location&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ^~&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /push/ &lt;/span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        	proxy_pass&lt;/span&gt;&lt;span&gt; http://nextcloud_notify:7867/&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        	proxy_http_version&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1.1&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        	proxy_set_header&lt;/span&gt;&lt;span&gt; Upgrade $http_upgrade&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        	proxy_set_header&lt;/span&gt;&lt;span&gt; Connection &lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;Upgrade&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        	proxy_set_header&lt;/span&gt;&lt;span&gt; Host $host&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        	proxy_set_header&lt;/span&gt;&lt;span&gt; X-Forwarded-For $proxy_add_x_forwarded_for&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        location&lt;/span&gt;&lt;span&gt; / {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            try_files&lt;/span&gt;&lt;span&gt; $uri $uri/ /index.php$request_uri&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;		proxy_set_header&lt;/span&gt;&lt;span&gt; Host $host&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;		proxy_set_header&lt;/span&gt;&lt;span&gt; X-Real-IP $remote_addr&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;		proxy_set_header&lt;/span&gt;&lt;span&gt; X-Forwarded-For $proxy_add_x_forwarded_for&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;		proxy_set_header&lt;/span&gt;&lt;span&gt; X-Forwarded-Proto $scheme&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;		proxy_set_header&lt;/span&gt;&lt;span&gt; X-Forwarded-Host $server_name&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This has worked for Nextcloud 28.&lt;/p&gt;
&lt;p&gt;Otherwise, the post pretty much explains everything else!&lt;/p&gt;
</description>
      </item>
      <item>
          <title>Fully Local Universal Remote Control with Home Assistant</title>
          <pubDate>Sun, 11 Feb 2024 00:00:00 +0000</pubDate>
          <author>thehelpfulidiot</author>
          <link>https://thehelpfulidiot.com/fully-local-universal-remote-control-with-home-assistant/</link>
          <guid>https://thehelpfulidiot.com/fully-local-universal-remote-control-with-home-assistant/</guid>
          <description xml:base="https://thehelpfulidiot.com/fully-local-universal-remote-control-with-home-assistant/">&lt;h2 id=&quot;background&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#background&quot; aria-label=&quot;Anchor link for: background&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Background&lt;/h2&gt;
&lt;p&gt;I have had a Logitech Harmony remote solution for almost 10 years. In my opinion, it is a very nice product. It integrates nicely into Home Assistant, and so, while it didn&#39;t behave as intuitively as I wanted out of the box, Home Assistant automations were able to modify its behavior so that it largely performed seamlessly in the way that I wanted.&lt;/p&gt;
&lt;p&gt;Unfortunately, as with many other quality products, Logitech decided to &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.tomsguide.com/news/logitech-kills-off-harmony-universal-remotes-but-theres-a-little-good-news&quot;&gt;discontinue&lt;/a&gt; the Harmony line of products.&lt;/p&gt;
&lt;p&gt;Luckily, Logitech has learned from its previous mistake when it &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://arstechnica.com/gadgets/2017/11/logitech-to-shut-down-service-and-support-for-harmony-link-devices-in-2018/&quot;&gt;discontinued the Harmony Link years earlier&lt;/a&gt;. At the time, they announced that the devices would lose support and become bricks. This rustled a few jimmies and so they ultimately shipped a free Harmony Hub (the upgraded, but now current generation of IR hub) to the unhappy customers.&lt;/p&gt;
&lt;p&gt;So even though Logitech has announced an end to the Harmony brand, they have stated that they will continue to support the devices currently in the wild. Well this is obviously a relief, but who can say how long we will get this reprieve before Logitech decides they&#39;ve given us enough of their &quot;free&quot; computing power?&lt;/p&gt;
&lt;p&gt;Recently, my dog ate one of my Harmony remotes. I had to purchase a used replacement from ebay. When it came, it was still paired to its previous hub, and trying to repair it set off a very difficult mission which required my downloading the official Harmony software onto a Windows Box so that I could restore my old profile.&lt;/p&gt;
&lt;p&gt;It worked, but took several hours and was extremely frustrating to have to rely on a black box to fix something which had become integral to many automations and to my WAF. This got me thinking, how much longer do I have with Harmony? When will this next remote be destroyed? When will Harmony&#39;s recovery tools become out-dated and unusable?&lt;/p&gt;
&lt;p&gt;This set me off on searching for a more stable, long-term solution.&lt;/p&gt;
&lt;h2 id=&quot;alternatives&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#alternatives&quot; aria-label=&quot;Anchor link for: alternatives&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Alternatives&lt;/h2&gt;
&lt;p&gt;So what are the alternatives? Well surprisingly few.&lt;/p&gt;
&lt;p&gt;There appears to be a pretty popular Harmony replacement, called the &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.sofabaton.com/&quot;&gt;Sofabaton&lt;/a&gt;. It seems to have received pretty positive reviews all around, and if I&#39;m being honest, I didn&#39;t really look into it too much. Regardless of whether or not it behaves locally, I just saw it as trading one walled garden for another. It seemed like you would need an internet connection and the company&#39;s servers in order to add new devices. I wanted something that would be totally local.&lt;/p&gt;
&lt;p&gt;Immediately, I was drawn to the &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://ebroadlink.com/products/broadlink-rm4-mini-universal-remote-wi-fi-ir-control-hub_certified-wwa-work-with-alexa_-black&quot;&gt;Broadlink RM4 mini&lt;/a&gt;. It is a cheap IR blaser which can learn from IR remotes, or can use codes found online. It integrates very nicely into Home Assistant, and works over a local connection. I attempted to set it up normally, but there was some issue. The device was added to my wifi but not to my Broadlink account. However, this turned out to be the perfect outcome since I was able to integrate it into Home Assistant and now do not need to worry about a device calling home constantly.&lt;/p&gt;
&lt;p&gt;The IR blaser is for my TV and soundbar which are not controllable by wifi. Otherwise, I have a kodi box, an Apple TV, and a Roku. These are all controllable over wifi.&lt;/p&gt;
&lt;p&gt;So now, we have a way to interact with my media devices. I can use it through various automations, from my phone, a computer, etc. But I really just want a remote. There is nothing quite like controlling your media with an old-fashioned remote. It is always there and the batteries last like 10 years.&lt;/p&gt;
&lt;p&gt;Perhaps there are bluetooth remotes available? My Home Assistant instance is in the basement while the media center is on the first floor. So if I am able to find a bluetooth remote, there needs to be a way to forward all commands to my Home Assistant instance.&lt;/p&gt;
&lt;p&gt;Once that&#39;s done, it&#39;s just a matter of connecting the correct input with the correct output which would be fairly easy.&lt;/p&gt;
&lt;h2 id=&quot;solution-remote-hardware&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#solution-remote-hardware&quot; aria-label=&quot;Anchor link for: solution-remote-hardware&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Solution: Remote Hardware&lt;/h2&gt;
&lt;p&gt;After much searching, I came across the &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://amzn.to/3OGVINg&quot;&gt;Air Mouse Remote MX3 Pro with Backlit&lt;/a&gt;. It is not Bluetooth. I actually could not find a decent Bluetooth Remote. It does still use a 2.4ghz signal. It comes with a pre-paired USB dongle. Just plug it into a computer, and BOOM- the computer has a hardware keyboard device added.&lt;/p&gt;
&lt;p&gt;Another nice feature is it has 5 programmable IR buttons at the bottom for backup in the event something isn&#39;t working.&lt;/p&gt;
&lt;p&gt;There are many iterations of this remote. It seems to be a white labelled device and is just branded and repackaged by various companies. I did try several of them to try and find the best, but to be honest, they are all the same. I simply prefer the remote with the backlight versus without (although you do lose a button).&lt;/p&gt;
&lt;h2 id=&quot;problem-send-keypresses-to-home-assistant&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#problem-send-keypresses-to-home-assistant&quot; aria-label=&quot;Anchor link for: problem-send-keypresses-to-home-assistant&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Problem: Send keypresses to Home Assistant&lt;/h2&gt;
&lt;p&gt;Ok, so the next problem. The remote is plugged into my Kodi box (Manjaro) in the family room and my Home Assistant box is in the basement. How do I get keypresses from one to the other?&lt;/p&gt;
&lt;p&gt;I have played with USBIP in the past and, I don&#39;t like it very much. In my experience (and I am far from an expert), it works great until it doesn&#39;t. It doesn&#39;t really have a way to catch and recover from errors. It just wasn&#39;t the sort of stable, low maintenance solution I wanted (but that may have been an error on my part).&lt;/p&gt;
&lt;p&gt;After searching far and low, I came across the git:&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/tjntomas/MI-Bluetooth-Remote-for-Home-Assistant&quot;&gt;https://github.com/tjntomas/MI-Bluetooth-Remote-for-Home-Assistant&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It is a script for capturing a keyboard presses, and sending them to Home Assistsant so that each key_down and key_up event is converted to a Home Assistant event. From there, the hardware and &quot;wiring&quot; will be complete and it is a matter of using Home Assistant to create whatever series of automations for each key that your particular setup requires.&lt;/p&gt;
&lt;p&gt;To use it, follow the instructions on the original repo. You need to make sure python is installed and that the python evtest module is installed.&lt;/p&gt;
&lt;p&gt;The script wasn&#39;t perfect for me and so I made just a few changes. I wanted to specify the keyboard using a commandline argument since the remote I linked above creates three keyboard devices in linux. This is just easier that creating three seperate scripts. I also made sure that it would send the key code, along with the key name and type of press in the event data.&lt;/p&gt;
&lt;p&gt;The following is a fork of the original git repo with the above mentioned and some other changes.&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/jon6fingrs/Bluetooth-Remote-for-Home-Assistant/tree/main&quot;&gt;https://github.com/jon6fingrs/Bluetooth-Remote-for-Home-Assistant/tree/main&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here is my version of bt_remote_event.py:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;Script to listen to events from a bluetooth remote control and send&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;the events to Home Assistant.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;Author: Tomas Jansson, https://github.com/tjntomas&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;import&lt;/span&gt;&lt;span&gt; json&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;import&lt;/span&gt;&lt;span&gt; evdev&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt; # https://pypi.org/project/evdev/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;import&lt;/span&gt;&lt;span&gt; asyncio&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;import&lt;/span&gt;&lt;span&gt; aiohttp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;import&lt;/span&gt;&lt;span&gt; logging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;import&lt;/span&gt;&lt;span&gt; os&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;import&lt;/span&gt;&lt;span&gt; sys&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;# Set up logging and log levels.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;logging&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;basicConfig&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-12 z-i&quot;&gt;level&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span&gt;os&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span&gt;environ&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;LOGLEVEL&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;INFO&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;logging&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;getLogger&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;#39;asyncio&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;setLevel&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span&gt;logging&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span&gt;CRITICAL&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;BASE_API&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;      =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;http://IP_ADDRESS:8123/api/&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;  # URL to your HA instance.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DEV_INPUT&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;     =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;/dev/remote_&amp;quot;&lt;/span&gt;&lt;span&gt;             &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;API_KEY&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;       =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;API_KEY_STRING&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;HA_EVENT_NAME&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;bt_remote&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt; # Arbitrary name of the event that will get fired.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;GRAB_DEVICE&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;   =&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; True&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt; # If set to True, the devices will be locked to this script and the system will not receive any events.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;EVENT_PATH&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;    =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;events/&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; +&lt;/span&gt;&lt;span&gt; HA_EVENT_NAME&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;BASE_API_URL&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;  =&lt;/span&gt;&lt;span&gt; BASE_API&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; +&lt;/span&gt;&lt;span&gt; EVENT_PATH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;HEADERS&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;       =&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;#39;content-type&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;application/json&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;#39;Authorization&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;Bearer &lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt;{}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span&gt;API_KEY&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CMD&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;           =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;cmd&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CMD_TYPE&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;      =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;cmd_type&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CMD_NUM&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;       =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;cmd_num&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;EVENT_LOG_TEMPLATE&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Fired event &lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt;{}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; with event data&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt;{}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;async def&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; run&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;():&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  device&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span&gt; evdev&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;InputDevice&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span&gt;DEV_INPUT&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; +&lt;/span&gt;&lt;span&gt; sys&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-12 z-i&quot;&gt;argv&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;z-14 z-i&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;])&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-14 z-i&quot;&gt;  print&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;Using Bluetooth&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;z-9 z-i&quot;&gt; str&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span&gt;device&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;  if&lt;/span&gt;&lt;span&gt; GRAB_DEVICE&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    device&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;grab&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;  # Listen for events from the remote through the async-based evdev library.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;  for&lt;/span&gt;&lt;span&gt; event&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; in&lt;/span&gt;&lt;span&gt; device&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;read_loop&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;():&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;    if&lt;/span&gt;&lt;span&gt; event&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span&gt;type&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ==&lt;/span&gt;&lt;span&gt; evdev&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span&gt;ecodes&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span&gt;EV_KEY&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;:&lt;/span&gt;&lt;span&gt;   &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;      # Get the name of the remote key pressed, one of:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;      # KEY_HOME    &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;      # KEY_F5      &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;      # KEY_COMPOSE   &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;      # KEY_BACK       &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;      # KEY_UP          &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;      # KEY_DOWN   &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;      # KEY_LEFT      &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;      # KEY_RIGHT    &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;      # KEY_ENTER      &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;      # KEY_VOLUMEUP   &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;      # KEY_VOLUMEDOWN &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;      # The event string returned from the evdev library looks like this:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;      # key event at 1609103448.769025, 28 (KEY_ENTER), down&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;      # We are only interested in the key name &amp;quot;KEY_ENTER&amp;quot; and the keypress type &amp;quot;down&amp;quot;.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      cmd&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-9 z-i&quot;&gt; str&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span&gt;evdev&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;categorize&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span&gt;event&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)).&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;split&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;,&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;split&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;(&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;)&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      cmd_num&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-9 z-i&quot;&gt; str&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span&gt;evdev&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;categorize&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span&gt;event&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)).&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;split&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;,&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;split&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;(&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;      # Get the type of keypress, one of:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;      # up&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;      # down&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;      # hold&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      cmd_type&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-9 z-i&quot;&gt; str&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span&gt;evdev&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;categorize&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span&gt;event&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)).&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;split&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;,&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)[&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;      # Compose the payload to send to HA when firing the event.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      payload&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {&lt;/span&gt;&lt;span&gt;CMD&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;:&lt;/span&gt;&lt;span&gt; cmd&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;span&gt; CMD_TYPE&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;:&lt;/span&gt;&lt;span&gt; cmd_type&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;span&gt; CMD_NUM&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;:&lt;/span&gt;&lt;span&gt; cmd_num&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;      # Since the evdev library is async-based, we use async to send the event to HA.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;      async with&lt;/span&gt;&lt;span&gt; aiohttp&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;ClientSession&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; as&lt;/span&gt;&lt;span&gt; session&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        await&lt;/span&gt;&lt;span&gt; session&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span&gt;BASE_API_URL&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;z-12 z-i&quot;&gt; data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span&gt;json&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;dumps&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span&gt;payload&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;z-12 z-i&quot;&gt; headers&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span&gt;HEADERS&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        logging&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;info&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span&gt;EVENT_LOG_TEMPLATE&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span&gt;HA_EVENT_NAME&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;span&gt;payload&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        await&lt;/span&gt;&lt;span&gt; session&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;if&lt;/span&gt;&lt;span&gt; __name__&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ==&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;__main__&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;    # Create, start and gracefully shut down the asyncio event loop.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    loop&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span&gt; asyncio&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;new_event_loop&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    asyncio&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;set_event_loop&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span&gt;loop&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;    try&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        loop&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;run_until_complete&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;())&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;    finally&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        loop&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;run_until_complete&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span&gt;loop&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;shutdown_asyncgens&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;())&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        loop&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;()&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So, first we need to figure out what our keyboards are with a tool called evtest. On Ubuntu, it can be installed with:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; apt install evtest&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will list the name and location of all connected input devices, like the following:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;No device specified, trying to scan all of /dev/input/event*&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;Not running as root, no devices may be available.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;Available devices&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;/dev/input/event0&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Sleep Button&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;/dev/input/event1&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Power Button&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;/dev/input/event10&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Dell WMI hotkeys&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;/dev/input/event11&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Video Bus&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;/dev/input/event12&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; DP-1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;/dev/input/event13&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; HDA Intel PCH Headphone Mic&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;/dev/input/event14&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; HDA Intel PCH Front Line Out&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;/dev/input/event15&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; HDA Intel PCH HDMI/DP,pcm=3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;/dev/input/event16&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; HDA Intel PCH HDMI/DP,pcm=7&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;/dev/input/event17&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; HDA Intel PCH HDMI/DP,pcm=8&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;/dev/input/event18&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ydotoold virtual device&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;/dev/input/event2&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Power Button&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;/dev/input/event3&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; flirc.tv flirc Keyboard&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;/dev/input/event4&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; 2.4G Composite Devic&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;/dev/input/event5&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; 2.4G Composite Devic Mouse&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;/dev/input/event6&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; 2.4G Composite Devic Consumer Control&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;/dev/input/event7&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; 2.4G Composite Devic System Control&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;/dev/input/event8&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Pulse-Eight USB-CEC Adapter&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;/dev/input/event9&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; PC Speaker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;Select the device event number [0-18]&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &quot;four&quot; devices which represent my remote are:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;/dev/input/event4&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; 2.4G Composite Devic&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;/dev/input/event5&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; 2.4G Composite Devic Mouse&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;/dev/input/event6&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; 2.4G Composite Devic Consumer Control&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;/dev/input/event7&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; 2.4G Composite Devic System Control&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The devices at 4, 6, and 7 represent the keyboards. The remote also can toggle into a gyroscopic mouse. This actually works out great for me since it is connected directly to my kodi box, so even though we will continue with the complicated setup that prevents the keyboards from directly interacting with the system, the mouse will still work if desired.&lt;/p&gt;
&lt;p&gt;Anyway, if you try to access one of these devices, you will get:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Testing ... (interrupt to exit)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;***********************************************&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  This device is grabbed by another process.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  No events are available to evtest while the&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  other grab is active.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  In most cases, this is caused by an X driver,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  try VT-switching and re-run evtest again.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Run the following command to see processes with&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  an open fd on this device&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &amp;quot;fuser -v /dev/input/event6&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;***********************************************&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Ok, so there are two things we have to accomplish.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;li&gt;we need to deactivate the devices
&lt;/li&gt;
&lt;li&gt;&lt;li&gt;we need to give each device a stable name (eventX could change)
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Luckily, there is one solution to accomplish both of these things- udev! I have added an example udev rule to my above linked git.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SUBSYSTEMS==&amp;quot;input&amp;quot;, ATTRS{name}==&amp;quot;keyboard name from evtest&amp;quot;, ENV{LIBINPUT_IGNORE_DEVICE}=&amp;quot;1&amp;quot;, SYMLINK+=&amp;quot;remote_abc&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Each device will need its own file. Maybe it could be done with one, but I am not an expert, I did it with three. It is a one time procedure and then you forget about it. If you have a nice way to accomplish the same with one file, however, please let me know.&lt;/p&gt;
&lt;p&gt;Anyway, my subsequent three files will look like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SUBSYSTEMS==&amp;quot;input&amp;quot;, ATTRS{name}==&amp;quot;2.4G Composite Devic Consumer Control&amp;quot;, ENV{LIBINPUT_IGNORE_DEVICE}=&amp;quot;1&amp;quot;, SYMLINK+=&amp;quot;remote_consumer&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SUBSYSTEMS==&amp;quot;input&amp;quot;, ATTRS{name}==&amp;quot;2.4G Composite Devic System Control&amp;quot;, ENV{LIBINPUT_IGNORE_DEVICE}=&amp;quot;1&amp;quot;, SYMLINK+=&amp;quot;remote_system&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SUBSYSTEMS==&amp;quot;input&amp;quot;, ATTRS{name}==&amp;quot;2.4G Composite Devic&amp;quot;, ENV{LIBINPUT_IGNORE_DEVICE}=&amp;quot;1&amp;quot;, SYMLINK+=&amp;quot;remote_keyboard&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For the symlink portion, keep &quot;remote_&quot; the same or else it will need to be changed in the script, but you can make the string after the underscore whatever you want. I chose remote_consumer, remote_system, and remote_keyboard just so I could remember which was which.&lt;/p&gt;
&lt;p&gt;Ok so those three files can be named whatever (99-ignore-my device-whatever.rules) and they should be placed in /etc/udev/rules.d.&lt;/p&gt;
&lt;p&gt;You can restart your system or enter the following command as root to activate the new rules:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;udevadm&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; control --reload-rules&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; udevadm&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; trigger&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, when you try and use evtest, it will be able to capture any of the three keyboards.&lt;/p&gt;
&lt;p&gt;There are now a few modifications you have to make to the script so that it works for your setup.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;li&gt;change the BASE_API to point to your instance&#39;s API endpoint
&lt;/li&gt;
&lt;li&gt;&lt;li&gt;from home assistant, create a long-lasting token and paste it in the API_KEY
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;So now, you could run the script to control one keyboard at a time and have each click send to home assistant by typing:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;python3&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  /path_to_your_script/bt_remote_event.py %i&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The argument is whatever keywords you decided to use after &quot;remote_&quot;. For example &quot;bt_remote_event.py keyboard&quot; and it will run the script for the &quot;keyboard&quot; device.&lt;/p&gt;
&lt;p&gt;One caveat to what we have done so far, even though the three keyboards are not being used by the system, the power button on the remote will still trigger whatever action your computer typically triggers when its power button is pressed. Therefore, I used the option in Gnome to disable the power button. This does have the consequence of even disabling the button on the PC itself, but that is not an issue for me. I am not sure if there is a way to only disable the power button only from the remote.&lt;/p&gt;
&lt;p&gt;So now with the keyboard script running, you should be able to go into your home assistant instance, the developer&#39;s tools, events, and listen for the &quot;bt_remote&quot; events.&lt;/p&gt;
&lt;p&gt;Hopefully you see your button presses and notice each press gives you two events:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;event_type&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; bt_remote&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  cmd&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; KEY_HOMEPAGE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  cmd_type&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; down&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  cmd_num&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;172&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;origin&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; REMOTE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;time_fired&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;2024-02-11T19:53:40.964943+00:00&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; sdfgsdfgsdfgsdfgsd&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  parent_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-11&quot;&gt; null&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  user_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; sdfgsdfgsdfgsdfgsd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;event_type&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; bt_remote&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  cmd&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; KEY_HOMEPAGE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  cmd_type&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; up&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  cmd_num&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;172&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;origin&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; REMOTE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;time_fired&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;2024-02-11T19:53:41.026000+00:00&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; sdfgsdfgsdfgsdfgsdfgsdgsdf&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  parent_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-11&quot;&gt; null&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  user_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ddsfgsdfgsdfgsdfgsdfgsdfg&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Each button will give you its down and then up events separately, and each even will give the key name, the button direction, and the raw key code. I added the key code because, for my setup, knowing the keycode was helpful for some subsequent actions.&lt;/p&gt;
&lt;p&gt;Great so now that we know it works, how can we exit the running bt_remote_event script. We have to set up three scripts and make sure they start automatically. In the git repository, you should see btmon@.service. This will allow us to capture all three devices.&lt;/p&gt;
&lt;p&gt;First, copy it to /etc/systemd/system/&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; cp btmon@.service /etc/systemd/system/&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now you simply enable it three times for the three devices we named earlier:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; systemctl enable --now btmon@consumer.service&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; systemctl enable --now btmon@system.service&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; systemctl enable --now btmon@keyboard.service&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Perfect! Now all those presses are headed straight for Home Assistant. The PC where the USB is physically plugged can be restarted and the scripts will pick up where its left off.&lt;/p&gt;
&lt;h2 id=&quot;solution-represent-keypresses-in-home-assistant&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#solution-represent-keypresses-in-home-assistant&quot; aria-label=&quot;Anchor link for: solution-represent-keypresses-in-home-assistant&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Solution: Represent Keypresses in Home Assistant&lt;/h2&gt;
&lt;p&gt;Ok, so now Home Assistant is getting all those key press events, but so what? I wanted a way to have a single press and a long press. The long press shouldn&#39;t set off the single press, and the single press shouldn&#39;t be more delayed than absolutely necessary.&lt;/p&gt;
&lt;p&gt;First, I made a trigger based binary sensor to more easily display the button presses and the necessary information:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; trigger&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; platform&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; event&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        event_type&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; bt_remote&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        event_data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          cmd_type&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;down&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;on&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; platform&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; event&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        event_type&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; bt_remote&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        event_data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          cmd_type&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;up&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;off&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    binary_sensor&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote_button_press&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.id }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        attributes&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          button&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.event.data.cmd }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          code&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.event.data.cmd_num }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          timestamp_up&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {% if trigger.id == &amp;#39;off&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;              {{ as_timestamp( trigger.event.time_fired)|float(default=0) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;              {{ this.attributes.timestamp_up|float(default=0) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          timestamp_down&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {% if trigger.id == &amp;#39;on&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;              {{ as_timestamp( trigger.event.time_fired)|float(default=0) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;              {{ this.attributes.timestamp_down|float(default=0) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          pressed_duration&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {% if trigger.id == &amp;#39;on&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;              0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;              {{ as_timestamp( trigger.event.time_fired)|float(default=0) - (this.attributes.timestamp_down)|float(default=0) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {% endif %}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This creates a single binary_sensor. It is on during the time the button is pressed down, and off when it is released, so off the vast majority of the time. However, in its attributes, it has the current or last key and code pressed, but also the amount of time the key was pressed down in seconds (0 if the keys is pressed down at that moment). This has created a very easy system to make automations.&lt;/p&gt;
&lt;p&gt;Now, as you probably guessed, to set everything up correctly, to identify each button and decide what you want it to do, it takes time. There also is not a one size fits all solution.&lt;/p&gt;
&lt;p&gt;However, I will show examples of what I have done in case it can help anyone else.&lt;/p&gt;
&lt;h2 id=&quot;respond-to-key-presses&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#respond-to-key-presses&quot; aria-label=&quot;Anchor link for: respond-to-key-presses&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Respond to key presses&lt;/h2&gt;
&lt;p&gt;So I essentially have two automations. One for single presses and one for double presses.&lt;/p&gt;
&lt;p&gt;The single press is actually triggered when our binary_sensor goes off, meaning that someone has just released a button. I have chosen a hold time of 0.5 seconds to represent a button hold. Anything shorter is a single press, and longer is a hold. Therefore, for this automation, I want to make sure we only act if the button was released before the hold automation is activated.&lt;/p&gt;
&lt;p&gt;The following is my trigger and condition:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;alias&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; kodi remote&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;description&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;trigger&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; platform&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; binary_sensor.remote_button_press&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    from&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;on&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    to&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;off&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; numeric_state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; binary_sensor.remote_long_press&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    attribute&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; pressed_duration&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    below&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0.5&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then I just have a giant choose between 30 actions. Again, it will be different for everyone, but I will show it before to highlight a couple things:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; choose&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_POWER&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; choose&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;              -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; binary_sensor.vizio_tv_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;on&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.all_off&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            default&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;              -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; if&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; select.harmony_hub_2_activities&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; power_off&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                then&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; select.select_option&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; select.harmony_hub_2_activities&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      option&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Watch Kodi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                else&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      num_repeats&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      delay_secs&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0.4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      hold_secs&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      device&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Vizio TV&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      command&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; PowerOn&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_VOLUMEUP&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.volume_up&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.family_room_tv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            enabled&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; false&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.increase_tv_volume_x1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_VOLUMEDOWN&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.volume_down&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.family_room_tv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            enabled&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; false&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.decrease_tv_volume_x1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_PLAYPAUSE&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; choose&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;              -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.family_room_speaker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; playing&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; not&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.family_room_tv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                          -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; paused&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                          -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; playing&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.media_play_pause&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.family_room_speaker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            default&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;              -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.media_play_pause&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                  entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.family_room_speaker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_PREVIOUSSONG&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; choose&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;              -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.family_room_speaker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; playing&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; not&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.family_room_tv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                          -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; paused&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                          -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; playing&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.media_previous_track&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.family_room_speaker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            default&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;              -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.media_previous_track&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                  entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                    -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.family_room_tv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                  device_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                  area_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_NEXTSONG&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; choose&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;              -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.family_room_speaker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; playing&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; not&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.family_room_tv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                          -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; paused&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                          -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; playing&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.media_next_track&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.family_room_speaker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            default&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;              -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.media_next_track&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                  entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                    -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.family_room_tv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                  device_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                  area_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_CONFIG&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; choose&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;              -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; select.harmony_hub_2_activities&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Watch Kodi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; if&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; binary_sensor.vizio_tv_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;off&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    then&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          num_repeats&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          delay_secs&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0.4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          hold_secs&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          device&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Vizio TV&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          command&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; PowerOn&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; delay&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          hours&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          minutes&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          seconds&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          milliseconds&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 200&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          device&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Vizio Amp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          command&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; InputOptical&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; delay&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          hours&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          minutes&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          seconds&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 15&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          milliseconds&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      num_repeats&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      delay_secs&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0.4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      hold_secs&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      device&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Vizio TV&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      command&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; InputHdmi5&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            default&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;              -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; select.select_option&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                  entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; select.harmony_hub_2_activities&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                  option&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Watch Kodi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_MAIL&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; choose&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;              -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; select.harmony_hub_2_activities&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Watch Roku&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; if&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; binary_sensor.vizio_tv_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;off&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    then&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          num_repeats&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          delay_secs&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0.4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          hold_secs&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          device&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Vizio TV&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          command&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; PowerOn&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; delay&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          hours&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          minutes&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          seconds&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          milliseconds&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 200&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          device&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Vizio Amp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          command&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; InputOptical&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; delay&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          hours&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          minutes&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          seconds&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 15&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          milliseconds&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      num_repeats&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      delay_secs&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0.4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      hold_secs&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      device&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Vizio TV&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      command&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; InputHdmi3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            default&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;              -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; select.select_option&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                  entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; select.harmony_hub_2_activities&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                  option&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Watch Roku&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_WWW&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; choose&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;              -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; select.harmony_hub_2_activities&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Watch Apple TV&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; if&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; binary_sensor.vizio_tv_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;off&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    then&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          num_repeats&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          delay_secs&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0.4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          hold_secs&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          device&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Vizio TV&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          command&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; PowerOn&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; delay&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          hours&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          minutes&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          seconds&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          milliseconds&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 200&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          device&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Vizio Amp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          command&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; InputOptical&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; delay&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          hours&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          minutes&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          seconds&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 15&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          milliseconds&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      num_repeats&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      delay_secs&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0.4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      hold_secs&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      device&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Vizio TV&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      command&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; InputHdmi2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            default&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;              -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; select.select_option&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                  entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; select.harmony_hub_2_activities&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                  option&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Watch Apple TV&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_BACK&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_back&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_UP&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_up&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_DOWN&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_down&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_LEFT&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_left&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_RIGHT&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_right&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_ENTER&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_enter&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_HOMEPAGE&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_home&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_FASTFORWARD&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_fastforward&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_REWIND&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_rewind&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_COMPOSE&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_info&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_SEARCH&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_search&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_ZOOMIN&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_toggle_subtitles&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_ZOOMOUT&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_audio_track&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_PAGEDOWN&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_page_down&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_PAGEUP&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_page_up&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;    {{ trigger.to_state.attributes.button.split(&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;)[1]|length == 1 }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_letter&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              key_pressed&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {{ trigger.to_state.attributes.button.split(&amp;quot;_&amp;quot;)[1]|lower }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_BACKSPACE&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_backspace&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_SPACE&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_space&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              key_pressed&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 57&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_ESC&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_gen_button&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              key_pressed&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_DOT&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_gen_button&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              key_pressed&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 52&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_COMMA&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_gen_button&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              key_pressed&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 51&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The majority of my actions involve identifying the button by name by matching to one of the binary sensor&#39;s attributes. Then I usually call for a script just to make things a little cleaner. There is some logic in this spiderweb too. It really just depends and I&#39;m sorry I can&#39;t make this cleaner.&lt;/p&gt;
&lt;p&gt;I want to point out one of the options though. The back of the remote has a keyboard! Wouldn&#39;t it be great to use it? I really don&#39;t want to make an option for every letter in the alphabet. Instead, I made a single option to capture anytime the key name is a single letter:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;    {{ trigger.to_state.attributes.button.split(&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;)[1]|length == 1 }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_letter&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              key_pressed&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {{ trigger.to_state.attributes.button.split(&amp;quot;_&amp;quot;)[1]|lower }}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will send the letter by itself to a special script I have which sends the letter wherever its needed depending on what device I am using. For single presses it is always a lower case letter, and as you will see, for long presses it is an upper case letter.&lt;/p&gt;
&lt;p&gt;The long press automation is a little different. There are two situations to consider. One is a long press for something like volume. You want it to continue raising or lowering the volume as long as you are pressing it. Second is a long press which is simply a way to use the same button for a second action. In that case, we want it to perform a single action and then stop.&lt;/p&gt;
&lt;p&gt;The automation is somewhat similarly triggered:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;platform&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; binary_sensor.remote_button_press&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  hours&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  minutes&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  seconds&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0.5&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;off&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;on&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And my action block is in a repeat action and will continue to repeat, unless stopped, as long as the button remains &quot;on&quot; (pressed), and will stop when it is &quot;off&quot; released.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;repeat&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;    -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; choose&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_VOLUMEUP&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.increase_tv_volume_x1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_VOLUMEDOWN&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.decrease_tv_volume_x1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_PLAYPAUSE&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; choose&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                    -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.family_room_speaker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; playing&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                    -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; not&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.family_room_tv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                            -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; paused&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                            -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; playing&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                  sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                    -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.media_stop&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                          -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.family_room_speaker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              default&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_stop&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                  data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; stop&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_UP&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_up&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_DOWN&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_down&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_LEFT&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_left&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_RIGHT&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_right&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_FASTFORWARD&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_fastforward&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_REWIND&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_rewind&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_ZOOMIN&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_switch_subtitles&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; stop&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_ZOOMOUT&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.volume_mute&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.family_room_tv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                is_volume_muted&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; false&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; stop&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;    {{ trigger.to_state.attributes.button.split(&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;)[1]|length == 1 }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_letter&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                key_pressed&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {{ trigger.to_state.attributes.button.split(&amp;quot;_&amp;quot;)[1] }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; stop&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_COMPOSE&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_menu&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; stop&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_BACKSPACE&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; choose&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                    -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; sensor.active_player&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.apple_tv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                  sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                    -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; shell_command.pyatv_root&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        command&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; text_clear&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                    -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; stop&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              default&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_gen_button&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                  data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    key_pressed&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 14&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_PAGEDOWN&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_page_down&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_PAGEUP&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_page_up&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_WWW&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; choose&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                    -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; select.harmony_hub_2_activities&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Play Nintendo&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                  sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                    -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; if&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; binary_sensor.vizio_tv_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;off&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      then&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                            entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                          data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                            num_repeats&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                            delay_secs&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0.4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                            hold_secs&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                            device&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Vizio TV&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                            command&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; PowerOn&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; delay&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                            hours&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                            minutes&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                            seconds&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 15&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                            milliseconds&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                    -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                      data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        num_repeats&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        delay_secs&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0.4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        hold_secs&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        device&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Vizio TV&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                        command&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; InputHdmi4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              default&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;                -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; select.select_option&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                  target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; select.harmony_hub_2_activities&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                  data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                    option&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Play Nintendo&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; stop&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_CONFIG&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; automation.trigger&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              metadata&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                skip_condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; true&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;                entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; automation.turn_on_family_room_speaker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; stop&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ trigger.to_state.attributes.button == &amp;#39;KEY_ENTER&amp;#39; }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.kodi_remote_return&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;            -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; stop&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;    -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; delay&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        hours&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        minutes&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        seconds&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        milliseconds&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 100&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  while&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;    -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;      entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; binary_sensor.remote_long_press&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;      state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;on&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I added a short delay in the loop to make sure the button presses weren&#39;t being sent too quickly. You can see also that some of the actions are followed by a &quot;stop&quot; action when they are intended to run as a one-and-done action. Otherwise, the action will continue to repeat until the button is released.&lt;/p&gt;
&lt;h2 id=&quot;summary&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#summary&quot; aria-label=&quot;Anchor link for: summary&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Summary&lt;/h2&gt;
&lt;p&gt;So, at this point, we have a 2.4ghz remote. The button presses are ignored by the host system and sent to home assistant as events. Home assistant then distinguished between long and short presses and enacts whatever action is necessary. Obviously, these buttons don&#39;t have to only act on my media center. The buttons can control anything in the house.&lt;/p&gt;
&lt;p&gt;My setup basically allows the remote to work as intended based on what is playing on TV. That way, nobody ever has to switch inputs or profiles or whatever. It just works. I have noticed that my family gravitates towards it even instead of the harmony remotes. I have been very pleased with it so far which is why I wanted to share.&lt;/p&gt;
&lt;p&gt;In the future, I can give examples of how I send the commands (including keyboard presses) seemlessly to kodi, roku, or apple tv. Those (especially apple tv) were tricky to figure out.&lt;/p&gt;
&lt;p&gt;On a different kodi box, I have a separate remote set up and just have it send the keypresses back. That way, only the keys I want to modify are modified by home assistant while the remote buttons otherwise work for the kodi box just like they would without all this complicated work around.&lt;/p&gt;
&lt;p&gt;I&#39;m sure there are many more possibilities and would be excited to see what other people come up with.&lt;/p&gt;
&lt;h2 id=&quot;links&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#links&quot; aria-label=&quot;Anchor link for: links&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Links&lt;/h2&gt;
&lt;p&gt;Air Mouse Remote MX3 Pro with Backlit&lt;/p&gt;
&lt;p&gt;Associate Link - &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://amzn.to/487vXMU&quot;&gt;https://amzn.to/487vXMU&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Store Link - &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.amazon.com/gp/product/B08YRL56BT&quot;&gt;https://www.amazon.com/gp/product/B08YRL56BT&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Rii MX3 Multifunction&lt;/p&gt;
&lt;p&gt;Associate Link - https://amzn.to/3OGErnr&lt;/p&gt;
&lt;p&gt;Store Link - https://www.amazon.com/gp/product/B01CL3ZXGO&lt;/p&gt;
</description>
      </item>
      <item>
          <title>Create a FREE public endpoint for self-hosted services using Oracle Cloud and OPNsense</title>
          <pubDate>Thu, 15 Sep 2022 00:00:00 +0000</pubDate>
          <author>thehelpfulidiot</author>
          <link>https://thehelpfulidiot.com/create-a-free-public-endpoint-for-self-hosted-services-using-oracle-cloud-and-opnsense/</link>
          <guid>https://thehelpfulidiot.com/create-a-free-public-endpoint-for-self-hosted-services-using-oracle-cloud-and-opnsense/</guid>
          <description xml:base="https://thehelpfulidiot.com/create-a-free-public-endpoint-for-self-hosted-services-using-oracle-cloud-and-opnsense/">&lt;h2 id=&quot;introduction&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#introduction&quot; aria-label=&quot;Anchor link for: introduction&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Introduction&lt;/h2&gt;
&lt;p&gt;As many of you (the people who would be interested enough to read this post), I have a number of self hosted services which have become integral to my everyday life. For the most part, I use a wireguard (split) tunnel to access these services remotely from my phone or laptop. However, there are some services, like Nextcloud, for which I prefer public access so that I can access them from any computer. Up till now, I have opened port 443 on my router and forwarded incoming traffic to an instance of Nginx Proxy Manager. This has been working fine for the most part, but I have a residential ISP with a dynamic IP address. Even though I have my incoming connections go through my OPNsense router with crowdsec and geo block lists, I just never liked the idea of opening ports on my router.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/09/original-network-layout.png&quot; alt=&quot;Original Network Layout&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Original Network Layout&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;To solve this, I became enamored with the idea of setting up a public IP address on a VPS which would send the connection requests to my NPM instance through a wireguard tunnel.&lt;/p&gt;
&lt;p&gt;There are plenty of tutorials how to forward connections through Wireguard, and there is an &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/mochman/Bypass_CGNAT&quot;&gt;amazing tool&lt;/a&gt; to do almost exactly what I described. However, the tool requires a linux endpoint on the local network as opposed to sending all connections to OPNsense. My ideal plan would have the VPS connections first passing through OPNsense where they could be acted upon as any other incoming connection.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/09/oracle-cloud-layout.png&quot; alt=&quot;New Network Layout&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;New Network Layout&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;So ultimately, at the end of this tutorial, we will have a static IP address through a free oracle cloud virtual machine. It will forward whichever connections we want to OPNsense. I&#39;m sure this could be configured as a VPN endpoint for all connections if desired, but that won&#39;t be covered here.&lt;/p&gt;
&lt;h2 id=&quot;oracle-cloud&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#oracle-cloud&quot; aria-label=&quot;Anchor link for: oracle-cloud&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Oracle Cloud&lt;/h2&gt;
&lt;p&gt;Ok, so first thing we need to do is set up our virtual machine on the Oracle Cloud platform.&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.oracle.com/cloud/&quot;&gt;https://www.oracle.com/cloud/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Oracle has a free tier and &quot;Always Free Resources&quot;. Obviously, they could always take these free resources as many cloud providers eventually do, but lets hope if it happens, it doesn&#39;t happen for a while.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/09/ampere-a1-compute.png&quot; alt=&quot;Always free VM&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Always free VM&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;So first step, create an account.&lt;/p&gt;
&lt;p&gt;Instead of going straight to making a new compute instance, I had to make a &quot;compartment&quot;. I think that&#39;s how the compute instances are clustered. To be honest, I am not sure that I actually needed to make a new compartment but had trouble getting my machine set up without it.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/09/compartments.png&quot; alt=&quot;From the top left hamburger menu, go to Compartments.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;From the top left hamburger menu, go to Compartments.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;From there, create a new compartment. Name it whatever you want, and for parent compartment, select your root.&lt;/p&gt;
&lt;p&gt;Next click on the big Oracle Cloud image top left to go back to the main page. Now we will set up our compute instance.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/09/instances-compute.png&quot; alt=&quot;Click Instances&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Click Instances&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Click the &quot;Create Instsance&quot; button.&lt;/p&gt;
&lt;p&gt;On the next page, we will set up our machine and make sure to select options which are part of the &quot;Always Free&quot; subscription.&lt;/p&gt;
&lt;p&gt;Under &quot;create in compartment,&quot; be sure to select the compartment we just set up.&lt;/p&gt;
&lt;p&gt;Keep the defaults for Placement.&lt;/p&gt;
&lt;p&gt;Now for Image &amp;amp; Shape, we will change some options. For the purposes of this tutorial, I will use the Ubuntu image. It&#39;s free and it&#39;s what I am familiar with.&lt;/p&gt;
&lt;p&gt;Under Shape Series, select &quot;Ampere&quot; and let&#39;s max out our machine specs under the Free Tier.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/09/oracle-cloud-shape.png&quot; alt=&quot;Free tier specs&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Free tier specs&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Click select shape and proceed. Keep networking options as default.&lt;/p&gt;
&lt;p&gt;Be sure to save your SSH key! It will be the only way to log in to your machine. Then leave the boot volume as default and we are done setting up our machine!&lt;/p&gt;
&lt;p&gt;Now back at the instances screen, you should see your new instance along with its public IP address and its internal IP address. We will use the public IP address to SSH in, but first lets adjust the firewall settings.&lt;/p&gt;
&lt;p&gt;Click on your instance name. Under &quot;Primary VNIC&quot;, then subnet, there should be a hyperlink to the subnet your machine is using. Click on it. Scroll down and click on the default security list. I erased all of the default firewall rules and replaced them with a rule to allow all traffic as we can just rely on ufw to protect our  machine.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/09/ingress-rules.png&quot; alt=&quot;Open Ingress Rules&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Open Ingress Rules&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Ok perfect, now lets get into our machine. We are going to use the Public IP address to SSH in to our server and get to work. Find your Private SSH key and add it to your ~/.ssh directory. Set the permissions for the key to 600. Now you can access your server with the following:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;ssh&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -i /ssh/directory/private.key ubuntu@PUBLIC-IP&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Install Wireguard with the following:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; apt update&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; apt install wireguard&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now create a public and private wireguard key.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;wg&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; genkey&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; tee /etc/wireguard/private.key&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; chmod go= /etc/wireguard/private.key&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; cat /etc/wireguard/private.key&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; wg&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; pubkey&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; tee /etc/wireguard/public.key&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Make note of those keys as we will need them. Now we can start setting up our Wireguard server configurtion.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; nano /etc/wireguard/wg0.conf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And use the following:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;Interface&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;PrivateKey&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span&gt; {{private key you just generated}}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;ListenPort&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span&gt; 51820&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;#(any port above here)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;Address&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span&gt; 10.1.0.1/24&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;#(an address from a different subnet from your private LAN)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;MTU&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span&gt; 1420&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;PostUp&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span&gt; iptables -A FORWARD -i enp0s3 -j ACCEPT&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;; iptables -t nat -A POSTROUTING -o wg0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;PostDown&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span&gt; iptables -D FORWARD -i enp0s3 -j ACCEPT&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;; iptables -t nat -A POSTROUTING -o wg0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;#enp0s3 is whatever your virtual machines main interface is called&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;Peer&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;PublicKey&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span&gt; {{ we do not have this yet }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;AllowedIPs&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span&gt; 10.1.0.0/24, {{address of npm/32}}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;PersistentKeepalive&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span&gt; 25&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now let&#39;s make sure we have forwarding set up in our Oracle machine. We are going to edit sysctl.conf. First open it.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; nano /etc/sysctl.conf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add the following two lines:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;net.ipv4.ip_forward&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;net.ipv6.conf.all.forwarding&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then enter the following command or reboot:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; sysctl -p&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Almost ready to move over to the OPNsense side of things. Let&#39;s just set up our firewall before we forget.&lt;/p&gt;
&lt;p&gt;We will use ufw which is included in the ubuntu image.&lt;/p&gt;
&lt;p&gt;Add ssh port:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ufw allow 22/tcp&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Https port:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ufw allow 443/tcp&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Wireguard port (change as necessary):&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ufw allow 51820/udp&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then enable the firewall:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ufw enable&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And check the status to make sure we are secured:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ufw status&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and we should see something like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Status: active&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;To                         Action      From&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;--                         ------      ----&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;22/tcp                     ALLOW       Anywhere                  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;51820/udp                  ALLOW       Anywhere                  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;443/tcp                    ALLOW       Anywhere   &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Ok perfect. Let&#39;s change our attention to OPNsense.&lt;/p&gt;
&lt;h2 id=&quot;opnsense&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#opnsense&quot; aria-label=&quot;Anchor link for: opnsense&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
OPNsense&lt;/h2&gt;
&lt;p&gt;This part only requires a few things but took me DAYS of neglecting my family and responsibilities to figure it out. I was pointed in the right direction &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://forum.opnsense.org/index.php?topic=27413.msg133370#msg133370&quot;&gt;here&lt;/a&gt;. Like I said, I already have a Wireguard server set up on my OPNsense box, and was trying to incorporate this new client in that network. That proved to be impossible- at least for me. Then it struck me- I would just make a NEW wireguard network on the OPNsense machine, and this one would act as a client instead of a server as I had initially thought it would.&lt;/p&gt;
&lt;p&gt;So if you haven&#39;t already, install either the wireguard-go or wireguard-kmod package on your OPNsense box.&lt;/p&gt;
&lt;p&gt;Go to the Wireguard menu and then the Endpoints tab. Create a new endpoint and fill it out like so:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/09/WIREGUARD-ENDPOINT-OPNSENSE.png&quot; alt=&quot;Wireguard OPNsense Endpoint&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Wireguard OPNsense Endpoint&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Now switch to the Local tab and create a new entry like so:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/09/local-config-opnsense.png&quot; alt=&quot;OPNsense local configuration&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;OPNsense local configuration&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Make sure advanced options are checked. Call it whatever you want, set an MTU (I think?). Enter what this client&#39;s IP address will be. Since our VPS is 10.1.0.1, I chose 10.1.0.2 for this client, and make sure to use the /24 subnet. Select your previously made endpoint under peers. MAKE SURE TO CLICK DISABLE ROUTES. Otherwise when you initiate the connection, the routing tables will be edited to try and send all traffic through the Wireguard network. Then make sure to enter the VPS Wireguard IP address for the Gateway.&lt;/p&gt;
&lt;p&gt;There is no private or public key but after you click save and reopen the entry, you should see that populate. Take the Public Key, go back to our wg0.conf from the VPS and add the public key as indicated earlier under the &quot;[Peer]&quot; section.&lt;/p&gt;
&lt;p&gt;Now, on our VPS, you can bring up the wg0 interface by entering the following:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; wg-quick up wg0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can also set it to start at boot and enable with:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; systemctl enable --now wg-quick@wg0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Back to OPNsense...&lt;/p&gt;
&lt;p&gt;Turn Wireguard on and off from OPNsense. Now lets give it an interface so we can more easily manipulate the connection and create firewall rules. Go to Interface --&amp;gt; Assignments. There should be an option at the bottom to add a new interface and one of the interfaces from the dropdown menu should be the new Wireguard connection (wg0) and call it whatever you want.&lt;/p&gt;
&lt;p&gt;After refreshing the page, the new VPS/Wireguard interface should be listed in the Interfaces section.&lt;/p&gt;
&lt;p&gt;Click on it, make sure it is enabled, and click Promiscuous mode, save.&lt;/p&gt;
&lt;p&gt;Ok almost done. Now we&#39;ll just go down the line and add the settings necessary for our VPS to act as the external gateway we want.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/09/gateway.png&quot; alt=&quot;New gateway&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;New gateway&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Change the settings to match what I have above. The IP address should be the IP address of the Wireguard interface on the VPS.&lt;/p&gt;
&lt;p&gt;Next, the connection we receive on port 443, will be forwarded to the OPNsense router on that same interface. We will go to the Port Forwarding tab and create a rule to forward that connection to wherever our NPM instance is. However, aside from the usual port forwarding rule, we are going to make two changes.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Add something to &quot;Set local tag&quot;. I just put &quot;oracle&quot;. It doesn&#39;t matter what you pick.&lt;/li&gt;
&lt;li&gt;For &quot;Filter Rule Association&quot;, change it to &quot;none&quot;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Now we will move on to the firewall rules for our new VPS/Wireguard interface. Currently, without any rules, all traffic will be blocked. I only have two rules:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Allow 443 traffic to the NPM instance.&lt;/li&gt;
&lt;li&gt;Allow communication between clients on our interface subnet&lt;/li&gt;
&lt;li&gt;Geo-block IPs if desired&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/09/firewall.png&quot; alt=&quot;VPS/Wireguard interface firewall rules&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;VPS/Wireguard interface firewall rules&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I also included the same &quot;set local tag&quot; directive with &quot;oracle&quot; to both of those above Pass rules. Not sure if that is necessary, but I figured it wouldn&#39;t hurt. Basically, I want anything that comes in through this interface to leave through it.&lt;/p&gt;
&lt;p&gt;Finally, we will tell the router how to send the packets back out through the VPS as opposed to leaving through our regular gateway.&lt;/p&gt;
&lt;p&gt;Go to the interface where your NPM instance is. Make a new firewall rule. This time, however, instead of choosing &quot;in&quot; for the direction, choose &quot;out&quot;. Then we can leave everything alone and just make a few changes under the &quot;Advanced&quot; section.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/09/firewall-out-rule.png&quot; alt=&quot;Firewall &amp;quot;out&amp;quot; rule&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Firewall &quot;out&quot; rule&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;There are three things to do here.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;select allow options&lt;/li&gt;
&lt;li&gt;change the reply-to gateway to the gateway we just created&lt;/li&gt;
&lt;li&gt;match local tag to whatever you used in the previous rules. Mine is &quot;oracle&quot;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You can be more specific if you want, but the traffic we are interested in is already tagged so I think the firewall rule is likely fine how it is. Now the firewall will know to reply back to our VPS and not through Verizon or Comcast or whatever.&lt;/p&gt;
&lt;p&gt;At this point, I would probably restart the VPS and then take the Wireguard service down and then up to make sure that all our new rules are working and activated.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#conclusion&quot; aria-label=&quot;Anchor link for: conclusion&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Conclusion&lt;/h2&gt;
&lt;p&gt;If everything worked the way it should, you should now be able to set the DNS records for your web services to point to the public IP address of your VPS. Supposedly, this will remain free forever but of course that remains to be seen. Not sure if this really makes things safer or more secure than just opening port 443 of your firewall really, but I feel like it can&#39;t hurt? If nothing else, I have noticed a significant improvement with the initial web connection when accessing my home services. I suppose that these residential connections probably aren&#39;t designed to accommodate incoming web requests but this also may be placebo.&lt;/p&gt;
&lt;p&gt;If you run into trouble with any of this, the linked OPNsense and Oracle Cloud docs are the best next stop.&lt;/p&gt;
</description>
      </item>
      <item>
          <title>Making an Automatic Email Backup - Part 3</title>
          <pubDate>Wed, 22 Jun 2022 00:00:00 +0000</pubDate>
          <author>thehelpfulidiot</author>
          <link>https://thehelpfulidiot.com/making-an-automatic-email-backup-part-3/</link>
          <guid>https://thehelpfulidiot.com/making-an-automatic-email-backup-part-3/</guid>
          <description xml:base="https://thehelpfulidiot.com/making-an-automatic-email-backup-part-3/">&lt;p&gt;&lt;a href=&quot;/making-an-automatic-email-backup&quot;&gt;Part 1&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/making-an-automatic-email-backup-part-2&quot;&gt;Part 2&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Initially, I described a solution which required the use of LXC or some full Linux box to install and operate the necessary tools. Recently, however, I repackaged those tools into a couple docker containers, more easily deployable through a docker compose file with configuration done with environment variables.&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/jon6fingrs/mbsync-dovecot&quot;&gt;https://github.com/jon6fingrs/mbsync-dovecot&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://hub.docker.com/repository/docker/thehelpfulidiot/dovecot&quot;&gt;https://hub.docker.com/repository/docker/thehelpfulidiot/dovecot&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://hub.docker.com/repository/docker/thehelpfulidiot/mbsync&quot;&gt;https://hub.docker.com/repository/docker/thehelpfulidiot/mbsync&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Instructions on the github page. Let me know if you have any questions!&lt;/p&gt;
</description>
      </item>
      <item>
          <title>Integrating XMCOSY+ Outdoor String Lights with Home Assistant Locally</title>
          <pubDate>Fri, 17 Jun 2022 00:00:00 +0000</pubDate>
          <author>thehelpfulidiot</author>
          <link>https://thehelpfulidiot.com/integrating-xmcosy-outdoor-string-lights-with-home-assistant-locally/</link>
          <guid>https://thehelpfulidiot.com/integrating-xmcosy-outdoor-string-lights-with-home-assistant-locally/</guid>
          <description xml:base="https://thehelpfulidiot.com/integrating-xmcosy-outdoor-string-lights-with-home-assistant-locally/">&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/06/image.png&quot; alt=&quot;XMCOSY+ Outdoor String Lights&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;XMCOSY+ Outdoor String Lights&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Home automation is incredible and obviously in my opinion, a lot of fun. However, I&#39;m sure many of you would agree that buying a product for use in your home shouldn&#39;t have to connect to an outside computer, let alone one in another country.&lt;/p&gt;
&lt;p&gt;Fortunately with the magic of Home Assistant and the &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/rospogrigio/localtuya&quot;&gt;Local Tuya plugin&lt;/a&gt;, I have managed to run this light locally without any loss of functionality. As you may know, Tuya is a Chinese manufacturer who creates a lot of white label IoT devices. The devices, in my experience, tend to work well, but require cloud access to work through official channels. Local Tuya, on the other hand, is a custom integration which can grant local access to these Tuya devices and can work very well for our purposes.&lt;/p&gt;
&lt;p&gt;Unfortunately, Local Tuya, while set up to handle many different types of devices out of the box, is not able to handle the unique modes and functions of the &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://amzn.to/3MWAoQd&quot;&gt;XMCOSY+ Outdoor String Lights&lt;/a&gt;. However, by at least allowing access to the device API, templates and automations can be used to simplify and restore the device&#39;s normal function locally. In this post, I hope to explain my method for solving this problem and that it will work for others.&lt;/p&gt;
&lt;h2 id=&quot;steps&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#steps&quot; aria-label=&quot;Anchor link for: steps&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Steps&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Set the device up in Local Tuya as a light&lt;/li&gt;
&lt;li&gt;Create a template light entity to control the light seamlessly&lt;/li&gt;
&lt;li&gt;Use Node Red to convert between hex color code and HSV&lt;/li&gt;
&lt;li&gt;Create entities to change the custom colors related to one of the built-in scenes&lt;/li&gt;
&lt;li&gt;(optional) Block light access to internet&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;local-tuya&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#local-tuya&quot; aria-label=&quot;Anchor link for: local-tuya&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Local Tuya&lt;/h2&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/rospogrigio/localtuya&quot;&gt;https://github.com/rospogrigio/localtuya&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The documentation is pretty good at explaining how to get this custom integration installed, and then how to add your devices. Once you get your string lights added, you will have to instruct the plugin as to which data point (dp) controls which function of the light.&lt;/p&gt;
&lt;p&gt;Here is a printout of the data points for the light from the command line tool from which local tuya is based:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  dps&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;: {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;#39;20&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; false&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;#39;21&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;:&lt;/span&gt;&lt;span&gt; &amp;#39;white&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;#39;22&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 255&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;#39;23&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 165&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;#39;24&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;:&lt;/span&gt;&lt;span&gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt;23&lt;/span&gt;&lt;span&gt;eb&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt;230159&lt;/span&gt;&lt;span&gt;ff&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt;38&lt;/span&gt;&lt;span&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;#39;101&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;:&lt;/span&gt;&lt;span&gt; &amp;#39;ffff&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt;0502808080&lt;/span&gt;&lt;span&gt;ffff&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt;00&lt;/span&gt;&lt;span&gt;&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The explanation for each of these is as follows:&lt;/p&gt;
&lt;p&gt;20: on/off&lt;/p&gt;
&lt;p&gt;21: scene (white, colour, scene1, scene2, ..., scene8*, scene9)&lt;/p&gt;
&lt;p&gt;*scene 8 is the only customizable scene allowing you to select two colors&lt;/p&gt;
&lt;p&gt;22: brightness 0-255&lt;/p&gt;
&lt;p&gt;23: white-temp on a bizarre scale of 0 - 255&lt;/p&gt;
&lt;p&gt;24: the light color and when in color mode, its brightness (very complicated will explain below)&lt;/p&gt;
&lt;p&gt;101: a string storing the customizable two colors for scene8 (explained below)&lt;/p&gt;
&lt;h2 id=&quot;explanation-of-dp24&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#explanation-of-dp24&quot; aria-label=&quot;Anchor link for: explanation-of-dp24&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Explanation of DP24&lt;/h2&gt;
&lt;p&gt;Now DP 24. This took a really really long time to figure out and I found some helpful hints on decoding Tuya colors deep in the internet and I&#39;m sorry I can&#39;t seem to find these sites again or else I would like to provide links and give them credit.&lt;/p&gt;
&lt;p&gt;This is a combination of the lights hex code AND HSV (encoded in hex).&lt;/p&gt;
&lt;p&gt;So the first 6 characters (in my example above) - 23eb23 is a simple hex code for the current color.&lt;/p&gt;
&lt;p&gt;The 7th character is a 0. That is just a divider.&lt;/p&gt;
&lt;p&gt;The next 7 characters are related to HSV, but each item is hex-encoded.&lt;/p&gt;
&lt;p&gt;The first three charaters are Hue from 0-360 (ex above 159)&lt;/p&gt;
&lt;p&gt;The following 2 characters are saturation on a scale of 0-255 (the standard is 0-100)&lt;/p&gt;
&lt;p&gt;And the last 2 characters are Value (brightness) which is also on a scale 0-255 (and in this case the standard is 0-100)&lt;/p&gt;
&lt;h2 id=&quot;explanation-of-dp101&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#explanation-of-dp101&quot; aria-label=&quot;Anchor link for: explanation-of-dp101&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Explanation of DP101&lt;/h2&gt;
&lt;p&gt;It seems to consist of a constant string in the beginning (example above ffff0502). It may mean something but I was not able to change it through any of the app functions and I was too scared to change it manually. If anyone knows what this might represent, please tell me.&lt;/p&gt;
&lt;p&gt;But after that, are two back to back hex color codes. In the example above, color 1 is 808080, and color two is ffff00. I made two input selectors with a bunch of standard common color names. There is an automation and each time one of those two entities changes, the updated hex color code is inserted in the appropriate place.&lt;/p&gt;
&lt;p&gt;The color combination is updated and selecting scene8 shows you the custom scene you just made.&lt;/p&gt;
&lt;h2 id=&quot;back-to-local-tuya&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#back-to-local-tuya&quot; aria-label=&quot;Anchor link for: back-to-local-tuya&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Back to Local Tuya&lt;/h2&gt;
&lt;p&gt;So based on that, we will make a few entities using Local Tuya, all based around this device.&lt;/p&gt;
&lt;p&gt;First, of course, is the light itself. You can match up the DPs as follows:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/06/339E43DD-EA57-48EE-B8AC-B9B95A246882-369x1024.jpeg&quot; alt=&quot;LocalTuya Light Configuration&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;LocalTuya Light Configuration&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This sets up a light entity, but like I said, it is very limited. Cannot change between scenes, adjust scene colors, etc.&lt;/p&gt;
&lt;p&gt;Next, we need to set up some sensors from LocalTuya so that we can easily access the data for use in a template light.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/06/22F77A2A-D407-4B35-8BEB-C1CCD1E1B7F0-824x1024.jpeg&quot; alt=&quot;sensor.string_lights_scene&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;sensor.string_lights_scene&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/06/C4E65DB9-35F6-46CD-8376-8ECE759ED63A-849x1024.jpeg&quot; alt=&quot;sensor.string_light_color&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;sensor.string_light_color&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/06/C290DBCF-FC86-4E5B-8073-F04E560D5356-847x1024.jpeg&quot; alt=&quot;sensor.string_light_color_value&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;sensor.string_light_color_value&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/06/03BF911E-81B9-44CE-8E7D-F13F4E290604-822x1024.jpeg&quot; alt=&quot;sensor.custom_colors&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;sensor.custom_colors&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;So after all this, you should have five newly create LocalTuya entities:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;light.colored_string_lights - the main light entity&lt;/li&gt;
&lt;li&gt;sensor.custom_colors - a sensor displaying the hex code for the two custom colors used for scene8&lt;/li&gt;
&lt;li&gt;sensor.string_light_color - brightness (don&#39;t ask me why I called it this)&lt;/li&gt;
&lt;li&gt;sensor.string_light_color_value - the complicated hex and hsv color/brightness string&lt;/li&gt;
&lt;li&gt;sensor.string_lights_scene - the current scene&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Now it&#39;s time to move on to templates.&lt;/p&gt;
&lt;h2 id=&quot;templates&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#templates&quot; aria-label=&quot;Anchor link for: templates&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Templates&lt;/h2&gt;
&lt;p&gt;OK so now you can control the lights, but wouldn&#39;t it be nice to package everything in a single light entity? Fortunately, we can make template entities to combine the sensors and the light entity we created with LocalTuya.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; platform&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    lights&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;      string_lights&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        level_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% if state_attr(&amp;#39;light.colored_string_lights&amp;#39;,&amp;#39;color_mode&amp;#39;) == &amp;#39;color_temp&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ states(&amp;#39;sensor.string_light_color&amp;#39;)|int }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif state_attr(&amp;#39;light.colored_string_lights&amp;#39;,&amp;#39;color_mode&amp;#39;) == &amp;#39;hs&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ states(&amp;#39;sensor.string_light_color_value&amp;#39;)[12:]|int(base=16) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            255&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ states(&amp;#39;light.colored_string_lights&amp;#39;) }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        temperature_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% if state_attr(&amp;#39;light.colored_string_lights&amp;#39;,&amp;#39;color_mode&amp;#39;) == &amp;#39;color_temp&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ state_attr(&amp;#39;light.colored_string_lights&amp;#39;,&amp;#39;color_temp&amp;#39;) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif state_attr(&amp;#39;light.colored_string_lights&amp;#39;,&amp;#39;color_mode&amp;#39;) == &amp;#39;hs&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ color_temp|int(default=0) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        color_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% if state_attr(&amp;#39;light.colored_string_lights&amp;#39;,&amp;#39;color_mode&amp;#39;) == &amp;#39;hs&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ state_attr(&amp;#39;light.colored_string_lights&amp;#39;,&amp;#39;hs_color&amp;#39;) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        effect_list_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{[&amp;#39;White&amp;#39;,&amp;#39;Color&amp;#39;,&amp;#39;Strobe&amp;#39;,&amp;#39;Fade&amp;#39;,&amp;#39;Pulse&amp;#39;,&amp;#39;Blink&amp;#39;,&amp;#39;Chase&amp;#39;,&amp;#39;Christmas&amp;#39;,&amp;#39;America&amp;#39;,&amp;#39;Pick 2&amp;#39;,&amp;#39;Multi&amp;#39;]}}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        effect_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% if states(&amp;#39;sensor.string_lights_scene&amp;#39;) == &amp;#39;scene1&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;quot;Strobe&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.string_lights_scene&amp;#39;) == &amp;#39;scene2&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;quot;Fade&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.string_lights_scene&amp;#39;) == &amp;#39;scene3&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;quot;Pulse&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.string_lights_scene&amp;#39;) == &amp;#39;scene4&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;quot;Blink&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.string_lights_scene&amp;#39;) == &amp;#39;scene5&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;quot;Chase&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.string_lights_scene&amp;#39;) == &amp;#39;scene6&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;quot;Christmas&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.string_lights_scene&amp;#39;) == &amp;#39;scene7&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;quot;America&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.string_lights_scene&amp;#39;) == &amp;#39;scene8&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;quot;Pick 2&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.string_lights_scene&amp;#39;) == &amp;#39;scene9&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;quot;Multi&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.string_lights_scene&amp;#39;) == &amp;#39;white&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;quot;White&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.string_lights_scene&amp;#39;) == &amp;#39;colour&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;quot;Color&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        min_mireds_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ state_attr(&amp;#39;light.colored_string_lights&amp;#39;,&amp;#39;min_mireds&amp;#39;) }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        max_mireds_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ state_attr(&amp;#39;light.colored_string_lights&amp;#39;,&amp;#39;max_mireds&amp;#39;) }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        turn_on&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.colored_string_lights&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        turn_off&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.turn_off&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.colored_string_lights&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        set_level&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.brightness_with_white_or_color&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              brightness&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;{{ brightness|int }}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        set_color&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.check_color_mode&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              h&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;{{ hs[0] }}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              s&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;{{ hs[1] }}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        set_temperature&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.check_white_mode&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              color_temp&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;{{color_temp|int }}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        set_effect&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; localtuya.set_dp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              device_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; eb3f15638dccc2fe59wdgj&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              dp&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 21&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              value&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% if effect == &amp;#39;Strobe&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {{ &amp;quot;scene1&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif effect == &amp;#39;Fade&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {{ &amp;quot;scene2&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif effect == &amp;#39;Pulse&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {{ &amp;quot;scene3&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif effect == &amp;#39;Blink&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {{ &amp;quot;scene4&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif effect == &amp;#39;Chase&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {{ &amp;quot;scene5&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif effect == &amp;#39;Christmas&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {{ &amp;quot;scene6&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif effect == &amp;#39;America&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {{ &amp;quot;scene7&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif effect == &amp;#39;Pick 2&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {{ &amp;quot;scene8&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif effect == &amp;#39;Multi&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {{ &amp;quot;scene9&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif effect == &amp;#39;White&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {{ &amp;quot;white&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif effect == &amp;#39;Color&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {{ &amp;quot;colour&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% endif %}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;alias&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; check white mode&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; if&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; not&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; sensor.string_lights_scene&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; white&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    then&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; localtuya.set_dp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          device_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; eb3f15638dccc2fe59wdgj&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          dp&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 21&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          value&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; white&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;      color_temp&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;{{ color_temp }}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.colored_string_lights&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;mode&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; single&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;alias&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; check color mode&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; if&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; not&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; sensor.string_lights_scene&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; colour&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    then&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; localtuya.set_dp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          device_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; eb3f15638dccc2fe59wdgj&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          dp&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 21&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          value&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; colour&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; wait_for_trigger&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; platform&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;              -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; sensor.string_lights_scene&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            to&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; colour&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        timeout&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;1&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;      hs_color&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;{{ h }}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;{{ s }}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.colored_string_lights&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;One issue I noticed is that the brightness value is only relevant when the light is in white mode. When the light is in a color mode, the brightness is part of the hex/hsv string. This template selects the correct brightness based on the mode. When the light is showing a scene other than color or white, brightness is always at 100%. I believe that is a limitation of the light.&lt;/p&gt;
&lt;p&gt;Anyway, to make sure the correct brightness value is modified when you modify the brightness from the light entity in home assistant, I offloaded that to a script seen below:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;alias&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; brightness with white or color&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; choose&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;-&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;              {{ state_attr(&amp;#39;light.colored_string_lights&amp;#39;,&amp;#39;color_mode&amp;#39;) ==&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;              &amp;#39;color_temp&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; localtuya.set_dp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              device_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; eb3f15638dccc2fe59wdgj&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              dp&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 22&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              value&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;{{brightness|int}}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    default&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; rest_command.color_converter&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          brightness&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;{{brightness|int}}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; localtuya.set_dp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          device_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; eb3f15638dccc2fe59wdgj&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          dp&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 24&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          value&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ states(&amp;#39;sensor.color_output&amp;#39;) }}{{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            states(&amp;#39;sensor.string_light_color_value&amp;#39;)[6:12] }}{{ &amp;quot;%0x&amp;quot; | format(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            brightness | int ) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;mode&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; single&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Another issue was converting between HSV and hex colors. I could not find an easy formula or function to accomplish this in Home Assistant. After much searching, I found a module to use in Node Red.&lt;/p&gt;
&lt;h2 id=&quot;color-and-brightness&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#color-and-brightness&quot; aria-label=&quot;Anchor link for: color-and-brightness&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Color and Brightness&lt;/h2&gt;
&lt;p&gt;This is important for the DP24 which controls color and brightness when in single color mode. Basically, a hex value and hex encoded HSV is given each time. Just changing the hex value would change the color but reset the lights back to 100%. Apparently you need to change both and they need to match? Converting with template got complicated and I could not figure out a way to solve it. After much searching, I came across a module in Node Red.&lt;/p&gt;
&lt;p&gt;I am not a Node Red power user. I do very few things with it, and it feels like whenever I  use it, I have to relearn it.&lt;/p&gt;
&lt;p&gt;So to start, I needed a way to get information from home assistant to Node Red. I used a rest command in Home Assistant to send information to an HTTP receiver in Node Red:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  change_color_not_brightness&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    url&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; http://nodered:1880/color-converter&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    method&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; POST&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    payload&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;{&amp;quot;hsv&amp;quot;:{&amp;quot;hue&amp;quot;:{{ h }},&amp;quot;saturation&amp;quot;:{{ s }},&amp;quot;brightness&amp;quot;:{{ (state_attr(&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;light.string_lights&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;brightness&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;)/2.55)|int}}}}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    content_type&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;  &amp;#39;application/json; charset=utf-8&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    verify_ssl&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; false&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This sends over the current color and brightness in HSV.&lt;/p&gt;
&lt;h2 id=&quot;node-red&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#node-red&quot; aria-label=&quot;Anchor link for: node-red&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Node Red&lt;/h2&gt;
&lt;p&gt;Now to switch gears to Node Red. For those who don&#39;t know, it is a very commonly used add-on for Home Assistant, for creating automations by visually programming in Java. Many people use it exclusively for automations and don&#39;t touch the built-in YAML-based automations. Aside from the ease of creating automations, it also has access to a number of add-on modules which can add additional functions to your palette.&lt;/p&gt;
&lt;p&gt;The one we will need is called &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://flows.nodered.org/node/node-red-contrib-colorspace&quot;&gt;node-red-contrib-colorspace.&lt;/a&gt; It allowed me to create a &quot;Flow&quot; which received the HSV value through HTTP request, convert it to rgb, and send it back to Home Assistant. I send it back by using the Home Assistant nodes to update a sensor called &quot;sensor.color_output&quot;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/06/Screenshot-from-2022-06-17-19-04-52.png&quot; alt=&quot;sensor.color_output&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;sensor.color_output&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;My flow looks like this:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/06/Screenshot-from-2022-06-17-18-51-05.png&quot; alt=&quot;Node-red Flow&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Node-red Flow&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&quot;final-product&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#final-product&quot; aria-label=&quot;Anchor link for: final-product&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Final Product&lt;/h2&gt;
&lt;p&gt;Ok, so now we have a fully functional entity called &quot;light.string_lights&quot;. It can control (almost) every light function as one would expect from a regular Home Assistant light entity.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/06/D2C4F0E1-5322-428E-ACAA-16B56DF7992C-502x1024.jpeg&quot; alt=&quot;white light&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;white light&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/06/061CCBEE-C31D-473D-A159-F721FA35E66B-502x1024.jpeg&quot; alt=&quot;Color Select&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Color Select&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/06/A6C8459D-7B2A-4071-8D96-530596E6F5FE-506x1024.jpeg&quot; alt=&quot;scene select&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;scene select&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;It can control brightness, color, and the scenes. It can change brightness for color or white seamlessly. But there&#39;s one more thing- scene8.&lt;/p&gt;
&lt;h2 id=&quot;scene8&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#scene8&quot; aria-label=&quot;Anchor link for: scene8&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
scene8&lt;/h2&gt;
&lt;p&gt;Scene 8 is one of 9 scenes, and is the only customizable one. It alternates two colors which can be changed independently. I made two select entities for them. I just chose a handful of colors and created a dropdown menu although it would be possible to choose any color as well.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/06/2B4AFC06-FF7C-4AFB-BE23-E0EE093DF503-337x1024.jpeg&quot; alt=&quot;Color Select&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Color Select&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Whenever these entities are changed, they trigger an automation to change the color of the light:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;alias&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Change string light colors&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;description&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;trigger&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; platform&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; input_select.color_1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; color1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; platform&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; input_select.color_2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; color2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; choose&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; trigger&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; color1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; localtuya.set_dp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              device_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; eb3f15638dccc2fe59wdgj&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              dp&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 101&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              value&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% if states(&amp;#39;input_select.color_1&amp;#39;) == &amp;#39;Black&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new1 = &amp;#39;000000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_1&amp;#39;) == &amp;#39;Silver&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new1 = &amp;#39;c0c0c0&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_1&amp;#39;) == &amp;#39;Gray&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new1 = &amp;#39;808080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_1&amp;#39;) == &amp;#39;White&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new1 = &amp;#39;ffffff&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_1&amp;#39;) == &amp;#39;Maroon&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new1 = &amp;#39;800000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_1&amp;#39;) == &amp;#39;Red&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new1 = &amp;#39;ff0000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_1&amp;#39;) == &amp;#39;Purple&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new1 = &amp;#39;800080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_1&amp;#39;) == &amp;#39;Fuchsia&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new1 = &amp;#39;ff00ff&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_1&amp;#39;) == &amp;#39;Green&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new1 = &amp;#39;008000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_1&amp;#39;) == &amp;#39;Lime&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new1 = &amp;#39;00ff00&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_1&amp;#39;) == &amp;#39;Olive&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new1 = &amp;#39;808000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_1&amp;#39;) == &amp;#39;Yellow&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new1 = &amp;#39;ffff00&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_1&amp;#39;) == &amp;#39;Navy&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new1 = &amp;#39;000080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_1&amp;#39;) == &amp;#39;Blue&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new1 = &amp;#39;0000ff&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_1&amp;#39;) == &amp;#39;Teal&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new1 = &amp;#39;008080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_1&amp;#39;) == &amp;#39;Aqua&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new1 = &amp;#39;00ffff&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {{ &amp;#39;ffff0502&amp;#39; }}{{new1}}{{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][6:] }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; trigger&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; color2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; localtuya.set_dp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              device_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; eb3f15638dccc2fe59wdgj&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              dp&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 101&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              value&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% if states(&amp;#39;input_select.color_2&amp;#39;) == &amp;#39;Black&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new2 = &amp;#39;000000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_2&amp;#39;) == &amp;#39;Silver&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new2 = &amp;#39;c0c0c0&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_2&amp;#39;) == &amp;#39;Gray&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new2 = &amp;#39;808080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_2&amp;#39;) == &amp;#39;White&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new2 = &amp;#39;ffffff&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_2&amp;#39;) == &amp;#39;Maroon&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new2 = &amp;#39;800000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_2&amp;#39;) == &amp;#39;Red&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new2 = &amp;#39;ff0000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_2&amp;#39;) == &amp;#39;Purple&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new2 = &amp;#39;800080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_2&amp;#39;) == &amp;#39;Fuchsia&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new2 = &amp;#39;ff00ff&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_2&amp;#39;) == &amp;#39;Green&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new2 = &amp;#39;008000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_2&amp;#39;) == &amp;#39;Lime&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new2 = &amp;#39;00ff00&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_2&amp;#39;) == &amp;#39;Olive&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new2 = &amp;#39;808000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_2&amp;#39;) == &amp;#39;Yellow&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new2 = &amp;#39;ffff00&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_2&amp;#39;) == &amp;#39;Navy&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new2 = &amp;#39;000080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_2&amp;#39;) == &amp;#39;Blue&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new2 = &amp;#39;0000ff&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_2&amp;#39;) == &amp;#39;Teal&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new2 = &amp;#39;008080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% elif states(&amp;#39;input_select.color_2&amp;#39;) == &amp;#39;Aqua&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                  {% set new2 = &amp;#39;00ffff&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {{ &amp;#39;ffff0502&amp;#39; }}{{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][:6] }}{{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                new2 }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    default&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;mode&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; single&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To confirm the light color was changed to the desired color, I also made two sensors to read the scene&#39;s custom colors from the light itself.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; sensor&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Custom Color 2&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% if states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][6:] == &amp;#39;000000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Black&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][6:] == &amp;#39;c0c0c0&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Silver&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][6:] == &amp;#39;808080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Gray&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][6:] == &amp;#39;ffffff&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;White&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][6:] == &amp;#39;800000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Maroon&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][6:] == &amp;#39;ff0000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Red&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][6:] == &amp;#39;800080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Purple&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][6:] == &amp;#39;ff00ff&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Fuchsia&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][6:] == &amp;#39;008000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Green&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][6:] == &amp;#39;00ff00&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Lime&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][6:] == &amp;#39;808000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Olive&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][6:] == &amp;#39;ffff00&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Yellow&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][6:] == &amp;#39;000080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Navy&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][6:] == &amp;#39;0000ff&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Blue&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][6:] == &amp;#39;008080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Teal&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][6:] == &amp;#39;00ffff&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Aqua&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][6:] }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; sensor&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Custom Color 1&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        state&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% if states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][:6] == &amp;#39;000000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Black&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][:6] == &amp;#39;c0c0c0&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Silver&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][:6] == &amp;#39;808080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Gray&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][:6] == &amp;#39;ffffff&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;White&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][:6] == &amp;#39;800000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Maroon&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][:6] == &amp;#39;ff0000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Red&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][:6] == &amp;#39;800080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Purple&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][:6] == &amp;#39;ff00ff&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Fuchsia&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][:6] == &amp;#39;008000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Green&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][:6] == &amp;#39;00ff00&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Lime&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][:6] == &amp;#39;808000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Olive&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][:6] == &amp;#39;ffff00&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Yellow&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][:6] == &amp;#39;000080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Navy&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][:6] == &amp;#39;0000ff&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Blue&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][:6] == &amp;#39;008080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Teal&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% elif states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][:6] == &amp;#39;00ffff&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ &amp;#39;Aqua&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ states(&amp;#39;sensor.custom_colors&amp;#39;).split(&amp;#39;ffff0502&amp;#39;)[1][:6] }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% endif %}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That produces these two entities:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/06/color-select.png&quot; alt=&quot;Color Select Entities&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Color Select Entities&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/06/C6C895F8-E8AE-4DB8-892C-9C77EC2EC01D-502x1024.jpeg&quot; alt=&quot;Light Picker&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Light Picker&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&quot;finally&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#finally&quot; aria-label=&quot;Anchor link for: finally&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Finally&lt;/h2&gt;
&lt;p&gt;Our light is finished and fully controllable locally. The next step is to block the light&#39;s internet access from your router.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2022/06/02B41E12-7BF8-4FE2-8872-15432837DFA8-987x1024.jpeg&quot; alt=&quot;Completed Light&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Completed Light&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Hope this helps some people! Let me know if you have any questions!&lt;/p&gt;
&lt;h2 id=&quot;link-to-purchase&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#link-to-purchase&quot; aria-label=&quot;Anchor link for: link-to-purchase&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Link to Purchase&lt;/h2&gt;
&lt;p&gt;Affiliate Link:&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://amzn.to/3zQTyEh&quot;&gt;XMCOSY+ Outdoor String Lights, 49Ft&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Non-Affiliate Link:&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.amazon.com/gp/product/B08614LWZK&quot;&gt;XMCOSY+ Outdoor String Lights, 49Ft&lt;/a&gt;&lt;/p&gt;
</description>
      </item>
      <item>
          <title>Custom 3D Printed Mount for Fire Tablet (2015)</title>
          <pubDate>Fri, 26 Nov 2021 00:00:00 +0000</pubDate>
          <author>thehelpfulidiot</author>
          <link>https://thehelpfulidiot.com/custom-3d-printed-mount-for-fire-tablet-2015/</link>
          <guid>https://thehelpfulidiot.com/custom-3d-printed-mount-for-fire-tablet-2015/</guid>
          <description xml:base="https://thehelpfulidiot.com/custom-3d-printed-mount-for-fire-tablet-2015/">&lt;p&gt;I have been enamored by the slew of Home Assistant Dashboard mounts lately and have wanted to make one for a while. I saw that the newer Amazon tablets have commercially available options, but my old 2015 Fire Tablet was on its own.&lt;/p&gt;
&lt;p&gt;I decided to make one using my Creality Ender 3 Pro. I designed one with screw holes to fit a standard 2-gang box, an opening for the cord to exit posteriorly, and cut outs for the tablet&#39;s buttons.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/11/printing.jpg&quot; alt=&quot;Printing&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Printing&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Unfortunately, each one took about a day to print and I went through several drafts, slowly tweaking the design to fit perfectly. This slow process probably took weeks, but I finally came up with something that seemed to work.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/11/finished-frame.jpg&quot; alt=&quot;Finished frame&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Finished frame&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/11/button-and-cord-cutouts.jpg&quot; alt=&quot;Cut outs for buttons and cord&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Cut outs for buttons and cord&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/11/tablet-in-frame.jpg&quot; alt=&quot;Tablet in the frame- tight fit&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Tablet in the frame- tight fit&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Attaching a tablet to a wall is not hard, but doing it in a way to hide the cords is definitely more challenging. I know that the standard way is to run power to a new gang box which is why I designed my tablet frame to fit that scenario. However, I realized that I could probably do something a little simpler.&lt;/p&gt;
&lt;p&gt;I just ran the USB cable behind the wall and made a seperate opening towards the floor so that at least, the cable would be hidden and not dangling from the tablet.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/11/future-tablet-location.jpg&quot; alt=&quot;Future tablet location&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Future tablet location&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/11/image-780x1024.png&quot; alt=&quot;Attached frame&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Attached frame&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/11/cord-exit.jpg&quot; alt=&quot;Cord exit&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Cord exit&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;And here is the final result:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/11/image-1.png&quot; alt=&quot;Final product&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Final product&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;In case anyone is interested, here is a copy of my STL file:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/11/image-2.png&quot; alt=&quot;3D render of the Fire tablet mount STL&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/wp-content/uploads/2021/11/fire-tablet-mount.stl&quot;&gt;fire-tablet-mount&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And finally, here is the cord I used and the brush wall plate:&lt;/p&gt;
&lt;p&gt;Affiliate Link:&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.amazon.com/gp/product/B093SWG63B/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=B093SWG63B&amp;amp;linkCode=as2&amp;amp;tag=thehelpfulidi-20&amp;amp;linkId=bdc749058ad95a2e8fe1290c6fa30653&quot;&gt;GELRHONR Micro USB Cable U Shape,180 Degree Angle USB 5 Pin Nylon Braided Fast Data Sync Charging Cord USB A to USB B Fast Charger Wire for Most Micro USB Devices - Black 4.9Ft/1.5M&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.amazon.com/gp/product/B095FX5VFD/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=B095FX5VFD&amp;amp;linkCode=as2&amp;amp;tag=thehelpfulidi-20&amp;amp;linkId=ca3d9559509b8b3d1d193c2b5f057871&quot;&gt;Single Brush Wall Plate 2-Pack,Single Gang faceplate Cable Pass Through Insert Wall Socket for HDTV, HDMI, Network, Coaxial Cables, Speaker Wires White&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Non-affiliate Link:&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.amazon.com/gp/product/B093SWG63B&quot;&gt;GELRHONR Micro USB Cable U Shape,180 Degree Angle USB 5 Pin Nylon Braided Fast Data Sync Charging Cord USB A to USB B Fast Charger Wire for Most Micro USB Devices - Black 4.9Ft/1.5M&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.amazon.com/gp/product/B095FX5VFD/&quot;&gt;Single Brush Wall Plate 2-Pack,Single Gang faceplate Cable Pass Through Insert Wall Socket for HDTV, HDMI, Network, Coaxial Cables, Speaker Wires White&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Let me know if you have any questions. Thanks!&lt;/p&gt;
</description>
      </item>
      <item>
          <title>UPDATE 2: A Wired Sonoff Zigbee Alternative</title>
          <pubDate>Mon, 18 Oct 2021 00:00:00 +0000</pubDate>
          <author>thehelpfulidiot</author>
          <link>https://thehelpfulidiot.com/update-2-a-wired-sonoff-zigbee-alternative/</link>
          <guid>https://thehelpfulidiot.com/update-2-a-wired-sonoff-zigbee-alternative/</guid>
          <description xml:base="https://thehelpfulidiot.com/update-2-a-wired-sonoff-zigbee-alternative/">&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;/a-wired-sonoff-zigbee-alternative&quot;&gt;ORIGINAL POST&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;/update-a-wired-sonoff-zigbee-alternative&quot;&gt;UPDATE 10/15: READ IF YOU PLAN TO USE HUB WITH ZHA&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The updates for this little device keep coming. Thanks to the folks leaving comments, we keep getting more information. I apologize for not noticing this myself, but I did not spend any time trying Zigbee2Tasmota on this device having played with it enough on the Sonoff hub.&lt;/p&gt;
&lt;p&gt;A commenter, Ronald, noted that using Zigbee2Tasmota, attempting to pair Zigbee devices caused the hub to reboot. I confirmed this myself, and tried with both Zigbee firmware packages from the &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/arendst/Tasmota/tree/development/tools/fw_SonoffZigbeeBridge_ezsp&quot;&gt;EmberZNet NCP UART EZSP firmware page.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I attempted to build a firmware using the development branch of Tasmota instead of the Release branch, but it totally bricked my coordinator. After re-soldering and flashing again, I tried the &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/tasmota/install/raw/main/firmware/unofficial/tasmota32-zigbeebridge.bin&quot;&gt;unofficial Tasmota32-zigbeebridge.bin&lt;/a&gt; mentioned on the &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://templates.blakadder.com/ewelink_ZB-GW03.html&quot;&gt;Blakadder Template Repo&lt;/a&gt;. At the time of this writing, the Tasmota version is 9.5.0.9. Miraculously, I was able to pair devices as expected.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/10/tasmota-pairing.jpg&quot; alt=&quot;Device allowed to join&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Device allowed to join&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;After flashing this firmware, you would set it up following the instructions from the &lt;a href=&quot;/a-wired-sonoff-zigbee-alternative&quot;&gt;initial post&lt;/a&gt; by changing the template and then disabling WiFi if desired.&lt;/p&gt;
&lt;p&gt;To use ZHA, I would still recommend you follow the instructions from the &lt;a href=&quot;/update-a-wired-sonoff-zigbee-alternative&quot;&gt;first update&lt;/a&gt; and building a custom firmware so that the necessary rules to self-correct following a cold boot will work.&lt;/p&gt;
&lt;p&gt;Hopefully, whatever fixes exist in the nightly build will make their way to the stable branch and a single firmware will be able to accomplish ZHA and Zigbee2Tasmota.&lt;/p&gt;
&lt;p&gt;Please keep me updated with any issues or questions. Thanks!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;/a-wired-sonoff-zigbee-alternative&quot;&gt;ORIGINAL POST&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;/update-a-wired-sonoff-zigbee-alternative&quot;&gt;UPDATE 10/15: READ IF YOU PLAN TO USE HUB WITH ZHA&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;**UPDATE 10/30: **The above issue was acknowledged on &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/arendst/Tasmota/issues/13350&quot;&gt;Github&lt;/a&gt; and apparently had something to do with the serial communication in the Tasmota firmware. As noted above, that is why the unofficial zigbeebridge firmware works. It containts a fix for the serial communication.&lt;/p&gt;
</description>
      </item>
      <item>
          <title>UPDATE: A Wired Sonoff Zigbee Alternative</title>
          <pubDate>Fri, 15 Oct 2021 00:00:00 +0000</pubDate>
          <author>thehelpfulidiot</author>
          <link>https://thehelpfulidiot.com/update-a-wired-sonoff-zigbee-alternative/</link>
          <guid>https://thehelpfulidiot.com/update-a-wired-sonoff-zigbee-alternative/</guid>
          <description xml:base="https://thehelpfulidiot.com/update-a-wired-sonoff-zigbee-alternative/">&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;/a-wired-sonoff-zigbee-alternative&quot;&gt;ORIGINAL POST&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;/update-2-a-wired-sonoff-zigbee-alternative&quot;&gt;UPDATE 10/18: READ IF YOU PLAN TO USE HUB WITH Zigbee2Tasmota&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;So while the documentation in the initial post on &lt;a href=&quot;/a-wired-sonoff-zigbee-alternative&quot;&gt;how to compile and flash Tasmota to the ZB-GW03&lt;/a&gt; works, there is a bug when using the Tasmotized device with Home Assistant.&lt;/p&gt;
&lt;p&gt;After changing the device to a ZHA Bridge, a power disruption will prevent a reconnection to Home Assistant once power is restored. The only way to reconnect appears to be by switching the device template back to Zigbee2Tasmota, letting it start, and then back to the ZHA Bridge template. Afterwards it will reconnect as usual. A software initiated reboot DOES NOT cause the same issue.&lt;/p&gt;
&lt;p&gt;I do not know enough to say exactly why this is the case, but my theory is that the Zigbee2Tasmota template initializes the Zigbee Radio when it boots up and maybe that is not happening with Home Assistant when the device is shut down in an unsafe state.&lt;/p&gt;
&lt;p&gt;Fortunately, I have developed a work around which appears to work well and essentially fixes the problem without further intervention.&lt;/p&gt;
&lt;p&gt;It requires two rules:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Turning on after an unsafe shutdown changes the device back to Zigbee2Tasmota&lt;/li&gt;
&lt;li&gt;Once the device boots into Zigbee2Tasmota and the Zigbee radio is fully initialized, the device switches back to ZHA bridge.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In my somewhat brief testing, this has worked really well and the device reconnects as expected after an unsafe shutdown without any user intervention.&lt;/p&gt;
&lt;p&gt;Unfortunately, to accomplish this, requires a bit more work than one would think. Tasmota only saves one user defined Module at a time, and I was not able to save a rule with template information, probably due to the fact that it is in JSON format. Therefore, I had to compile a new Tasmota firmware, with the two file modifications on the initial instruction page, plus two new modules, one for each template.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/wp-content/uploads/2021/10/tasmota_template.h&quot;&gt;tasmota_template&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;To compile it yourself, you just need to replace tasmota_template.h with the following. Towards the end are the modules for ESP32 devices and you can see two additional modules for the ZB-GW03, one for ZHA and one for Zigbee2Tasmota.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Module 2 - ZHA_Bridge&lt;/li&gt;
&lt;li&gt;Module 3 - Zigbee2Tasmota&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If you prefer, you can just download the updated firmware below:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/wp-content/uploads/2021/10/tasmota32-EWELINK-1.bin&quot;&gt;tasmota32-EWELINK-updated&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Once you have the new firmware installed, you can use the following rules:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backlog rule1 on system#boot do backlog wifi 0; TCPStart 8888 endon; rule1 on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backlog rule2 on Info3#RestartReason=Vbat power on reset do module 3 endon; rule2 on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backlog rule3 on ZbState#Message=Started do module 2 endon; rule3 on&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The first rule combines rules 1 and 2 from the initial post and sets up the Zigbee Web Server and turns off wifi. If you intend to use wifi (which I probably wouldn&#39;t recommend), just use the following instead for the first rule:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backlog rule1 on system#boot do TCPStart 8888 endon; rule1 on&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Rule2 changes the module to Zigbee2Tasmota ONLY when the power is cut and the device undergoes an unsafe shutdown.&lt;/p&gt;
&lt;p&gt;Rule3 as soon as the device boots to Zigbee2Tasmota and the Zigbee radio is fully initialized, it switched back to ZHA Radio at which point the device should be able to reconnect to Home Assistant as expected.&lt;/p&gt;
&lt;p&gt;An issue has been opened on Github so please reply if you have experienced the same problem:&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/arendst/Tasmota/issues/13350&quot;&gt;https://github.com/arendst/Tasmota/issues/13350&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Please let me know about any additional issues or if you have any problems with the above solution.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;/a-wired-sonoff-zigbee-alternative&quot;&gt;ORIGINAL POST&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;/update-2-a-wired-sonoff-zigbee-alternative&quot;&gt;UPDATE 10/18: READ IF YOU PLAN TO USE HUB WITH Zigbee2Tasmota&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
</description>
      </item>
      <item>
          <title>Making an Automatic Email Backup - Part 2</title>
          <pubDate>Sat, 09 Oct 2021 00:00:00 +0000</pubDate>
          <author>thehelpfulidiot</author>
          <link>https://thehelpfulidiot.com/making-an-automatic-email-backup-part-2/</link>
          <guid>https://thehelpfulidiot.com/making-an-automatic-email-backup-part-2/</guid>
          <description xml:base="https://thehelpfulidiot.com/making-an-automatic-email-backup-part-2/">&lt;h3 id=&quot;update-part-3-has-instructions-for-email-backup-using-pre-made-docker-images-based-on-this-post-and-part-1&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#update-part-3-has-instructions-for-email-backup-using-pre-made-docker-images-based-on-this-post-and-part-1&quot; aria-label=&quot;Anchor link for: update-part-3-has-instructions-for-email-backup-using-pre-made-docker-images-based-on-this-post-and-part-1&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
UPDATE: &lt;a href=&quot;/making-an-automatic-email-backup-part-3&quot;&gt;PART 3&lt;/a&gt; has instructions for email backup using pre-made docker images based on this post and Part 1.&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;/making-an-automatic-email-backup&quot;&gt;&amp;lt;--- Part 1&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;summary-so-far&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#summary-so-far&quot; aria-label=&quot;Anchor link for: summary-so-far&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Summary so far&lt;/h2&gt;
&lt;p&gt;Ok, so if you have gone through Part 1 already, you have Mbsync set up to sync all emails from your remote IMAP server and then Dovecot set up to host those emails on a local SMTP server, but without SSL.&lt;/p&gt;
&lt;p&gt;That may be enough for many, but we can take things a step further. In this part, we will add self-signed SSL certificates for Dovecot, and we will install &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://roundcube.net/&quot;&gt;Roundcube&lt;/a&gt;. Roundcube is an open sourced webmail client. We will configure it to access our local email server and then to send emails through our remote server.&lt;/p&gt;
&lt;p&gt;Now one thing I would highly highly recommend to get the most out of this setup is to install Wireguard on your network and to set up a split-tunnel on your devices so that wherever you are, you always have access to all your local services. There are likely many of these tutorials on the internet and the instructions may vary a bit with the exact Wireguard instance you decide to use. Once you have it set up though, you will have access to all home hosted services - Pihole is always blocking ads for me on my cell phone, even on mobile, I can access router settings, Proxmox, whatever.&lt;/p&gt;
&lt;p&gt;In this case, I can also access my &quot;local&quot; IMAP server from anywhere in the world without exposing the IMAP server to the wide scary internet. Of course, if you wanted, I&#39;m sure you could also expose whatever services you want using a reverse proxy, but to me that just seems like a little less secure.&lt;/p&gt;
&lt;h2 id=&quot;installing-ssl&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#installing-ssl&quot; aria-label=&quot;Anchor link for: installing-ssl&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Installing SSL&lt;/h2&gt;
&lt;p&gt;So in my home, I have created a root Certificate Authority and have many server certificates for the various services on my network, mostly used with Nginx Reverse Proxy. There are several ways to do this, but if you have Pfsense or OPNsense, it comes with a way to create and manage these certificates using a graphical format. Below is a link to the OPNsense website detailing the creation of these certificates and a great video by Allen Sampsell.&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://docs.opnsense.org/manual/how-tos/self-signed-chain.html&quot;&gt;OPNsense documentation&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.youtube.com/watch?v=6aaSjwJhOog&quot;&gt;Youtube video by Allen Sampsell&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you don&#39;t have OPNsense or PFsense, this is the website I previously followed. Everything is done by the command line so a little more work, but with good instructions:&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://deliciousbrains.com/ssl-certificate-authority-for-local-https-development/&quot;&gt;Self-signed SSL certificate command line instructions&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Now, pick a local DNS name for your IMAP server. For example, imap.thehelpfulidiot.lan. Use whatever router software you have to create a local DNS entry pointing to your email backup server. Once you have the server name, you can create the Server Certificate for the server.&lt;/p&gt;
&lt;p&gt;By now you should have three things:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Certificate Authority Certificate&lt;/li&gt;
&lt;li&gt;IMAP Server Certificate&lt;/li&gt;
&lt;li&gt;IMAP Server Key&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;SSH into your email backup server.&lt;/p&gt;
&lt;p&gt;Copy over your server certificate and keys. Go to the Dovecot directory and make a directory to store SSL certificates.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-11 z-i&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /etc/dovecot&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mkdir ssl&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-11 z-i&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ssl&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; nano email.pem&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If your certificate has a &quot;*.crt&quot; extension, you will need to convert it to &quot;*.pem&quot; with the following command.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;openssl&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; x509 -in email.crt -out email.pem -outform PEM&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the new file that opens, copy and paste the contents of your server certificate file.&lt;/p&gt;
&lt;p&gt;Ctrl+X, Y, enter.&lt;/p&gt;
&lt;p&gt;Next, do the same with your key file.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; nano email.key&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Paste the contents of your key file.&lt;/p&gt;
&lt;p&gt;Ctrl+X, Y, enter.&lt;/p&gt;
&lt;p&gt;Now your certificate and key files are at the following locations, respectively:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;/etc/dovecot/ssl/email.pem&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;/etc/dovecot/ssl/email.key&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Ok, so now we have to tell Dovecot where the files are and what its server name is.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-11 z-i&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /etc/dovecot/conf.d&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; nano 10-auth.conf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Remove the line &quot;disable_plaintext_auth = no&quot; we placed in part 1 so that the default to not accept plaintext authentication will be reinstated.&lt;/p&gt;
&lt;p&gt;Now let&#39;s edit the SSL file.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; nano 10-ssl.conf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Change &quot;ssl = yes&quot; to &quot;ssl = required&quot; towards the top.&lt;/p&gt;
&lt;p&gt;Then you should see &quot;ssl_cert&quot; and &quot;ssl_key&quot; entries near the top as well. Change those to the appropriate file locations, but do not remove the &quot;&amp;lt;&quot; before each file path as this tells Dovecot to read the contents of the files and not just the file names.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;ssl_cert&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span&gt; &amp;lt;/etc/dovecot/ssl/email.pem&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;ssl_key&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span&gt; &amp;lt;/etc/dovecot/ssl/email.key&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Finally, we have to tell Dovecot what its sever name is so it knows to trust connections to it:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; nano /usr/share/dovecot/dovecot-openssl.cnf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Change the following line from:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;commonName&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span&gt; @commonName@&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;commonName&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span&gt; imap.thehelpfulidiot.lan&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, assuming you have installed your root certificate on your devices, connecting to this IMAP server should be like connecting to any server.&lt;/p&gt;
&lt;h2 id=&quot;installing-roundcube&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#installing-roundcube&quot; aria-label=&quot;Anchor link for: installing-roundcube&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Installing Roundcube&lt;/h2&gt;
&lt;p&gt;Next, wouldn&#39;t it be cool to be able to access this email from a nice Web GUI? Roundcube is a great way to do that and is something else which can be hosted internally. Even better, it comes as a &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://hub.docker.com/r/roundcube/roundcubemail/&quot;&gt;Docker&lt;/a&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://hub.docker.com/r/roundcube/roundcubemail/&quot;&gt;&lt;/a&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://hub.docker.com/r/roundcube/roundcubemail/&quot;&gt;image&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I use &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://docs.portainer.io/v/ce-2.9/start/intro&quot;&gt;Portainer&lt;/a&gt; to easily spin up docker compose files and recommend it to anyone for simple Docker management.&lt;/p&gt;
&lt;p&gt;Create a new stack called &quot;Roundcube&quot; and use the following docker compose file, edited as necessary for your setup:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;2&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;services&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  roundcubemail&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    image&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; roundcube/roundcubemail:latest&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    container_name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; roundcubemail&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    restart&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; unless-stopped&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    volumes&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /path/to/roundcube/www:/var/www/html&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /path/to/roundcube/ssl:/var/ssl&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    ports&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; 9002:80&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    depends_on&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;roundcubedb&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    environment&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ROUNDCUBEMAIL_DB_TYPE=pgsql&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ROUNDCUBEMAIL_DB_HOST=roundcubedb&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt; # same as pgsql container name&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ROUNDCUBEMAIL_DB_NAME=roundcube&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt; # same as pgsql POSTGRES_DB env name&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ROUNDCUBEMAIL_DB_USER=roundcube&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt; # same as pgsql POSTGRES_USER env name&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ROUNDCUBEMAIL_DB_PASSWORD=roundcube&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt; # same as pgsql POSTGRES_PASSWORD env name&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ROUNDCUBEMAIL_DB_PORT=5432&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ROUNDCUBEMAIL_SKIN=elastic&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ROUNDCUBEMAIL_DEFAULT_HOST=ssl://&amp;lt;localserver&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ROUNDCUBEMAIL_DEFAULT_PORT=993&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ROUNDCUBEMAIL_SMTP_SERVER=tls://&amp;lt;remoteserver&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; ROUNDCUBEMAIL_SMTP_PORT=587&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  roundcubedb&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    image&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; postgres:latest&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    container_name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; roundcubedb&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    restart&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; unless-stopped&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    volumes&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /path/to/db/postgres:/var/lib/postgresql/data&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    environment&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; POSTGRES_DB=roundcube&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; POSTGRES_USER=roundcube&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; POSTGRES_PASSWORD=roundcube&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Save your root Certificate Authority to the SSL folder you have mapped for Roundcube.&lt;/p&gt;
&lt;p&gt;Spin that up, but don&#39;t worry about logging in just yet. Go to the folder you used for &#39;/path/to/www&#39;.&lt;/p&gt;
&lt;p&gt;There should now be a bunch of files and folders generated by Roundcube&#39;s first run.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-11 z-i&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; config&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Edit config.inc.php&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; nano config.inc.php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;you should see the following:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;php&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;lt;?&lt;/span&gt;&lt;span&gt;php&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    $config&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;#39;plugins&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; [];&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    $config&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;#39;log_driver&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;stdout&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    $config&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;#39;zipdownload_selection&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; true&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    $config&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;#39;des_key&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;some_key&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;    include&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt;__DIR__&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; .&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;/config.docker.inc.php&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Just below that, add the following:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;php&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    $config&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;#39;enable_caching&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; false&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    $config&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;#39;imap_conn_options&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; array&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      &amp;#39;ssl&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;         =&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; array&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;         &amp;#39;verify_peer&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;  =&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; true&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;         &amp;#39;verify_depth&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 3&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;         &amp;#39;cafile&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;       =&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;/var/ssl/rootCA.pem&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;         &amp;#39;allow_self_signed&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; true&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;         &amp;#39;verify_peer_name&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; true&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;       ),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;     );&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     $config&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;#39;smtp_user&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;remote_user&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     $config&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;#39;smtp_pass&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;remote_pass&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Ctrl+x, y, enter.&lt;/p&gt;
&lt;p&gt;Almost done.&lt;/p&gt;
&lt;p&gt;Now log into Roundcube using the credentials for your Linux username and password from your email backup container.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/10/image-12.png&quot; alt=&quot;Roundcube Login Screen&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Roundcube Login Screen&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Go to Settings --&amp;gt; Identities --&amp;gt; and select the User which is probably something like &quot;thehelpfulidiot@imap.thehelpfulidiot.lan&quot;. If we send an email from roundcube, we don&#39;t want that to be the identity the recipients see.&lt;/p&gt;
&lt;p&gt;Change the Display Name and Email to your actual name and email addresses.&lt;/p&gt;
&lt;h2 id=&quot;closing&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#closing&quot; aria-label=&quot;Anchor link for: closing&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Closing&lt;/h2&gt;
&lt;p&gt;That&#39;s it! Now you can log in to Roundcube as if you were using a commercial email service. You can view your emails neatly organized and send emails directly from your remote email address!&lt;/p&gt;
&lt;p&gt;If you were so inclined, you could set up a reverse proxy and put Roundcube behind it and maybe something like &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/authelia/authelia&quot;&gt;Authelia&lt;/a&gt; and you could access your email inbox from anywhere. Personally, I&#39;ll leave something as sensitive as email safe behind my Wireguard server though.&lt;/p&gt;
&lt;p&gt;Please let me know if you have any questions!&lt;/p&gt;
</description>
      </item>
      <item>
          <title>Making an Automatic Email Backup - Part 1</title>
          <pubDate>Mon, 04 Oct 2021 00:00:00 +0000</pubDate>
          <author>thehelpfulidiot</author>
          <link>https://thehelpfulidiot.com/making-an-automatic-email-backup/</link>
          <guid>https://thehelpfulidiot.com/making-an-automatic-email-backup/</guid>
          <description xml:base="https://thehelpfulidiot.com/making-an-automatic-email-backup/">&lt;h3 id=&quot;update-part-3-has-instructions-for-email-backup-using-pre-made-docker-images-based-on-this-post-and-part-2&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#update-part-3-has-instructions-for-email-backup-using-pre-made-docker-images-based-on-this-post-and-part-2&quot; aria-label=&quot;Anchor link for: update-part-3-has-instructions-for-email-backup-using-pre-made-docker-images-based-on-this-post-and-part-2&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
UPDATE: &lt;a href=&quot;/making-an-automatic-email-backup-part-3&quot;&gt;PART 3&lt;/a&gt; has instructions for email backup using pre-made docker images based on this post and Part 2.&lt;/h3&gt;
&lt;h2 id=&quot;intro&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#intro&quot; aria-label=&quot;Anchor link for: intro&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Intro&lt;/h2&gt;
&lt;p&gt;In the world of self-hosting, creating a personal email server always seemed like the Holy Grail of personal privacy. Unfortunately, with all the work that would go into maintaining it, and the high probability of failure when operated by someone as inexperienced as myself, it has never seemed like a viable option for me. However, I have wanted a system for some time whereby I can automatically backup my email in a standard format which could potentially be served to me through standard mail apps by hosting my own internal IMAP server.&lt;/p&gt;
&lt;p&gt;After doing a fair amount of research, unfortunately, I could not find any suitable ready-made Docker solutions to accomplish this. However, I was able to create something fairly simple and elegant.&lt;/p&gt;
&lt;p&gt;I am going to share my solution which, while it took me a lot of work, should be fairly easy to set up.&lt;/p&gt;
&lt;p&gt;It requires three parts:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://isync.sourceforge.io/mbsync.html&quot;&gt;mbsync&lt;/a&gt; - a command line utility to synchronize IMAP servers&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.dovecot.org/&quot;&gt;dovecot&lt;/a&gt; - IMAP server software&lt;/li&gt;
&lt;li&gt;an email client&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;A major benefit of this set up could be for people with limited space in their email mailboxes. Instead of deleting emails to remain under 15gigs, you could essentially backup all emails to your home server, delete emails on the remote server, and still have easy, ready access to everything.&lt;/p&gt;
&lt;h2 id=&quot;initial-set-up&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#initial-set-up&quot; aria-label=&quot;Anchor link for: initial-set-up&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Initial Set Up&lt;/h2&gt;
&lt;p&gt;I have done this on Proxmox by creating a Ubuntu 20.04 LXC. I am using iSCSI for storage so that while the LXC is being run on my Proxmox machine, the data is being saved on my NAS where it has RAID protection, snapshots, and backups.&lt;/p&gt;
&lt;p&gt;I will go through the process assuming Ubuntu LXC, but I imagine this should work with any Ubuntu installation.&lt;/p&gt;
&lt;p&gt;I made my LXC with 2 cores and 1GB of RAM. Something I think that&#39;s important, is to make a non-root user with sudo privileges. This username and password will be the username and password for your IMAP server so you may want to make it relatively secure. To do so, enter the following commands:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; adduser&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;usernam&lt;/span&gt;&lt;span&gt;e&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; usermod -aG sudo&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;usernam&lt;/span&gt;&lt;span&gt;e&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then you can sign out of the root username and log in to the LXC using your new credentials.&lt;/p&gt;
&lt;p&gt;Afterwards, update the LXC to the latest with&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; apt update&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; apt upgrade -y&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;mbsync&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#mbsync&quot; aria-label=&quot;Anchor link for: mbsync&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Mbsync&lt;/h2&gt;
&lt;p&gt;Mbsync is a very powerful IMAP syncing software. It downloads your IMAP emails into a Maildir format in which each email is its own file and the file structure of your mailbox disk directory mimics the mailbox itself. It is a command line tool, but was fortunately fairly easy to work with. It can do a lot and I&#39;m sure I barely scratched the surface, but for my purposes, I set it up to download all new emails from the server, but to not propagate any deletions, and to not propagate any changes from my local instances back. This is a one way trip, but allowing deletions of this archive would defeat a major purpose of creating it.&lt;/p&gt;
&lt;p&gt;Confusingly, to install mbsync, you have to use its legacy name, isync.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; apt install isync&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then it&#39;s important to make the configuration file or else the program will not run.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; nano ~/.mbsyncrc&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and populate accordingly. Below is the template I use with a short explanation. There are many other &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://isync.sourceforge.io/mbsync.html&quot;&gt;configuration options&lt;/a&gt; if you are interested in further customizing it.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;# Set up according to your email provider. It will probably involve creating an application password.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;IMAPAccount &amp;lt;email account&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Host &amp;lt;host name&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Port &amp;lt;port&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;User &amp;lt;username&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Pass &amp;lt;password&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;# select one&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SSLType &amp;lt; None | STARTTLS | IMAPS &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;# select one&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SSLVersions &amp;lt; SSLv3 | TLSv1 | TLSv1.1 | TLSv1.2 | TLSv1.3 &amp;gt; &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;# I use fastmail and so my settings will reflect that but change as needed.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;# I believe IMAPStore is relatively arbitrary and has to do with how settings are stored. &amp;lt;something&amp;gt;-remote appears to be convention.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;IMAPStore fastmail-remote&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;# pick a name&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Account fastmail&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;# This section describes the local storage&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;# pick a name similar to what you picked for IMAPStore&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MaildirStore fastmail-local&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;#The root of your mailbox. By convention the Maildir directory is in the user&amp;#39;s home folder.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Path /home/thehelpfulidiot/Maildir/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;#The inbox seems to be a special folder in a mailbox so you need to specify it explicitly and then the other folders will be auto-created.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Inbox /home/thehelpfulidiot/Maildir/Inbox/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;# Adds additional subfolders to match IMAP folder names&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SubFolders Verbatim&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;# A channel defines how the sync will occur between the server and local storage.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;# pick a name&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Channel fastmail&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;# use what you have for IMAPStore above between two :&amp;#39;s&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Master :fastmail-remote:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;# use what you have for MaildirStore above between two :&amp;#39;s&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Slave :fastmail-local:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;# You can control what gets synced. &amp;#39;*&amp;#39; syncs everything.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Patterns *&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;# Do not remove messages marked for deletion&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Expunge None&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;# Do not remove deleted mailboxes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Remove None&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;# use the arrival date and time from the IMAP server for the original message&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CopyArrivalDate yes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;# You can see all the different ways to sync the mailboxes by going to the link above, but this will sync from remote to local without propagating deletions.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Sync PullNew&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;# automatically create necessary mailboxes locally&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Create Slave&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;#keeps the mailbox sync state files in the local mailbox&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SyncState *&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Press &quot;ctrl+x&quot;, Y to save, enter.&lt;/p&gt;
&lt;p&gt;Now make the mail directory you specified a moment ago. If using the same directory as I specified in the example config file, from your home directory, enter:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;mkdir&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; Maildir&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then run mbsync for the first time to download the emails.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;mbsync&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -a&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will take a while if your email folder is like mine. Take a break and come back when it&#39;s done. If you set up your config file like mine, mbsync will recreate all your mail folders locally.&lt;/p&gt;
&lt;p&gt;I got a socket error during the first sync, but luckily, mbsync can pick up from wherever it leaves off, so just run &#39;mbsync -a&#39; as many times as you need to get the whole mailbox synced initially.&lt;/p&gt;
&lt;p&gt;So now that your current mailbox is fully synced with your local archive, we need to set up a mechanism to pull new messages. As in all things, the &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://wiki.archlinux.org/title/Isync&quot;&gt;archwiki page on mbsync&lt;/a&gt; has an excellent example of how to do this.&lt;/p&gt;
&lt;p&gt;First, create the systemd unit. I think that placing it in the system directory and adding your specific User to the unit file will ensure that the process runs on boot without login, but as your user.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; nano /etc/systemd/system/mbsync.service&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And paste this text, making sure to change the user:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;Unit&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;Description&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span&gt;Mailbox synchronization service&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;Service&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span&gt;oneshot&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span&gt;&amp;lt;user&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;ExecStart&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span&gt;/usr/bin/mbsync -Va&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then we need to make a timer file so that this Unit is called periodically.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; nano /etc/systemd/system/mbsync.timer&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And enter the following:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;Unit&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;Description&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span&gt;Mailbox synchronization timer&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;Timer&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;OnBootSec&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span&gt;2m&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;OnUnitActiveSec&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span&gt;5m&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;Unit&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span&gt;mbsync.service&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;Install&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;WantedBy&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span&gt;timers.target&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now activate the new files.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; systemctl daemon-reload&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; systemctl enable mbsync.timer&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; systemctl start mbsync.timer&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Great, so now we have successfully backed up our IMAP account into a Maildir directory and we have set up automatic fetching. For some, this might be adequate, but the next thing I wanted to do was to make sure I had an easy way to consume the mail. Ideally, I wanted it to be viewable in any mail app. Next, we have to install Dovecot which is an IMAP server.&lt;/p&gt;
&lt;h2 id=&quot;dovecot&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#dovecot&quot; aria-label=&quot;Anchor link for: dovecot&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Dovecot&lt;/h2&gt;
&lt;p&gt;Dovecot is another really powerful piece of software used at super high levels, and I don&#39;t presume to be an expert with it, but I will show how it can be used in this situation as a local IMAP server.&lt;/p&gt;
&lt;p&gt;So first, let&#39;s get it installed:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; apt install dovecot-imapd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now we need to make some changes to the configuration.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; nano /etc/dovecot/conf.d/10-mail.conf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Locate the following line:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;mail_location&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span&gt; mbox:~/mail:&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;INBOX&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span&gt;/var/mail/%u&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Comment it out and replace it with:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;mail_location&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span&gt;maildir:~/Maildir:&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;LAYOUT&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span&gt;fs:&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt;INBOX&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span&gt;~/Maildir/INBOX&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Save and close the file.&lt;/p&gt;
&lt;p&gt;Next, open 10-auth.conf.&lt;/p&gt;
&lt;p&gt;Replace&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt; #disable_plaintext_auth = yes&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;with&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;disable_plaintext_auth&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span&gt; no&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will ensure you can connect to your server without SSL, but if you don&#39;t want that option. You can skip it and keep plaintext authentication disabled.&lt;/p&gt;
&lt;p&gt;Now open 15-mailboxes.conf.&lt;/p&gt;
&lt;p&gt;Under &quot;namespace inbox {&quot;, add &quot;inbox  =  yes&quot; like so:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;namespace inbox {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  inbox = yes&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Go down farther and uncomment the blocks about the virtual &quot;all&quot; and &quot;flagged&quot; mailboxes so that it looks like this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  # If you have a virtual &amp;quot;All messages&amp;quot; mailbox:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  mailbox virtual/All {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    special_use = \All&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  #  comment = All my messages&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  # If you have a virtual &amp;quot;Flagged&amp;quot; mailbox:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  mailbox virtual/Flagged {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    special_use = \Flagged&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  #  comment = All my flagged messages&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Start Dovecot.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; systemctl enable dovecot&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; systemctl start dovecot&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Dovecot is ready and your IMAP server should be functioning on your internal network, but without SSL. Since this is on your local network, that may or may not be adequate for you.&lt;/p&gt;
&lt;h2 id=&quot;viewing&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#viewing&quot; aria-label=&quot;Anchor link for: viewing&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Viewing&lt;/h2&gt;
&lt;p&gt;Now if you use a mail app, you should be able to enter the IP address of your Mail Backup LXC in the server name and your Linux account credentials and your email will populate like any other server. For example, on my iPhone, I entered the following settings:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/10/IMG_8713-473x1024.png&quot; alt=&quot;Home SMTP settings&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Home SMTP settings&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;You can basically make the name, email, and descriptions what you would normally use for your remote email server. It will not be able to authenticate of course and you will then have an opportunity to create separate username, passwords, and server identities for IMAP and SMTP. The IMAP host name is your LXC&#39;s IP address, the user name is your Linux username, and the password is your Linux password.&lt;/p&gt;
&lt;p&gt;The SMTP configuration would be according to your remote server&#39;s SMTP configuration to ensure you can send emails as ususal.&lt;/p&gt;
&lt;p&gt;You&#39;ll notice that attempting to connect from an iPhone (and I suspect from other systems) gives this warning:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/10/IMG_8711-473x1024.png&quot; alt=&quot;SSL error&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;SSL error&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I will continue in a second part on how to take things a bit further. I will show you how to install self-signed certificates, and how to set up a local webmail application called Roundcube to view your backed-up mailbox and send emails through your remote server.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#conclusion&quot; aria-label=&quot;Anchor link for: conclusion&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Conclusion&lt;/h2&gt;
&lt;p&gt;I hope that helps some folks. It took me quite a while figuring out these settings, but now that I have, I think its pretty straightforward. Please feel free to let me know if you have any questions or if I got something wrong.&lt;/p&gt;
&lt;p&gt;Thanks for reading!&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/making-an-automatic-email-backup-part-2&quot;&gt;Continue to Part 2 ---&amp;gt;&lt;/a&gt;&lt;/p&gt;
</description>
      </item>
      <item>
          <title>Controlling Home Assistant with an Old Remote</title>
          <pubDate>Sun, 03 Oct 2021 00:00:00 +0000</pubDate>
          <author>thehelpfulidiot</author>
          <link>https://thehelpfulidiot.com/controlling-home-assistant-with-an-old-remote/</link>
          <guid>https://thehelpfulidiot.com/controlling-home-assistant-with-an-old-remote/</guid>
          <description xml:base="https://thehelpfulidiot.com/controlling-home-assistant-with-an-old-remote/">&lt;p&gt;I, like many other I&#39;m sure, have plenty of old infrared remotes laying around from TVs past. They were just collecting dust, but what if they could be useful again? Well thanks to the &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://flirc.tv/more/flirc-usb&quot;&gt;Flirc USB&lt;/a&gt;, a small USB IR receiver, those old remotes can be used to control anything your Home Assistant Box can control.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/10/image-6-1024x802.png&quot; alt=&quot;The Flirc USB&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;The Flirc USB&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/10/image-7.png&quot; alt=&quot;Banana for scale&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Banana for scale&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The amazing thing about this device is its simplicity. First, you plug it into a PC, Mac, or Linux machine. Then download the software. The software lets you assign buttons to a virtual keyboard by selecting individual keys and firing your remote at it. Those codes are saved on the device itself, so it can be moved to your Home Assistant Operating System box and will be seen as just an ordinary keyboard. Except, instead of interacting by physically pressing keys, the key is &quot;pressed&quot; when it detects the corresponding infrared frequency.&lt;/p&gt;
&lt;h2 id=&quot;set-up&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#set-up&quot; aria-label=&quot;Anchor link for: set-up&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Set Up&lt;/h2&gt;
&lt;p&gt;So let&#39;s walk through how this would be set up.&lt;/p&gt;
&lt;p&gt;First, &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://flirc.tv/support/flirc-usb&quot;&gt;download the software&lt;/a&gt; from the website and plug in the USB device.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/10/image-8-1024x763.png&quot; alt=&quot;Flirc Software&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Flirc Software&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;There are a number of virtual keyboard or remotes you can select. I think selecting a standard keyboard makes the most sense to maximize the number of programmable keys.&lt;/p&gt;
&lt;p&gt;Next, click on a key, and it will ask you to press the corresponding button on the remote. You do not need to remember which buttons are mapped to which keys because they will later be identified in Home Assistant by watching the event log.&lt;/p&gt;
&lt;p&gt;Once you have recorded all the keys you want, you unplug the device from your computer and plug it into your Home Assistant box.&lt;/p&gt;
&lt;h2 id=&quot;home-assistant&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#home-assistant&quot; aria-label=&quot;Anchor link for: home-assistant&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Home Assistant&lt;/h2&gt;
&lt;p&gt;Now the Flirc can be set up in Home Assistant using the &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.home-assistant.io/integrations/keyboard_remote/&quot;&gt;Keyboard Remote&lt;/a&gt; integration. First, confirm it is recognized by Home Assistant by looking in the Supervisor&#39;s Hardware tab.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/10/image-9-1024x614.png&quot; alt=&quot;Flirc recognized in Hardware tab&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Flirc recognized in Hardware tab&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Once you see it&#39;s recognized, add the following to your configuration.yaml and restart:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;keyboard_remote&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; device_name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;flirc.tv flirc Keyboard&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    type&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;key_down&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;creating-automations&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#creating-automations&quot; aria-label=&quot;Anchor link for: creating-automations&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Creating Automations:&lt;/h2&gt;
&lt;p&gt;Now you can make automations capable of anything your Home Assistant can do from the press of a button. To do so, you need to obtain the &quot;key_code&quot; for each programmed button. Go to the Developer Tools and then the Events tab. Listen for events from &quot;keyboard_remote_command_received&quot; and press the individual buttons. For example:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/10/image-10-1024x749.png&quot; alt=&quot;Example of keyboard_remote_command_received response&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Example of keyboard_remote_command_received response&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;So now I know that my remote&#39;s &quot;Netflix&quot; button is mapped to keycode 50.&lt;/p&gt;
&lt;p&gt;A corresponding automation trigger would look like this:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;platform&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; event&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;event_type&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; keyboard_remote_command_received&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;event_data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  device_name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; flirc.tv flirc Keyboard&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  key_code&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 50&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And from there it can do whatever you want- turn off lights, lock doors, turn on music, or even turn on your TV using your old remote!&lt;/p&gt;
&lt;h2 id=&quot;logitech-harmony&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#logitech-harmony&quot; aria-label=&quot;Anchor link for: logitech-harmony&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Logitech Harmony&lt;/h2&gt;
&lt;p&gt;Now, I happen to be a big fan of the Harmony Remote and its Home Assistant integration. As far as I know, the integration is one way, meaning that you can fire commands through the Harmony but Home Assistant cannot receive commands. If instead of an old remote you wanted to use the Harmony, you could simply set up some dummy device and make sure the the Harmony Hub or an IR mini blaster will have line of sight to the Flirc Receiver. Set up the device in the same way and then you can integrate Home Assistant actions into your Harmony Hub Activity.&lt;/p&gt;
&lt;h2 id=&quot;bonus-magiquest-wands&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#bonus-magiquest-wands&quot; aria-label=&quot;Anchor link for: bonus-magiquest-wands&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
BONUS - MagiQuest Wands&lt;/h2&gt;
&lt;p&gt;Some of you may be familiar with &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://en.wikipedia.org/wiki/MagiQuest&quot;&gt;MagiQuest&lt;/a&gt;. It is an interactive live role playing game at many tourist attractions. My family and I, specifically, encountered it at Great Wolf Lodge. To participate, you purchase (expensive) customized wands and can run around the hotel or tourist destination waving it at different objects.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/10/image-11-534x1024.png&quot; alt=&quot;MagiQuest Wand&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;MagiQuest Wand&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Well the wand is actually just an infrared transmitter which is fired when the wand is flicked. Instead of bringing them home and having life-less souvenirs, you can integrate them into Home Assistant using the Flirc!&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#conclusion&quot; aria-label=&quot;Anchor link for: conclusion&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Conclusion&lt;/h2&gt;
&lt;p&gt;I hope this write-up was helpful. For only $19.95 on Amazon, I definitely think it is a good device at a good price with a lot of possibility. Please let me know if you have any questions.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Affiliate Link&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.amazon.com/gp/product/B01NBRBWS6/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=B01NBRBWS6&amp;amp;linkCode=as2&amp;amp;tag=thehelpfulidi-20&amp;amp;linkId=9a56ceec3c171749a83b8b1af6b4555c&quot;&gt;FLIRC USB Universal Remote Control Receiver&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Non-Affiliate Link&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;meta charset=&quot;utf-8&quot;&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.amazon.com/Universal-Remote-Control-Receiver-Raspberry/dp/B01NBRBWS6?ref_=ast_sto_dp&quot;&gt;FLIRC USB Universal Remote Control Receiver&lt;/a&gt;&lt;/p&gt;
</description>
      </item>
      <item>
          <title>How to Use Zigbee2Tasmota with Home Assistant</title>
          <pubDate>Sat, 02 Oct 2021 00:00:00 +0000</pubDate>
          <author>thehelpfulidiot</author>
          <link>https://thehelpfulidiot.com/how-to-use-zigbee2tasmota-with-home-assistant/</link>
          <guid>https://thehelpfulidiot.com/how-to-use-zigbee2tasmota-with-home-assistant/</guid>
          <description xml:base="https://thehelpfulidiot.com/how-to-use-zigbee2tasmota-with-home-assistant/">&lt;p&gt;To follow up my last &lt;a href=&quot;/a-wired-sonoff-zigbee-alternative&quot;&gt;post&lt;/a&gt;, integrating a newly flashed Tasmota Zigbee Coordinator with Home Assistant has a third option besides ZHA and Zigbee2MQTT; it can be used directly as a Zigbee Coordinator using its own amazing Tasmota Software.&lt;/p&gt;
&lt;p&gt;The device itself uses a zigbee implementation called &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://tasmota.github.io/docs/Zigbee/&quot;&gt;Zigbee2Tasmota&lt;/a&gt;, which is a full-fledged zigbee routing platform with the usual MQTT integration. Unfortunately, it is probably overlooked because its use is limited to the Tasmota console, but it may be an attractive option for some, especially for a potentially more reliable connection when relying on the WiFi radio of the Sonoff Zigbee Coordinator.&lt;/p&gt;
&lt;p&gt;In this case, the Pros and Cons may have some subjectivity, but I will share why I was interested in using it, and the drawbacks associated with it.&lt;/p&gt;
&lt;p&gt;First, as I stated in my first &lt;a href=&quot;/hello-world&quot;&gt;post&lt;/a&gt;, when I began my self-hosting journey seriously by purchasing a machine with the intention of running ProxMox, I did what I&#39;m sure everyone did. I put EVERYTHING I possibly could onto this single machine. That included Pihole (my dns server), Untangled (my firewall), Home Assistant, Mosquitto, EVERYTHING. I thought it was so cool to have a single machine running so many discrete tasks so elegantly through ProxMox, but I found that a host reboot was disastrous and caused a very long downtime in my house. Everything went down and the entire boot process could take up to 10 minutes. This had an extremely negative impact on my &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://en.wikipedia.org/wiki/Wife_acceptance_factor&quot;&gt;WAF&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To solve this, I began splitting up my various services and really only have my plex server, my backup pihole, home assistant plus many other non-critical services on my ProxMox box now. I got a number of cheap Zotac mini-pcs from Amazon Warehouse and have begun using them to run baremetal services like OPNsense, zigbee/zwave radios, NVR, MQTT server, etc.&lt;/p&gt;
&lt;p&gt;Back to my point, I did not initially enjoy turning my Tasmotized Zigbee Coordinator into a Home Assistant Zombie. When you integrate the Zigbee coordinator into ZHA, you lose all native Zigbee commands of the coordinator.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/10/image-1024x515.png&quot; alt=&quot;Tasmota main menu before and after integrating with ZHA: the Zigbee Permit Join and Zigbee Map buttons disappear&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;In an effort to further decentralize my smart home infrastructure, I would prefer for the zigbee coordinator to maintain functioning even if my Home Assistant instance goes down. Having said that, the device now becomes dependent on a functioning MQTT server so that is certainly a trade-off. I personally keep my MQTT server running on my NAS so that it is always up. I also have a second instance of Home Assistant which meant that I could only integrate the coordinator natively with one instance, whereas when the connection is over MQTT, it can connect to an unlimited number of Home Assistant Servers. I also think an MQTT server is more stable than a WiFi serial over TCP connection. I subjectively and anecdotally noticed a quicker reaction time with Zigbee2Tasmota vs ZHA.&lt;/p&gt;
&lt;p&gt;Second, based on my testing and internet research, it is really not possible to change the Zigbee channel from 11 when integrating the Zigbee Coordinator in ZHA. I have a Hue Hub and WiFi channels 1, 6, and 11 throughout my home and so for me, the ideal channel was 20. With Zigbee2Tasmota, this is a trivial command.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;zbconfig {&amp;quot;Channel&amp;quot;:&amp;lt;enter channel&amp;gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Third, I purchased a number of cheap Sonoff and Aqara sensors without realizing the issues I would have when trying to pair them with standard Zigbee coordinators. I had many drop offs requiring a physical reset on the device when on ZHA, but the devices all just seemed to work with Zigbee2Tasmota. Now, this could be related to my second point and while on ZHA, there just may have been too much interference, but changing the channels of my other devices was not a viable option for me.&lt;/p&gt;
&lt;p&gt;But it isn&#39;t all positive. There are certainly plenty of downsides with Zigbee2Tasmota.&lt;/p&gt;
&lt;p&gt;First, all commands are done through the console except Zigbee Join and viewing the Zigbee Map, as you can see below. I suppose that negative depends on the individual, but it is certainly a nice option to have an easy to use GUI nicely integrated into Home Assistant. However, I should note once devices are added, they are listed on the main Tasmota page along with their current state, connection strength, battery level, etc.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/10/image-2.png&quot; alt=&quot;Zigbee2Tasmota web UI listing paired Zigbee devices with their state, battery and signal&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;It is definitely nice for a quick glance or to troubleshoot.&lt;/p&gt;
&lt;p&gt;Second, along with all Zigbee network controls requiring commands through the Tasmota terminal, adding devices into Home Assistant also required manually configured MQTT entities and Template entities. Again, may or may not be a big deal. I will show some examples of my devices below. Honestly, once one device was written, it was trivial to copy and paste an additional device.&lt;/p&gt;
&lt;p&gt;Third, while sensors worked quickly and flawlessly, lights were a bit of a different story. You can only send ONE command at a time. So changing the hue/color and brightness requires two separate commands. In Home Assistant, this required me to get a little creative with a template light ON TOP of the manually configured MQTT light. Also, the light updates in Home Assistant were a little slow since it required possibly sending multiple commands to the hub and then receiving a state message back to home assistant to update the entity. This probably wasn&#39;t a huge deal, but as you can imagine, my testing was artificial and involved a lot of stress testing which is probably beyond real world usage.&lt;/p&gt;
&lt;h2 id=&quot;summary-comparison&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#summary-comparison&quot; aria-label=&quot;Anchor link for: summary-comparison&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Summary Comparison&lt;/h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;Zigbee2Tasmota&lt;/strong&gt;&lt;/th&gt;&lt;th&gt;&lt;strong&gt;ZHA&lt;/strong&gt;&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Functions independently from Home Assistant&lt;/td&gt;&lt;td&gt;Nice and user-friendly GUI&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Easily change Zigbee channel&lt;/td&gt;&lt;td&gt;Automatic device/entity creation after pairing&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Good compatibility with nontraditional Zigbee protocols&lt;/td&gt;&lt;td&gt;Better light bulb compatibility and control&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;h2 id=&quot;helpful-zigbee2tasmota-options&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#helpful-zigbee2tasmota-options&quot; aria-label=&quot;Anchor link for: helpful-zigbee2tasmota-options&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Helpful Zigbee2Tasmota Options&lt;/h2&gt;
&lt;p&gt;Ok, so you&#39;ve read about Zigbee2Tasmota so far and you want to give it a try. There were a few global &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://tasmota.github.io/docs/Commands/&quot;&gt;Tasmota options&lt;/a&gt; I found very helpful in simplifying the administration of the network.&lt;/p&gt;
&lt;p&gt;By default, every Zigbee device is communicated over MQTT using the same topic, &lt;code&gt;tele/%topic%/SENSOR&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;By setting SetOption89 to 1, each device is given their own topic, &lt;code&gt;tele/%topic%/&amp;lt;device&amp;gt;/SENSOR&lt;/code&gt;. I found this much easier to keep the devices separated.&lt;/p&gt;
&lt;p&gt;Each device is given a unique identifier when it joins the network, and that is used to initially populate the MQTT topic if you decided to make the change I suggested above, but there is fortunately a way to give friendly names to each device.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ZBName &amp;lt;device&amp;gt;,&amp;lt;new_friendly_name&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Once you do that, the device friendly name will display on the Tasmota home screen, and you can set SetOption112 to 1 so that the friendly name will be used in the MQTT topic instead of the unique identifier.&lt;/p&gt;
&lt;p&gt;Ok, so now that we&#39;ve done that, our Zigbee coordinator should be good to go. We have it connected to our MQTT broker and have tweaked the settings enough to hopefully add some devices.&lt;/p&gt;
&lt;h2 id=&quot;example-home-assistant-entities&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#example-home-assistant-entities&quot; aria-label=&quot;Anchor link for: example-home-assistant-entities&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Example Home Assistant Entities&lt;/h2&gt;
&lt;p&gt;Here are some examples I made to control various devices. Like I said above, the MQTT topic for each device will now be  &lt;code&gt;tele/Zigbee/&amp;lt;friendly_device_name&amp;gt;/SENSOR&lt;/code&gt;. I set my topic to zbbridge in Tasmota, so change yours accordingly along with the device names. I did my best to bold the device-specific names and options below.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Motion detector:&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; platform&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; master bath motion&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    state_topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;tele/zbbridge/master_bath_motion/SENSOR&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;master_bath_motion&amp;#39;][&amp;#39;Occupancy&amp;#39;] }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    payload_on&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    payload_off&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    availability_topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;tele/zbbridge/LWT&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    payload_available&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Online&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    payload_not_available&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Offline&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    qos&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    device_class&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;motion&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Contact sensor:&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; platform&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; half bath door sensor&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    state_topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;tele/zbbridge/half_bath_door/SENSOR&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;half_bath_door&amp;#39;][&amp;#39;ZoneStatusChange&amp;#39;] }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    payload_on&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    payload_off&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    availability_topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;tele/zbbridge/LWT&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    payload_available&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Online&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    payload_not_available&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Offline&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    qos&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    device_class&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;door&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Battery sensor:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This was a little trickier. A battery percentage is not sent with each device update message. I added a template to the MQTT entity to say, &quot;if message has updated value, use that, otherwise, keep old value.&quot; Without that addition, each time an updated message came without the specific value, the entity in Home Assistant became undefined.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; platform&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; half bath door battery&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    state_topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;tele/zbbridge/half_bath_door/SENSOR&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% if value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;half_bath_door&amp;#39;][&amp;#39;BatteryPercentage&amp;#39;] &amp;gt; 0 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {{ value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;half_bath_door&amp;#39;][&amp;#39;BatteryPercentage&amp;#39;] }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {{ states(entity_id) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    availability_topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;tele/zbbridge/LWT&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    payload_available&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Online&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    payload_not_available&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Offline&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    qos&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    device_class&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;battery&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    expire_after&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 86400&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    unit_of_measurement&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;%&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Humidity and Temperature Sensors:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The same is true for the Aqara Humidity and Temperature Sensor I use. Each message did not have ever variable and so it was important to only update the MQTT entity when the message had the necessary information. Also, to note, the temperature was reported in Celsius to Tasmota and so I had to add a freedom conversion to my MQTT entity for Fahrenheit.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; platform&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; refrigerator temperature sensor&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    state_topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;tele/zbbridge/refrigerator_temperature_sensor/SENSOR&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% if value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;refrigerator_temperature_sensor&amp;#39;][&amp;#39;Temperature&amp;#39;] &amp;gt; 0 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {{ (value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;refrigerator_temperature_sensor&amp;#39;][&amp;#39;Temperature&amp;#39;]|float + 1.8) + 32 }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {{ states(entity_id) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    availability_topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;tele/zbbridge/LWT&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    payload_available&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Online&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    payload_not_available&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Offline&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    qos&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    device_class&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;temperature&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    expire_after&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 86400&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    unit_of_measurement&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;F&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; platform&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; refrigerator humidity sensor&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    state_topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;tele/zbbridge/refrigerator_temperature_sensor/SENSOR&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% if value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;refrigerator_temperature_sensor&amp;#39;][&amp;#39;Humidity&amp;#39;] &amp;gt; 0 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {{ value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;refrigerator_temperature_sensor&amp;#39;][&amp;#39;Humidity&amp;#39;] }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {{ states(entity_id) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    availability_topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;tele/zbbridge/LWT&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    payload_available&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Online&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    payload_not_available&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Offline&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    qos&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    device_class&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;humidity&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    expire_after&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 86400&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    unit_of_measurement&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;%&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Lights:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Ok, so far things have  been relatively straightforward. Here is where they get tricky. I am in no way saying that this is the easiest or best way to accomplish light control. This is what I did which seemed to work. I did not attach any colored lights (thank god as I can only imagine that would add to the complication), but I did attach a number of white tunable lights.&lt;/p&gt;
&lt;p&gt;Like I said above, the lights can only receive a single command at a time. Luckily, it is possible to group lights and send 1 command for multiple lights. To do so, use this following &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://tasmota.github.io/docs/Zigbee/#zigbee-groups&quot;&gt;command&lt;/a&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ZbSend {&amp;quot;device&amp;quot;:&amp;quot;IKEA_Light&amp;quot;,&amp;quot;Send&amp;quot;:{&amp;quot;AddGroup&amp;quot;:100}}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Replace the device with either the friendly name or unique identifier. The group number is a unique, arbitrary integer for each group. As far as I know, it is not possible to name the groups from within Tasmota and their status is not displayed on the front page.&lt;/p&gt;
&lt;p&gt;First I will show how I handled a single light. It required both an mqtt entity and a template entity. The MQTT entity basically brought the device into home assistant, and the template entity made its control simpler by allowing me to change color temp and brightness at the same time by breaking down the single home assistant command into two separate MQTT commands. The MQTT device, for me, basically just sat there, hidden, and the Template light is how I interacted with the light.&lt;/p&gt;
&lt;p&gt;Si&lt;strong&gt;ngle Light:&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;   -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; platform&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;     lights&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;       guest_bedroom_lamp_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;         level_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;           {% if state_attr(&amp;#39;light.guest_bedroom_lamp&amp;#39;,&amp;#39;brightness&amp;#39;)|int &amp;gt;0 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;             {{ state_attr(&amp;#39;light.guest_bedroom_lamp&amp;#39;,&amp;#39;brightness&amp;#39;) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;           {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;             0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;           {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;         value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ states(&amp;#39;light.guest_bedroom_lamp&amp;#39;) }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;         temperature_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;           {% if state_attr(&amp;#39;light.guest_bedroom_lamp&amp;#39;,&amp;#39;color_temp&amp;#39;)|int &amp;gt;0 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;             {{ state_attr(&amp;#39;light.guest_bedroom_lamp&amp;#39;,&amp;#39;color_temp&amp;#39;) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;           {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;             0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;           {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;         turn_on&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;           -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;             data_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;               entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.guest_bedroom_lamp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;               brightness&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ (state_attr(&amp;#39;switch.circadian_lighting_circadian_lighting&amp;#39;,&amp;#39;brightness&amp;#39;)|float*(255/100)|float)|int }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;           -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;             data_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;               entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.guest_bedroom_lamp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;               color_temp&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ ((1000000)|float/state_attr(&amp;#39;sensor.circadian_values&amp;#39;,&amp;#39;colortemp&amp;#39;)|float)|int }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;         turn_off&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;           -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.turn_off&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;             data_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;               entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.guest_bedroom_lamp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;         set_level&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;         -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;           data_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;             brightness&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ brightness|int }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;             entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.guest_bedroom_lamp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;         set_temperature&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;         -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.change_brightness_and_color_temp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;           data_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;             light_ct&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.guest_bedroom_lamp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;             brightness&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{% if brightness is defined %}{{ brightness|int }}{% else %}-1{% endif %}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;         -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;           data_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;             color_temp&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ color_temp|int }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;             entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.guest_bedroom_lamp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;         max_mireds_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 370&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;         min_mireds_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 153&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;   -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; platform&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;     schema&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;     name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Guest Bedroom Lamp&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;     command_topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;cmnd/zbbridge/ZbSend&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;     state_topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;tele/zbbridge/guest_room_lamp/SENSOR&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;     command_on_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;       {&amp;quot;device&amp;quot;: &amp;quot;guest_room_lamp&amp;quot;,&amp;quot;send&amp;quot;:{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;       {%- if brightness is defined -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;       &amp;quot;Dimmer&amp;quot;: {%- if brightness == 255 -%}254{%- else -%}{{ brightness }}{%- endif -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;       {%- elif color_temp is defined -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;       &amp;quot;CT&amp;quot;: {{ color_temp }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;       {%- else -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;       &amp;quot;Power&amp;quot;: 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;       {%- endif -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;       }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;     command_off_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;{&amp;quot;device&amp;quot;: &amp;quot;guest_room_lamp&amp;quot;,&amp;quot;send&amp;quot;:{&amp;quot;Power&amp;quot;:0}}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;     state_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;       {% if value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;guest_room_lamp&amp;#39;][&amp;#39;Power&amp;#39;] == 1 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;         on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;       {% elif value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;guest_room_lamp&amp;#39;][&amp;#39;Power&amp;#39;] == 0 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;         off&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;       {% else  %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;         {{ states(&amp;#39;light.guest_bedroom_lamp&amp;#39;) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;       {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;     brightness_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;       {% if value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;guest_room_lamp&amp;#39;][&amp;#39;Dimmer&amp;#39;] is defined %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;         {% if value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;guest_room_lamp&amp;#39;][&amp;#39;Dimmer&amp;#39;] == 255 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;           254&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;         {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;           {{ value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;guest_room_lamp&amp;#39;][&amp;#39;Dimmer&amp;#39;] }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;         {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;       {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;         {{ state_attr(&amp;#39;light.guest_bedroom_lamp&amp;#39;,&amp;#39;brightness&amp;#39;) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;       {% endif %} &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;     color_temp_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;       {% if value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;guest_room_lamp&amp;#39;][&amp;#39;CT&amp;#39;] is defined %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;         {% if value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;guest_room_lamp&amp;#39;][&amp;#39;CT&amp;#39;] &amp;gt; 370 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;           370&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;         {% elif value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;guest_room_lamp&amp;#39;][&amp;#39;CT&amp;#39;] &amp;lt; 153 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;           153&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;         {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;           {{ value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;guest_room_lamp&amp;#39;][&amp;#39;CT&amp;#39;] }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;         {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;       {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;         {{ state_attr(&amp;#39;light.guest_bedroom_lamp&amp;#39;,&amp;#39;color_temp&amp;#39;) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;       {% endif %} &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;     availability_topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;tele/zbbridge/LWT&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;     payload_available&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Online&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;     payload_not_available&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Offline&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;     optimistic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; true&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;     qos&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;     max_mireds&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 370&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;     min_mireds&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 153&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So basically, Guest Bedroom Lamp is the mqtt light, and Guest bedroom lamp template is (obviously), the template light. The only reason I made a template light was so I could change the temperature and brightness at the same time. For a template light, if the brightness variable is defined, the set_level script is called. However, if brightness and color_temp are both defined, the color_temp script is called. To deal with this, I made a separate script which basically turns the light on at the desired brightness first if brightness is defined and then sends the color_temp command. The script which you can see is called from my template script is:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;alias&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; change brightness and color temp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; choose&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;{{ brightness != -1 }}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;{{ light_ct }}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              brightness&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;{{ brightness }}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    default&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;mode&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; parallel&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 100&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As you can see, my lights are also customized with the min and max color_temp and to use circadian lighting (which is an awesome HACS integration).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Group Lights&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Controlling a group of lights was also a little tricky. I set up the same MQTT and template entities for each light, but the group light required its own template entity.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; platform&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    lights&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;      kids_bath_1&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        friendly_name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;kids_bath_1&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        level_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% if state_attr(&amp;#39;light.kids_bath_1_mqtt&amp;#39;,&amp;#39;brightness&amp;#39;)|int &amp;gt;0 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ state_attr(&amp;#39;light.kids_bath_1_mqtt&amp;#39;,&amp;#39;brightness&amp;#39;) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ states(&amp;#39;light.kids_bath_1_mqtt&amp;#39;) }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        temperature_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% if state_attr(&amp;#39;light.kids_bath_1_mqtt&amp;#39;,&amp;#39;color_temp&amp;#39;)|int &amp;gt;0 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ state_attr(&amp;#39;light.kids_bath_1_mqtt&amp;#39;,&amp;#39;color_temp&amp;#39;) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        turn_on&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.kids_bath_1_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              brightness&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ (state_attr(&amp;#39;switch.circadian_lighting_circadian_lighting&amp;#39;,&amp;#39;brightness&amp;#39;)|float*(255/100)|float)|int }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.kids_bath_1_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              color_temp&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ ((1000000)|float/state_attr(&amp;#39;sensor.circadian_values&amp;#39;,&amp;#39;colortemp&amp;#39;)|float)|int }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        turn_off&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.turn_off&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.kids_bath_1_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        set_level&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          data_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            brightness&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ brightness|int }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.kids_bath_1_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        set_temperature&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.change_brightness_and_color_temp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          data_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            light_ct&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.kids_bath_1_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            brightness&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{% if brightness is defined %}{{ brightness|int }}{% else %}-1{% endif %}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          data_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            color_temp&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ color_temp|int }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.kids_bath_1_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        max_mireds_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 370&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        min_mireds_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 153&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; platform&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    schema&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;kids bath 1 mqtt&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    command_topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;cmnd/zbbridge/ZbSend&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    state_topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;tele/zbbridge/kids_bath_1/SENSOR&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    command_on_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {&amp;quot;device&amp;quot;: &amp;quot;kids_bath_1&amp;quot;,&amp;quot;send&amp;quot;:{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {%- if brightness is defined -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      &amp;quot;Dimmer&amp;quot;: {%- if brightness == 255 -%}254{%- else -%}{{ brightness }}{%- endif -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {%- elif color_temp is defined -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      &amp;quot;CT&amp;quot;: {{ color_temp }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {%- else -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      &amp;quot;Power&amp;quot;: 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {%- endif -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    command_off_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;{&amp;quot;device&amp;quot;: &amp;quot;kids_bath_1&amp;quot;,&amp;quot;send&amp;quot;:{&amp;quot;Power&amp;quot;:0}}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    state_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% if value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;kids_bath_1&amp;#39;][&amp;#39;Power&amp;#39;] == 0 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        off&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% elif value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;kids_bath_1&amp;#39;][&amp;#39;Power&amp;#39;] == 1 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% else  %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {{ states(&amp;#39;light.kids_bath_1_mqtt&amp;#39;) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    brightness_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% if value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;kids_bath_1&amp;#39;][&amp;#39;Dimmer&amp;#39;] is defined %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {% if value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;kids_bath_1&amp;#39;][&amp;#39;Dimmer&amp;#39;] == 255 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          254&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {{ value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;kids_bath_1&amp;#39;][&amp;#39;Dimmer&amp;#39;] }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {{ state_attr(&amp;#39;light.kids_bath_1_mqtt&amp;#39;,&amp;#39;brightness&amp;#39;) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% endif %} &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    color_temp_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% if value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;kids_bath_1&amp;#39;][&amp;#39;CT&amp;#39;] is defined %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {% if value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;kids_bath_1&amp;#39;][&amp;#39;CT&amp;#39;] &amp;gt; 370 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          370&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {% elif value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;kids_bath_1&amp;#39;][&amp;#39;CT&amp;#39;] &amp;lt; 153 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          153&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {{ value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;kids_bath_1&amp;#39;][&amp;#39;CT&amp;#39;] }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {{ state_attr(&amp;#39;light.kids_bath_1_mqtt&amp;#39;,&amp;#39;color_temp&amp;#39;) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% endif %} &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    availability_topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;tele/zbbridge/LWT&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    payload_available&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Online&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    payload_not_available&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Offline&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    optimistic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; false&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    qos&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    max_mireds&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 370&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    min_mireds&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 153&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; platform&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    lights&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;      kids_bath_2&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        friendly_name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;kids_bath_2&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        level_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% if state_attr(&amp;#39;light.kids_bath_2_mqtt&amp;#39;,&amp;#39;brightness&amp;#39;)|int &amp;gt;0 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ state_attr(&amp;#39;light.kids_bath_2_mqtt&amp;#39;,&amp;#39;brightness&amp;#39;) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ is_state(&amp;#39;light.kids_bath_2_mqtt&amp;#39;,&amp;#39;on&amp;#39;) }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        temperature_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% if state_attr(&amp;#39;light.kids_bath_2_mqtt&amp;#39;,&amp;#39;color_temp&amp;#39;)|int &amp;gt;0 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            {{ state_attr(&amp;#39;light.kids_bath_2_mqtt&amp;#39;,&amp;#39;color_temp&amp;#39;) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;            0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        turn_on&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.kids_bath_2_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              brightness&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ (state_attr(&amp;#39;switch.circadian_lighting_circadian_lighting&amp;#39;,&amp;#39;brightness&amp;#39;)|float*(255/100)|float)|int }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.kids_bath_2_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              color_temp&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ ((1000000)|float/state_attr(&amp;#39;sensor.circadian_values&amp;#39;,&amp;#39;colortemp&amp;#39;)|float)|int }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        turn_off&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.turn_off&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.kids_bath_2_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        set_level&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          data_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            brightness&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ brightness|int }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.kids_bath_2_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        set_temperature&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.change_brightness_and_color_temp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          data_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            light_ct&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.kids_bath_2_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            brightness&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{% if brightness is defined %}{{ brightness|int }}{% else %}-1{% endif %}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;          data_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            color_temp&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ color_temp|int }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; light.kids_bath_2_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        max_mireds_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 370&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        min_mireds_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 153&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; platform&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    schema&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;kids bath 2 mqtt&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    command_topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;cmnd/zbbridge/ZbSend&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    state_topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;tele/zbbridge/kids_bath_2/SENSOR&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    command_on_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {&amp;quot;device&amp;quot;: &amp;quot;kids_bath_2&amp;quot;,&amp;quot;send&amp;quot;:{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {%- if brightness is defined -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      &amp;quot;Dimmer&amp;quot;: {%- if brightness == 255 -%}254{%- else -%}{{ brightness }}{%- endif -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {%- elif color_temp is defined -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      &amp;quot;CT&amp;quot;: {{ color_temp }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {%- else -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      &amp;quot;Power&amp;quot;: 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {%- endif -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      },&amp;quot;endpoint&amp;quot;:1}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    command_off_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;{&amp;quot;device&amp;quot;: &amp;quot;kids_bath_2&amp;quot;,&amp;quot;send&amp;quot;:{&amp;quot;Power&amp;quot;:0}}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    state_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% if value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;kids_bath_2&amp;#39;][&amp;#39;Power&amp;#39;] == 0 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        off&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% elif value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;kids_bath_2&amp;#39;][&amp;#39;Power&amp;#39;] == 1 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% else  %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {{ states(&amp;#39;light.kids_bath_2_mqtt&amp;#39;) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    brightness_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% if value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;kids_bath_2&amp;#39;][&amp;#39;Dimmer&amp;#39;] is defined %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {% if value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;kids_bath_2&amp;#39;][&amp;#39;Dimmer&amp;#39;] == 255 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          254&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {{ value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;kids_bath_2&amp;#39;][&amp;#39;Dimmer&amp;#39;] }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {{ state_attr(&amp;#39;light.kids_bath_2_mqtt&amp;#39;,&amp;#39;brightness&amp;#39;) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% endif %} &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    color_temp_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% if value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;kids_bath_2&amp;#39;][&amp;#39;CT&amp;#39;] is defined %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {% if value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;kids_bath_2&amp;#39;][&amp;#39;CT&amp;#39;] &amp;gt; 370 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          370&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {% elif value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;kids_bath_2&amp;#39;][&amp;#39;CT&amp;#39;] &amp;lt; 153 %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          153&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;          {{ value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;kids_bath_2&amp;#39;][&amp;#39;CT&amp;#39;] }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        {{ state_attr(&amp;#39;light.kids_bath_2_mqtt&amp;#39;,&amp;#39;color_temp&amp;#39;) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;      {% endif %} &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    availability_topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;tele/zbbridge/LWT&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    payload_available&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Online&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    payload_not_available&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;Offline&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    optimistic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; false&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    qos&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    max_mireds&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 370&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    min_mireds&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 153&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; platform&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    lights&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;      kids_bath&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        friendly_name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;kids_bath&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        level_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ (state_attr(&amp;#39;light.kids_bath_1_mqtt&amp;#39;,&amp;#39;brightness&amp;#39;)|int + state_attr(&amp;#39;light.kids_bath_2_mqtt&amp;#39;,&amp;#39;brightness&amp;#39;)|int )/2 }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ is_state(&amp;#39;light.kids_bath_2_mqtt&amp;#39;,&amp;#39;on&amp;#39;) and is_state(&amp;#39;light.kids_bath_1_mqtt&amp;#39;,&amp;#39;on&amp;#39;) }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        temperature_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{{ (state_attr(&amp;#39;light.kids_bath_1_mqtt&amp;#39;,&amp;#39;color_temp&amp;#39;)|int + state_attr(&amp;#39;light.kids_bath_2_mqtt&amp;#39;,&amp;#39;color_temp&amp;#39;)|int )/2 }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        turn_on&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mqtt.publish&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; cmnd/zbbridge/ZbSend&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              payload_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {&amp;quot;group&amp;quot;: &amp;quot;101&amp;quot;,&amp;quot;send&amp;quot;:{&amp;quot;Dimmer&amp;quot;: {%- if brightness == 255 -%}254{%- else -%}{{ (state_attr(&amp;#39;switch.circadian_lighting_circadian_lighting&amp;#39;,&amp;#39;brightness&amp;#39;)|float*(255/100)|float)|int }}{%- endif -%}}}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mqtt.publish&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; cmnd/zbbridge/ZbSend&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              payload_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {&amp;quot;group&amp;quot;: &amp;quot;101&amp;quot;,&amp;quot;send&amp;quot;:{&amp;quot;CT&amp;quot;: {{ ((1000000)|float/state_attr(&amp;#39;sensor.circadian_values&amp;#39;,&amp;#39;colortemp&amp;#39;)|float)|int }} }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        turn_off&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mqtt.publish&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; cmnd/zbbridge/ZbSend&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              payload_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;{&amp;quot;group&amp;quot;: &amp;quot;101&amp;quot;,&amp;quot;send&amp;quot;:{&amp;quot;Power&amp;quot;:0}}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        set_level&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mqtt.publish&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; cmnd/zbbridge/ZbSend&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              payload_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {&amp;quot;group&amp;quot;: &amp;quot;101&amp;quot;,&amp;quot;send&amp;quot;:{&amp;quot;Dimmer&amp;quot;: {%- if brightness == 255 -%}254{%- else -%}{{ brightness|int }}{%- endif -%}}}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        set_temperature&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; script.change_brightness_and_color_temp_group&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              group&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 101&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              brightness&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;{% if brightness is defined %}{{ brightness|int }}{% else %}-1{% endif %}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mqtt.publish&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; cmnd/zbbridge/ZbSend&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              payload_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {&amp;quot;group&amp;quot;: &amp;quot;101&amp;quot;,&amp;quot;send&amp;quot;:{&amp;quot;CT&amp;quot;: {{color_temp}} }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        max_mireds_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 370&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        min_mireds_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 153&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This assumes an arbitrarily defined group number of 101 and uses a similar script to control both brightness and color_temp at the same time.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;alias&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; change brightness and color temp group&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; choose&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;      -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; conditions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; condition&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            value_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;{{ brightness != -1 }}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;        sequence&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;          -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; mqtt.publish&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;            data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              topic&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; cmnd/zbbridge/ZbSend&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;              payload_template&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                {&amp;quot;group&amp;quot;: &amp;quot;{{ group }}&amp;quot;,&amp;quot;send&amp;quot;:{&amp;quot;Dimmer&amp;quot;: {%- if brightness ==&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;                255 -%}254{%- else -%}{{ brightness|int }}{%- endif -%}}}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    default&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;mode&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; parallel&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 100&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;As you can see, Zigbee2Tasmota is a fairly powerful platform, incredibly operating on a system with very limited resources. It is not for everyone, but could be enticing primarily for people with the Tasmotized Sonoff Zigbee Bridge. Connecting a WiFi device to Home Assistant through serial over TCP may not be the best or most stable setup. Instead allowing the coordinator to function independently and sharing the device information over MQTT might be more desirable.&lt;/p&gt;
&lt;p&gt;On the other hand, if you have Tube&#39;s wired zigbee coordinator or the ZB-GW03 wired coordinator, you may be better off using ZHA for simplicity sake. Regarding Zigbee2MQTT, it should be noted that the EZSP radio found in the Sonoff Zigbee Adapter and the ZB-GW03 is not finalized and may be &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/Koenkk/zigbee-herdsman/issues/319&quot;&gt;buggy&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Links to adapters:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sonoff Zigbee&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Affiliate link:&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.amazon.com/gp/product/B08BFT44QL/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=B08BFT44QL&amp;amp;linkCode=as2&amp;amp;tag=thehelpfulidi-20&amp;amp;linkId=966fb5890513e368640eaf0f517c82f8&quot;&gt;SONOFF ZBBridge Smart Zigbee Bridge Hub, WI-FI &amp;amp; Zigbee Dual-protocol Supporting, APP Control and Multi-device Management&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Non-affiliate link:&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.amazon.com/ZBBridge-Dual-protocol-Supporting-Multi-device-Management/dp/B08BFT44QL/ref=sr_1_2?crid=2A7KXG2H6EAIN&amp;amp;dchild=1&amp;amp;keywords=sonoff+zigbee&amp;amp;qid=1633193142&amp;amp;sprefix=sonoff+zigbee%2Caps%2C167&amp;amp;sr=8-2&quot;&gt;SONOFF ZBBridge Smart Zigbee Bridge Hub, WI-FI &amp;amp; Zigbee Dual-protocol Supporting, APP Control and Multi-device Management&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://ewelink.eachen.cc/product/eachen-ewelink-zigbee-bridge-pro-zbbridge-pro/&quot;&gt;&lt;strong&gt;Eachen ZB-GW03&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.tubeszb.com/product/cc2652_coordinator/1?cp=true&amp;amp;sa=false&amp;amp;sbp=false&amp;amp;q=false&amp;amp;category_id=2&quot;&gt;&lt;strong&gt;Tube&#39;s ZB Coordinator&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Let me know if you have any questions. Thanks for reading!&lt;/p&gt;
&lt;p&gt;Edit: changed instances of zigbee router to the correct terminology zigbee coordinator thanks to /u/chick_repellent.&lt;/p&gt;
</description>
      </item>
      <item>
          <title>Playing a sound directly from Home Assistant Operating System</title>
          <pubDate>Sat, 02 Oct 2021 00:00:00 +0000</pubDate>
          <author>thehelpfulidiot</author>
          <link>https://thehelpfulidiot.com/playing-a-sound-directly-from-home-assistant-operating-system/</link>
          <guid>https://thehelpfulidiot.com/playing-a-sound-directly-from-home-assistant-operating-system/</guid>
          <description xml:base="https://thehelpfulidiot.com/playing-a-sound-directly-from-home-assistant-operating-system/">&lt;p&gt;This may sound like it should&#39;ve been a trivial task to accomplish but took me way longer to solve than I anticipated. As I said it my &lt;a href=&quot;/hello-world&quot;&gt;first post&lt;/a&gt;, I started my Home Automation journey with things like Nest. This included the (now &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://killedbygoogle.com/&quot;&gt;killedbygoogle&lt;/a&gt;) Nest Secure with Nest Detects. I did enjoy a very pleasing *DING *each time a door opened.  As time went on, I tried to distance myself as much as possible from the cloud.&lt;/p&gt;
&lt;p&gt;Integrating them into Home Assistant was a major PITA though. I had to purchase the amazing &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.starlinghome.io/&quot;&gt;Starling Home Hub&lt;/a&gt;, and use Homekit to create an automation where each door open and door close event would trigger an automation to control an MQTT switch through Homebridge which would then pass the information into Home Assistant. This worked pretty well for the most part, but once the batteries started to die in the Nest Detects, it seemed like the perfect opportunity to replace the door sensors.&lt;/p&gt;
&lt;p&gt;I just purchased cheap Aqara Door Sensors and mounted them on my door. Obviously, the open/close information was passed far more easily into Home Assistant and I was able to simplify my work flow, but one thing I did miss was the &lt;em&gt;DING&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;&lt;audio controls src=&quot;/wp-content/uploads/2021/10/chime.wav&quot;&gt;&lt;/audio&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;DING&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I wanted something as simple as possible, and to me, the obvious solution was to connect a speaker to my Home Assistant box&#39;s 3.5mm jack and just play the sound. This was wayyyy more complicated than I expected.&lt;/p&gt;
&lt;p&gt;Home Assistant&#39;s addon store has a very bizarre version of VLC. It seems like it is feature incomplete and has almost no options. I couldn&#39;t figure out how to use it.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/10/image-3-1024x384.png&quot; alt=&quot;VLC from Official Add-on Store&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;VLC from Official Add-on Store&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Fortunately, there exists another version of VLC from a repository belonging to &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/rodripf/hassio-local-vlc&quot;&gt;rodripf&lt;/a&gt;. Simply add the following address to the add-on repository list to install it:&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/rodripf/hassio-local-vlc&quot;&gt;https://github.com/rodripf/hassio-local-vlc&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Once installed, it can be configured for telnet access. This is what I found to be the easiest and most reliable way to play a sound. Set the following options as desired.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/10/image-4.png&quot; alt=&quot;Local VLC add-on options: telnet and HTTP passwords, ports 4212 and 9892, audio output&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Once that is set up, it is necessary to add a &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.home-assistant.io/integrations/vlc_telnet/&quot;&gt;vlc_telnet&lt;/a&gt; entity which is done through yaml.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;media_player&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;  -&lt;/span&gt;&lt;span class=&quot;z-3&quot;&gt; platform&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; vlc_telnet&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; vlc&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    host&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; 6872d8d8-local-vlc&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    password&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;lt;secret password&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Edit the entry as you see fit, but the important thing is the host, which identifies the Home Assistant container, should be written as above.&lt;/p&gt;
&lt;p&gt;After a reboot, &quot;media_player.vlc&quot; should exist and through this, you can play whatever sound you want, locally. Although, I had trouble playing the music unless I uploaded it to the &quot;/share&quot; directory.&lt;/p&gt;
&lt;p&gt;Once you&#39;ve uploaded your sound file to the /share directory, the following will play it:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.play_media&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.vlc&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  media_content_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /share/chime.wav&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  media_content_type&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; music&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It is important to make the media_content_type &quot;music&quot; as that is the only media type currently playable by the vlc_telnet integration.&lt;/p&gt;
&lt;p&gt;You can go to a web gui of your VLC instance by going to your homeassistanturl:9892 and using the password you created in the addon settings page.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/10/image-5.png&quot; alt=&quot;VLC web interface with a playlist loaded&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;It&#39;s important to make sure your volume here is set to something reasonable. At first, I could not get any sound to play since the volume defaulted to 0.&lt;/p&gt;
&lt;p&gt;You can also set the volume through Home Assistant as you would for any media player.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;service&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.volume_set&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  entity_id&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; media_player.vlc&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  volume_level&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0.35&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Hope that helps. Seems like a fairly complex solution for a fairly simply problem, but like I said, this was the only way I could figure to do something like this from within Home Assistant Operating System (obviously other installations in standard operating systems can probably do this trivially).&lt;/p&gt;
&lt;p&gt;The nice thing about this as opposed to the Nest solution, is that now I have control over when the door dings and when it doesn&#39;t. For example, my ding automation does not fire when my kids are asleep. Now I don&#39;t have to worry about waking them when I run out to the car.&lt;/p&gt;
&lt;p&gt;Thanks for reading.&lt;/p&gt;
&lt;p&gt;&lt;audio controls src=&quot;/wp-content/uploads/2021/10/chime.wav&quot;&gt;&lt;/audio&gt;&lt;/p&gt;
</description>
      </item>
      <item>
          <title>A Wired Sonoff Zigbee Alternative</title>
          <pubDate>Wed, 29 Sep 2021 00:00:00 +0000</pubDate>
          <author>thehelpfulidiot</author>
          <link>https://thehelpfulidiot.com/a-wired-sonoff-zigbee-alternative/</link>
          <guid>https://thehelpfulidiot.com/a-wired-sonoff-zigbee-alternative/</guid>
          <description xml:base="https://thehelpfulidiot.com/a-wired-sonoff-zigbee-alternative/">&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;/update-a-wired-sonoff-zigbee-alternative&quot;&gt;UPDATE 10/15: READ IF YOU PLAN TO USE HUB WITH ZHA&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;/update-2-a-wired-sonoff-zigbee-alternative&quot;&gt;UPDATE 10/18: READ IF YOU PLAN TO USE HUB WITH Zigbee2Tasmota&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UPDATE 12/5: We&#39;ve come full circle. The amazing developers of Tasmota have fixed the issue causing serial port disconnections to the zigbee radio with Tasmota 10. Now, the below instructions can be followed, without relying on the previous update posts from 10/15 and 10/18. The uploaded precompiled Tasmota firmware below has been updated to the newest version as of today.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Many of us have seen the Sonoff Zigbee Hub and how easy it is to flash to Tasmota thanks to many awesome videos and my personal favorite by &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.digiblur.com/2020/07/how-to-use-sonoff-zigbee-bridge-with.html&quot;&gt;DigiblurDIY&lt;/a&gt;. The device is amazing and works well, but some things like your Zigbee bridge shouldn&#39;t rely on WiFi.&lt;/p&gt;
&lt;p&gt;Recently, another amazing individual going by Tube has created a homemade Franken Zigbee router using an ESP32 board, ethernet, zigbee, and a 3D printed case. It comes preflashed with ESPHome and is instantly compatible with Home Assistant ZHA or Zigbee2MQTT. However, each one of these devices is being made by hand and supply cannot meet demand.&lt;/p&gt;
&lt;p&gt;I came across another wired zigbee hub using an ESP32 - &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://ewelink.eachen.cc/product/eachen-ewelink-zigbee-bridge-pro-zbbridge-pro/&quot;&gt;the EACHEN Zigbee Bridge Pro&lt;/a&gt;. For only $30, I thought I would give it a try. It shipped from China, but arrived fairly quickly after only a couple of weeks.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/09/IMG_8685-1024x768.jpg&quot; alt=&quot;The hub&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;The hub&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/09/IMG_8686-1024x768.jpg&quot; alt=&quot;An ethernet port, a USB-C power port, and a reset pin hole&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;An ethernet port, a USB-C power port, and a reset pin hole&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The device is probably the same size as the Sonoff Zigbee Router. It is easy enough to disassemble though since there are no screws and the bottom can simply be pried off.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/09/IMG_8688-1024x768.jpg&quot; alt=&quot;The board&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;The board&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The board pops right out. It is now ripe for flashing and you can see some solder still on mine. My experience with Tasmota so far had been with mainly Tuya-convert and flashing the Sonoff Zigbee router which did not require soldering. This was my first time soldering and was way more fun than I expected.&lt;/p&gt;
&lt;p&gt;Now before we get to soldering and flashing, we need to compile our own Tasmota firmware. We need to make sure Tasmota has access to the Ethernet port and the Zigbee Radio. As in all things Tasmota, &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://templates.blakadder.com/ewelink_ZB-GW03&quot;&gt;Blakadder&lt;/a&gt; has a page devoted to this device and instructions. The instructions were excellent, but assumed a certain level of knowledge to compile the firmware. Having not done this before, this part took me the longest. The tasmota32-zigbeebridge precompiled firmware mentioned on the site did not provide ethernet access or else this process would have been a lot easier.&lt;/p&gt;
&lt;p&gt;After much trial and error, the easiest way I found to compile this firmware was by going to &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://gitpod.io/#https://github.com/arendst/Tasmota/tree/master&quot;&gt;GitPod&lt;/a&gt;. After you log in, you are taken to a VS code window prepopulated with the latest Tasmota build.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/09/gitpod-1024x493.png&quot; alt=&quot;Tasmota repository opened in a GitPod workspace&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The instructions from Blakadder&#39;s website say to edit two files- user_config_override.h and platform_override.ini.&lt;/p&gt;
&lt;p&gt;&#39;Platform_override.ini&#39; is located in the root directory - /workspace/Tasmota. Open the file, scroll to the bottom, and add:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;env:tasmota32-EWELINK&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;                 =&lt;/span&gt;&lt;span&gt; env:tasmota32&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;board_build.f_cpu&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;       =&lt;/span&gt;&lt;span&gt; 240000000L&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;board_build.f_flash&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;     =&lt;/span&gt;&lt;span&gt; 40000000L&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;build_flags&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;             =&lt;/span&gt;&lt;span&gt; ${env:tasmota32_base.build_flags} -DFIRMWARE_EWELINK&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/09/image-2-1024x395.png&quot; alt=&quot;platformio_override.ini with the tasmota32-EWELINK environment added&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Now find the &#39;user_config_override.h&#39; file which is located in the tasmota subdirectory (/workspace/Tasmota/tasmota). Open that file, erase all its contents and replace with:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;#ifdef&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; FIRMWARE_EWELINK&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;  #warning&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; **** Build: FIRMWARE FOR EWELINK ZB-GW03-V1.2 ****&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;  #undef&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;  SERIAL_LOG_LEVEL&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;  #define&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; SERIAL_LOG_LEVEL&lt;/span&gt;&lt;span&gt; LOG_LEVEL_NONE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;  #define&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; USE_ZIGBEE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;  #undef&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;  USE_ZIGBEE_ZNP&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;  #define&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; USE_ZIGBEE_EZSP&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;  #define&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; USE_UFILESYS&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;  #define&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; USE_ZIGBEE_EEPROM&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt; // T24C512A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;  #define&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; USE_TCP_BRIDGE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;  #undef&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;  USE_ZIGBEE_CHANNEL&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;  #define&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; USE_ZIGBEE_CHANNEL&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 11&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt; // (11-26)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;  #define&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; USE_ETHERNET&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;  #undef&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;  ETH_TYPE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;  #define&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; ETH_TYPE&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt; // ETH_PHY_LAN8720&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;  #undef&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;  ETH_CLKMODE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;  #define&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; ETH_CLKMODE&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 3&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt; // ETH_CLOCK_GPIO17_OUT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;  #undef&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;  ETH_ADDRESS&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-10&quot;&gt;  #define&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; ETH_ADDRESS&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-4 z-i&quot;&gt; // PHY1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#endif&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Ok, so those two parts were relatively easy, but the next part on how to compile took me probably longer than it should have to figure it out. In the terminal at the bottom of the screen, while in the /workspace/Tasmota directory, type the following:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;platformio&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; run -e tasmota32-EWELINK&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/09/image-1-1024x321.png&quot; alt=&quot;GitPod terminal running platformio run -e tasmota32-EWELINK&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Now wait patiently for the new firmware to compile. Once it does, it can be found in /workspace/Tasmota/build_output/firmware. Download &#39;tasmota32-EWELINK.bin.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/wp-content/uploads/2021/12/tasmota32-EWELINK.bin&quot;&gt;tasmota32-EWELINK&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;del&gt;I compiled this on 10/7/2021, Tasmota32 9.5.0. I promise that I did not tamper with it (and would not know how to tamper with it if I wanted), but you should probably not download firmware from some random guy on the internet.&lt;/del&gt;&lt;/p&gt;
&lt;p&gt;This is Tasmota 10 firmware compiled 12/5/21 using the above method. It should work as intended without the previously described work-arounds.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;NOTE: As reported by erkoc, my new tasmota firmware&lt;/strong&gt; &lt;strong&gt;based on v10 was still giving him the same issue with reboots losing connection to ZHA without manual intervention. He forked Tasmota32 and made sure the serial communication patch was included. He has instructions on how to compile your own or you can simply download his precompiled version.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/vahempio/Tasmota-for-eWeLink&quot;&gt;&lt;strong&gt;https://github.com/vahempio/Tasmota-for-eWeLink&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Ok, now that we have the firmware, it&#39;s time to start flashing. Since we have an ESP32. I do not believe we can use Tasmotizer. I have Windows and used &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/Jason2866/ESP_Flasher/releases&quot;&gt;ESP-Flasher-Windows-x64&lt;/a&gt;. Open it up, choose your serial port, the firmware we just compiled.&lt;/p&gt;
&lt;p&gt;Now the fun part with soldering. Below I have a photo of the ESP32 board and the corresponding connection on my Serial Adapter (I use this &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.amazon.com/gp/product/B00IJXZQ7C/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;amp;psc=1&quot;&gt;one&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/09/image-3-1024x767.png&quot; alt=&quot;ESP32 board - labels point to corresponding pin on Serial Converter&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;ESP32 board - labels point to corresponding pin on Serial Converter&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/09/image-4-1024x770.png&quot; alt=&quot;Serial Converter - labels point to corresponding pin on ESP32&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Serial Converter - labels point to corresponding pin on ESP32&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Now Flash.&lt;/p&gt;
&lt;p&gt;Once you finish, it&#39;s a matter of setting up Tasmota and a few more finishing touches.&lt;/p&gt;
&lt;p&gt;Set up Tasmota through the access point first and add this Template by issuing the following command:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backlog Template {&amp;quot;NAME&amp;quot;:&amp;quot;ZB-GW03-V1.2&amp;quot;,&amp;quot;GPIO&amp;quot;:[0,0,3552,0,3584,0,0,0,5793,5792,320,544,5536,0,5600,0,0,0,0,5568,0,0,0,0,0,0,0,0,608,640,32,0,0,0,0,0],&amp;quot;FLAG&amp;quot;:0,&amp;quot;BASE&amp;quot;:1} ; module 0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;From this &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://github.com/arendst/Tasmota/tree/development/tools/fw_SonoffZigbeeBridge_ezsp&quot;&gt;website&lt;/a&gt;, select &lt;code&gt;ncp-uart-sw-6.7.8_115200.ota&lt;/code&gt;. Go to the upgrade firmware screen to update the zigbee radio. The device will automatically recognize this as firmware for the zigbee radio and will apply it accordingly.&lt;/p&gt;
&lt;p&gt;Now try plugging the device in to Ethernet. I noticed it was sort of strange and took a couple reboots and unplugging and plugging the cable back in, but I saw messages about setting up the Eth connection in the console. There was no real way to change Ethernet settings like you can with WiFi, but I noticed two DHCP listings in my router. Once Ethernet is set up, you can disconnect WiFi with the following, but do not do the following until Ethernet is set up! Make sure the first command turning WiFi off works first before applying the subsequent rule which will disable it on each reboot. The first command by itself will not persist across reboots.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Wifi 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backlog rule2 on system#boot do Wifi 0 endon ; rule2 1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If something went wrong and now you are locked out of the device because Ethernet isn&#39;t working and WiFi is down, you can try &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://tasmota.github.io/docs/Device-Recovery/#fast-power-cycle-device-recovery&quot;&gt;Tasmota device recovery&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The device is now set up to use with &lt;a href=&quot;/how-to-use-zigbee2tasmota-with-home-assistant&quot;&gt;Zigbee2Tasmota&lt;/a&gt;. For Home Assistant, there are a few more steps.&lt;/p&gt;
&lt;p&gt;To integrate with Home Assistant, we must remap the Zigbee Tx and Zigbee Rx pins directly to TCP Tx and TCP Rx. This will disable Zigbee2Tasmota, but will allow the device to integrate with Home Assistant. Use the following command to update the template:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backlog template {&amp;quot;NAME&amp;quot;:&amp;quot;ZHA-bridge&amp;quot;,&amp;quot;GPIO&amp;quot;:[0,0,5472,0,5504,0,0,0,5793,5792,320,544,5536,0,5600,0,0,0,0,5568,0,0,0,0,0,0,0,0,608,640,32,0,0,0,0,0],&amp;quot;FLAG&amp;quot;:0,&amp;quot;BASE&amp;quot;:1} ; module 0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Notice the change in the third and fifth positions. Afterwards, it will be possible to start the TCP Server which is what ZHA needs to connect to the coordinator.&lt;/p&gt;
&lt;p&gt;Enter the following from the console to turn on the webserver for the Zigbee radio:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backlog rule1 on system#boot do TCPStart 8888 endon ; rule1 1 ; tcpstart 8888&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Finally, you can jump into Home Assistant and set up the device for ZHA exactly how it&#39;s (masterfully) described by DigiBlur.&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.digiblur.com/2020/07/how-to-use-sonoff-zigbee-bridge-with.html&quot;&gt;https://www.digiblur.com/2020/07/how-to-use-sonoff-zigbee-bridge-with.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thanks for reading. I hope this helps fill in the blanks for some folks like myself who are not as familiar with the inner workings of Tasmota. Please let me know if you have any questions.&lt;/p&gt;
&lt;p&gt;Thanks to DigiBlur and Blakadder and all the other folks who did the hard work in getting this device to work.&lt;/p&gt;
&lt;h2 id=&quot;alternative-a-single-template-no-toggling&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#alternative-a-single-template-no-toggling&quot; aria-label=&quot;Anchor link for: alternative-a-single-template-no-toggling&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Alternative: a single template, no toggling&lt;/h2&gt;
&lt;p&gt;A reader working through this guide found a cleaner approach that avoids the
ZHA/Z2T toggling described above entirely. Rather than the &lt;code&gt;ZHA-bridge&lt;/code&gt;
template, use:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;backlog template {&amp;quot;NAME&amp;quot;:&amp;quot;Zig_Bridge32&amp;quot;,&amp;quot;GPIO&amp;quot;:[1,1,5472,1,5504,1,1,1,5793,5792,320,544,5536,1,5600,1,0,1,1,5568,0,1,1,1,0,0,0,0,608,640,32,1,1,3552,3584,1],&amp;quot;FLAG&amp;quot;:0,&amp;quot;BASE&amp;quot;:1}; module 0;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The reasoning: the &lt;code&gt;ZHA-bridge&lt;/code&gt; template has no Zigbee Tx/Rx GPIOs at all, so
Tasmota never resets the EZSP chip at boot. Mapping Zigbee Rx and Tx to
otherwise unused GPIOs means the reset does happen, and the TCP connection
works across a cold start. The Zigbee2Tasmota UI is still visible but unused.&lt;/p&gt;
&lt;p&gt;For Zigbee2MQTT, adding this to your config makes it reconnect within a minute
of a bridge reboot:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;availability&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  active&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;    timeout&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;link-to-purchase&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#link-to-purchase&quot; aria-label=&quot;Anchor link for: link-to-purchase&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/a&gt;
Link to Purchase&lt;/h2&gt;
&lt;p&gt;Affiliate Link:&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://s.click.aliexpress.com/e/_9IDiIh&quot;&gt;AliExpress.com Product - EACHEN EWeLink Zigbee Bridge Pro (Zbbridge Pro)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://s.click.aliexpress.com/e/_Ac5sZP&quot;&gt;eWelink ZigBee 3.0 Smart Wired Wireless Gateway Hub&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Non-Affiliate Link:&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.aliexpress.com/item/4000459723849.html&quot;&gt;AliExpress.com Product - EACHEN EWeLink Zigbee Bridge Pro (Zbbridge Pro)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;e&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://www.aliexpress.com/item/1005003020568421.html&quot;&gt;Welink ZigBee 3.0 Smart Wired Wireless Gateway Hub&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;EACHEN Website:&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://ewelink.eachen.cc/product/eachen-ewelink-zigbee-bridge-pro-zbbridge-pro/&quot;&gt;EACHEN eWeLink Zigbee Bridge Pro (zbbridge pro)&lt;/a&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;CORRECTION 10/2: added steps to remap zigbee Tx and Rx to TCP.&lt;/p&gt;
&lt;p&gt;CORRECTION 10/7: made changes based on feedback from /u/Vertigo722. Edited platformIO text. Changed some order of setup.&lt;/p&gt;
&lt;p&gt;CORRECTION 10/14: hard reset of the coordinator breaks connection with ZHA until toggled back to Z2T and then back again. Using this firmware and the rules below automatically toggle back and forth only on cut power. Hopefully this workaround fixes things for now.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/wp-content/uploads/2021/10/tasmota32-EWELINK-1.bin&quot;&gt;tasmota32-EWELINK-1&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;/update-a-wired-sonoff-zigbee-alternative&quot;&gt;UPDATE 10/15: READ IF YOU PLAN TO USE HUB WITH ZHA&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;/update-2-a-wired-sonoff-zigbee-alternative&quot;&gt;UPDATE 10/18: READ IF YOU PLAN TO USE HUB WITH Zigbee2Tasmota&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
</description>
      </item>
      <item>
          <title>About</title>
          <pubDate>Wed, 29 Sep 2021 00:00:00 +0000</pubDate>
          <author>thehelpfulidiot</author>
          <link>https://thehelpfulidiot.com/about/</link>
          <guid>https://thehelpfulidiot.com/about/</guid>
          <description xml:base="https://thehelpfulidiot.com/about/">&lt;p&gt;As someone without a tech background, my introduction to the world of self hosting and home automation began as a slow and bumpy ride with many false starts. Since beginning seriously in 2019, I am proud of what I have accomplished with OPNsense, Home Assistant, Proxmox, Docker, to name a few. Here is a tech blog, not from a computer scientist or an engineer, but from an ophthalmologist.&lt;/p&gt;
</description>
      </item>
      <item>
          <title>The Birth of a Smart Home</title>
          <pubDate>Wed, 29 Sep 2021 00:00:00 +0000</pubDate>
          <author>thehelpfulidiot</author>
          <link>https://thehelpfulidiot.com/hello-world/</link>
          <guid>https://thehelpfulidiot.com/hello-world/</guid>
          <description xml:base="https://thehelpfulidiot.com/hello-world/">&lt;p&gt;When the first Google Home came out in 2016, I briefly thought about buying it, but decided I had no use for it. Shortly after, my brother-in-law bought me two Chinese Tuya White-label smart plugs from Amazon. I plugged a couple of lamps into them and was hooked. Google home followed shortly after. At the time, we were renting and so my ability to &quot;smartify&quot; our home was limited. I replaced many light bulbs with Sengled bulbs, changed out smoke detectors for Nest, but that was pretty much it.&lt;/p&gt;
&lt;p&gt;In 2019 we bought our first home. I knew from the beginning that building a smart home would be an obsession. During the year leading up to the move, I kept my eye on deals and snatched up some of the essentials- Hue light bulbs, Nest smoke detectors, Nest lock, Nest thermostats, and maybe a few others. Anything that could be replaced by an electronic wireless device was on the chopping block.&lt;/p&gt;
&lt;p&gt;At this point I knew nothing about Linux or Home Assistant. The best smart home options were the well-known cloud versions. I set up a few automations with SmartThings, but that was it.&lt;/p&gt;
&lt;p&gt;After a few months, I came across a Reddit Post about &lt;a class=&quot;external&quot; rel=&quot;external&quot; href=&quot;https://iot.mozilla.org/gateway/&quot;&gt;Mozilla Webthings&lt;/a&gt;. It was an incredibly simple smart home solution which could be installed on a raspberry pi. I drove straight to Micro Center to pick up the necessary equipment and got started. This solution was game changing but I quickly reached it&#39;s limitations and the never-ending quest for smart home supremacy began.&lt;/p&gt;
&lt;p&gt;Below is a diagram of my current setup:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/09/Network-Diagram-1-1024x576.png&quot; alt=&quot;Network Diagram&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; /&gt;
&lt;em&gt;Network Diagram&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Initially, I migrated everything to the fewest number of boxes as possible. This scared me since there was only a single point of failure. More recently, I have purchased very cheap celeron computers from Amazon Warehouse and have used a few to host various services.&lt;/p&gt;
&lt;p&gt;I hope to share some lessons learned as someone who entered this knowing nothing and after a lot of hard work, I can honestly say I know more than nothing, but still very little.&lt;/p&gt;
&lt;p&gt;Thanks for reading.&lt;/p&gt;
</description>
      </item>
    </channel>
</rss>
