<?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, 16 Sep 2024 00:00:00 +0000</lastBuildDate>
      <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;p&gt;Part 1 - &lt;a href=&quot;/making-an-automatic-email-backup&quot;&gt;https://thehelpfulidiot.com/making-an-automatic-email-backup&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Part 2 -&lt;a href=&quot;/making-an-automatic-email-backup-part-2&quot;&gt;https://thehelpfulidiot.com/making-an-automatic-email-backup-part-2&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Part 3 - &lt;a href=&quot;/making-an-automatic-email-backup-part-3&quot;&gt;https://thehelpfulidiot.com/making-an-automatic-email-backup-part-3&lt;/a&gt;&lt;/p&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	# set max upload size&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        client_max_body_size 512M;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        fastcgi_buffers 64 4K;&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;	include mime.types;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	types &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&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;        # Enable gzip but do not remove ETag headers&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gzip on;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gzip_vary on;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gzip_comp_level 4;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gzip_min_length 256;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gzip_types 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&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&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&gt;        # HTTP response headers borrowed from Nextcloud `.htaccess`&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        add_header Referrer-Policy                      &amp;quot;no-referrer&amp;quot;       always;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        add_header X-Content-Type-Options               &amp;quot;nosniff&amp;quot;           always;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        add_header X-Download-Options                   &amp;quot;noopen&amp;quot;            always;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        add_header X-Frame-Options                      &amp;quot;SAMEORIGIN&amp;quot;        always;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        add_header X-Permitted-Cross-Domain-Policies    &amp;quot;none&amp;quot;              always;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        add_header X-Robots-Tag                         &amp;quot;noindex, nofollow&amp;quot; always;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        add_header X-XSS-Protection                     &amp;quot;1; mode=block&amp;quot;     always;&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;        # 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&gt;        fastcgi_hide_header X-Powered-By;&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;        # Path to the root of your installation&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        root /var/www/html;&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;        # 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&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&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&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&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&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&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&gt;        # `/updater`, `/ocm-provider`, `/ocs-provider`), and thus&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;        # always provides the desired behaviour.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        index index.php index.html /index.php$request_uri;&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;        # 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&gt;        location = / {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if ( $http_user_agent ~ ^DavClnt ) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return 302 /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&gt;        location = /robots.txt {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            allow all;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            log_not_found off;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            access_log off;&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;        # 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&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&gt;        # `location ~ /(\.|autotest|...)` which would otherwise handle requests&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        # for `/.well-known`.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        location ^~ /.well-known {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&gt;            location = /.well-known/carddav { return 301 /remote.php/dav/; }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            location = /.well-known/caldav  { return 301 /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&gt;            location /.well-known/acme-challenge    { try_files $uri $uri/ =404; }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            location /.well-known/pki-validation    { try_files $uri $uri/ =404; }&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;            # 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&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&gt;            return 301 /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&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&gt;        location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/)  { return 404; }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console)                { return 404; }&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;        # 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&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&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&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&gt;        location ~ \.php(?:$|/) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            # Required for legacy support&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy) /index.php$request_uri;&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;            fastcgi_split_path_info ^(.+?\.php)(/.*)$;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            set $path_info $fastcgi_path_info;&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;            try_files $fastcgi_script_name =404;&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;            include fastcgi_params;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            fastcgi_param PATH_INFO $path_info;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            fastcgi_param modHeadersAvailable true;         # Avoid sending the security headers twice&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            fastcgi_param front_controller_active true;     # Enable pretty urls&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            fastcgi_pass nextcloud-nextcloud-1:9000;&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;            fastcgi_intercept_errors on;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            fastcgi_request_buffering off;&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;    	location ~ \.(?:css|js|mjs|svg|gif|png|jpg|ico|wasm|tflite|map|ogg|flac)$ {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            try_files $uri /index.php$request_uri;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            expires 6M;         # Cache-Control policy borrowed from `.htaccess`&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            access_log off;     # 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&gt;        location ~ \.woff2?$ {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            try_files $uri /index.php$request_uri;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            expires 7d;         # Cache-Control policy borrowed from `.htaccess`&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            access_log off;     # 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&gt;        # Rule borrowed from `.htaccess`&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        location /remote {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 301 /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&gt;	location ^~ /push/ {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        	proxy_pass http://nextcloud_notify:7867/;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        	proxy_http_version 1.1;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        	proxy_set_header Upgrade $http_upgrade;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        	proxy_set_header Connection &amp;quot;Upgrade&amp;quot;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        	proxy_set_header Host $host;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;&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&gt;        location / {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;		proxy_set_header Host $host;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		proxy_set_header X-Real-IP $remote_addr;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		proxy_set_header X-Forwarded-Proto $scheme;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		proxy_set_header X-Forwarded-Host $server_name;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&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&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&gt;import json&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import evdev # https://pypi.org/project/evdev/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import asyncio&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import aiohttp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import logging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import os&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;import 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&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.basicConfig(level=os.environ.get(&amp;quot;LOGLEVEL&amp;quot;, &amp;quot;INFO&amp;quot;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;logging.getLogger(&amp;#39;asyncio&amp;#39;).setLevel(logging.CRITICAL)&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      = &amp;quot;http://IP_ADDRESS:8123/api/&amp;quot;  # URL to your HA instance.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DEV_INPUT     = &amp;quot;/dev/remote_&amp;quot;             &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;API_KEY       = &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 = &amp;quot;bt_remote&amp;quot; # 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   = True # 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    = &amp;quot;events/&amp;quot; + HA_EVENT_NAME&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;BASE_API_URL  = BASE_API + EVENT_PATH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;HEADERS       = {&amp;#39;content-type&amp;#39;: &amp;#39;application/json&amp;#39;,&amp;#39;Authorization&amp;#39;: &amp;#39;Bearer {}&amp;#39;.format(API_KEY)}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CMD           = &amp;quot;cmd&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CMD_TYPE      = &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       = &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 = &amp;quot;Fired event {} with event data{}&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;async def run():&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  device = evdev.InputDevice(DEV_INPUT + sys.argv[1])&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  print(&amp;quot;Using Bluetooth&amp;quot;, str(device))&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;  if GRAB_DEVICE:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    device.grab()&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;  # 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&gt;  for event in device.read_loop():&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if event.type == evdev.ecodes.EV_KEY:   &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;      # KEY_HOME    &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      # KEY_F5      &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      # KEY_COMPOSE   &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      # KEY_BACK       &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      # KEY_UP          &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      # KEY_DOWN   &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      # KEY_LEFT      &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      # KEY_RIGHT    &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      # KEY_ENTER      &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      # KEY_VOLUMEUP   &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&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&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 = str(evdev.categorize(event)).split(&amp;quot;,&amp;quot;)[1].split(&amp;quot;(&amp;quot;)[1].replace(&amp;quot;)&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&gt;      cmd_num = str(evdev.categorize(event)).split(&amp;quot;,&amp;quot;)[1].split(&amp;quot;(&amp;quot;)[0].replace(&amp;quot; &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&gt;      # Get the type of keypress, one of:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      # up&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      # down&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      # hold&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      cmd_type = str(evdev.categorize(event)).split(&amp;quot;,&amp;quot;)[2].replace(&amp;quot; &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&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 = {CMD: cmd, CMD_TYPE: cmd_type, CMD_NUM: cmd_num}&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;      # 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&gt;      async with aiohttp.ClientSession() as session:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        await session.post(BASE_API_URL, data=json.dumps(payload), headers=HEADERS)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        logging.info(EVENT_LOG_TEMPLATE.format(HA_EVENT_NAME,payload))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        await session.close()&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 __name__ == &amp;#39;__main__&amp;#39;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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 = asyncio.new_event_loop()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    asyncio.set_event_loop(loop)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    try:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        loop.run_until_complete(run())&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    finally:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        loop.run_until_complete(loop.shutdown_asyncgens())&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        loop.close()&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;Available devices&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;/dev/input/event0&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; Sleep Button&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;/dev/input/event1&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; Power Button&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;/dev/input/event10&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; Dell WMI hotkeys&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;/dev/input/event11&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; Video Bus&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;/dev/input/event12&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; DP-1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;/dev/input/event13&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; HDA Intel PCH Headphone Mic&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;/dev/input/event14&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; HDA Intel PCH Front Line Out&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;/dev/input/event15&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;/dev/input/event16&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;/dev/input/event17&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;/dev/input/event18&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; ydotoold virtual device&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;/dev/input/event2&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; Power Button&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;/dev/input/event3&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; flirc.tv flirc Keyboard&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;/dev/input/event4&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; 2.4G Composite Devic&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;/dev/input/event5&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; 2.4G Composite Devic Mouse&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;/dev/input/event6&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; 2.4G Composite Devic Consumer Control&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;/dev/input/event7&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; 2.4G Composite Devic System Control&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;/dev/input/event8&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; Pulse-Eight USB-CEC Adapter&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;/dev/input/event9&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; PC Speaker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;Select the device event number [0-18]&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;/dev/input/event4&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; 2.4G Composite Devic&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;/dev/input/event5&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; 2.4G Composite Devic Mouse&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;/dev/input/event6&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; 2.4G Composite Devic Consumer Control&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;/dev/input/event7&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;udevadm control --reload-rules &amp;amp;&amp;amp; udevadm 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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;python3&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;event_type&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; bt_remote&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  cmd&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; KEY_HOMEPAGE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  cmd_type&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; down&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  cmd_num&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;172&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;origin&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; REMOTE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;time_fired&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;context&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; sdfgsdfgsdfgsdfgsd&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  parent_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #E78284;&quot;&gt; null&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  user_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; sdfgsdfgsdfgsdfgsd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class=&quot;giallo&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;event_type&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; bt_remote&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  cmd&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; KEY_HOMEPAGE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  cmd_type&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; up&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  cmd_num&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;172&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;origin&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; REMOTE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;time_fired&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;context&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; sdfgsdfgsdfgsdfgsdfgsdgsdf&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  parent_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #E78284;&quot;&gt; null&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  user_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; systemctl enable --now btmon@consumer.service&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; systemctl enable --now btmon@system.service&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  - trigger:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - platform: event&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        event_type: bt_remote&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        event_data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          cmd_type: &amp;quot;down&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        id: &amp;quot;on&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - platform: event&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        event_type: bt_remote&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        event_data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          cmd_type: &amp;quot;up&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        id: &amp;quot;off&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    binary_sensor:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - name: remote_button_press&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state: &amp;quot;{{ trigger.id }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        attributes:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          button: &amp;quot;{{ trigger.event.data.cmd }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          code: &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&gt;          timestamp_up: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&gt;            {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              {{ this.attributes.timestamp_up|float(default=0) }}&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;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          timestamp_down: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&gt;            {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              {{ this.attributes.timestamp_down|float(default=0) }}&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;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          pressed_duration: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;              0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;alias&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; kodi remote&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;description&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;trigger&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; platform&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; binary_sensor.remote_button_press&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    from&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;on&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    to&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;off&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; numeric_state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; binary_sensor.remote_long_press&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    attribute&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; pressed_duration&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    below&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;action&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; choose&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; choose&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;              -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; binary_sensor.vizio_tv_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    state&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;on&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.all_off&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            default&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;              -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; if&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; select.harmony_hub_2_activities&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    state&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; power_off&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                then&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; select.select_option&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; select.harmony_hub_2_activities&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      option&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; Watch Kodi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                else&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      num_repeats&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      delay_secs&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0.4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      hold_secs&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      device&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; Vizio TV&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      command&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; PowerOn&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.volume_up&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;              entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.family_room_tv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            enabled&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; false&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.increase_tv_volume_x1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.volume_down&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;              entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.family_room_tv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            enabled&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; false&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.decrease_tv_volume_x1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; choose&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;              -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.family_room_speaker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    state&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; playing&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; not&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.family_room_tv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        state&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                          -&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; paused&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                          -&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; playing&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.media_play_pause&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.family_room_speaker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            default&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;              -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.media_play_pause&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                  entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.family_room_speaker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; choose&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;              -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.family_room_speaker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    state&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; playing&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; not&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.family_room_tv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        state&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                          -&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; paused&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                          -&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; playing&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.media_previous_track&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.family_room_speaker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            default&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;              -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.media_previous_track&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                  entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                    -&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.family_room_tv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                  device_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                  area_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; choose&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;              -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.family_room_speaker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    state&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; playing&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; not&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.family_room_tv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        state&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                          -&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; paused&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                          -&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; playing&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.media_next_track&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.family_room_speaker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            default&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;              -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.media_next_track&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                  entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                    -&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.family_room_tv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                  device_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                  area_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; choose&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;              -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; select.harmony_hub_2_activities&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    state&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; Watch Kodi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; if&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; binary_sensor.vizio_tv_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        state&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;off&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    then&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          num_repeats&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          delay_secs&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0.4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          hold_secs&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          device&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; Vizio TV&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          command&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; PowerOn&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; delay&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          hours&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          minutes&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          seconds&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          milliseconds&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 200&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          device&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; Vizio Amp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          command&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; InputOptical&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; delay&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          hours&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          minutes&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          seconds&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 15&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          milliseconds&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      num_repeats&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      delay_secs&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0.4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      hold_secs&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      device&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; Vizio TV&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      command&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; InputHdmi5&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            default&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;              -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; select.select_option&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                  entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; select.harmony_hub_2_activities&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                  option&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; Watch Kodi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; choose&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;              -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; select.harmony_hub_2_activities&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    state&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; Watch Roku&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; if&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; binary_sensor.vizio_tv_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        state&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;off&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    then&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          num_repeats&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          delay_secs&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0.4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          hold_secs&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          device&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; Vizio TV&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          command&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; PowerOn&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; delay&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          hours&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          minutes&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          seconds&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          milliseconds&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 200&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          device&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; Vizio Amp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          command&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; InputOptical&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; delay&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          hours&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          minutes&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          seconds&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 15&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          milliseconds&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      num_repeats&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      delay_secs&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0.4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      hold_secs&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      device&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; Vizio TV&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      command&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; InputHdmi3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            default&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;              -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; select.select_option&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                  entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; select.harmony_hub_2_activities&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                  option&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; Watch Roku&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; choose&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;              -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; select.harmony_hub_2_activities&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    state&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; Watch Apple TV&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; if&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; binary_sensor.vizio_tv_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        state&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;off&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    then&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          num_repeats&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          delay_secs&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0.4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          hold_secs&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          device&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; Vizio TV&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          command&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; PowerOn&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; delay&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          hours&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          minutes&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          seconds&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          milliseconds&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 200&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          device&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; Vizio Amp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          command&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; InputOptical&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                        target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; delay&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          hours&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          minutes&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          seconds&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 15&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                          milliseconds&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;                  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                    data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      num_repeats&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      delay_secs&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0.4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      hold_secs&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      device&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; Vizio TV&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                      command&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; InputHdmi2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            default&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;              -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; select.select_option&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                  entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; select.harmony_hub_2_activities&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;                  option&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; Watch Apple TV&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.kodi_remote_back&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.kodi_remote_up&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.kodi_remote_down&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.kodi_remote_left&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.kodi_remote_right&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.kodi_remote_enter&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.kodi_remote_home&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.kodi_remote_fastforward&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.kodi_remote_rewind&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.kodi_remote_info&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.kodi_remote_search&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.kodi_remote_toggle_subtitles&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.kodi_remote_audio_track&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.kodi_remote_page_down&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.kodi_remote_page_up&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;    {{ trigger.to_state.attributes.button.split(&lt;/span&gt;&lt;span style=&quot;color: #F4B8E4;&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt;_&lt;/span&gt;&lt;span style=&quot;color: #F4B8E4;&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt;)[1]|length == 1 }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.kodi_remote_letter&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;              key_pressed&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #CA9EE6;&quot;&gt; |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.kodi_remote_backspace&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.kodi_remote_space&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;              key_pressed&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 57&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.kodi_remote_gen_button&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;              key_pressed&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.kodi_remote_gen_button&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;              key_pressed&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 52&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; script.kodi_remote_gen_button&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;              key_pressed&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          - condition: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            value_template: &amp;quot;    {{ trigger.to_state.attributes.button.split(\&amp;quot;_\&amp;quot;)[1]|length == 1 }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          - service: script.kodi_remote_letter&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              key_pressed: |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;platform&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; binary_sensor.remote_button_press&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  hours&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  minutes&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  seconds&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0.5&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;off&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;to&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;repeat:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    - choose:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - condition: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              value_template: &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&gt;          sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - service: script.increase_tv_volume_x1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              data: {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - condition: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              value_template: &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&gt;          sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - service: script.decrease_tv_volume_x1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              data: {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - condition: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              value_template: &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&gt;          sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - choose:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    - condition: state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      entity_id: media_player.family_room_speaker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      state: playing&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    - condition: not&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        - condition: state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                          entity_id: media_player.family_room_tv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                          state:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            - paused&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            - playing&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    - service: media_player.media_stop&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      target:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        entity_id:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                          - media_player.family_room_speaker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      data: {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              default:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                - service: script.kodi_remote_stop&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  data: {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - stop: &amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - condition: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              value_template: &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&gt;          sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - service: script.kodi_remote_up&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              data: {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - condition: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              value_template: &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&gt;          sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - service: script.kodi_remote_down&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              data: {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - condition: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              value_template: &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&gt;          sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - service: script.kodi_remote_left&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              data: {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - condition: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              value_template: &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&gt;          sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - service: script.kodi_remote_right&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              data: {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - condition: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              value_template: &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&gt;          sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - service: script.kodi_remote_fastforward&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              data: {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - condition: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              value_template: &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&gt;          sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - service: script.kodi_remote_rewind&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              data: {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - condition: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              value_template: &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&gt;          sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - service: script.kodi_remote_switch_subtitles&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              data: {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - stop: &amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - condition: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              value_template: &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&gt;          sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - service: media_player.volume_mute&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              target:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                entity_id: media_player.family_room_tv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                is_volume_muted: false&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - stop: &amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - condition: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              value_template: &amp;quot;    {{ trigger.to_state.attributes.button.split(\&amp;quot;_\&amp;quot;)[1]|length == 1 }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - service: script.kodi_remote_letter&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                key_pressed: |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            - stop: &amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - condition: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              value_template: &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&gt;          sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - service: script.kodi_remote_menu&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              data: {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - stop: &amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - condition: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              value_template: &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&gt;          sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - choose:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    - condition: state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      entity_id: sensor.active_player&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      state: media_player.apple_tv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    - service: shell_command.pyatv_root&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        command: text_clear&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    - stop: &amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              default:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                - service: script.kodi_remote_gen_button&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    key_pressed: 14&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - condition: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              value_template: &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&gt;          sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - service: script.kodi_remote_page_down&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              data: {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - condition: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              value_template: &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&gt;          sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - service: script.kodi_remote_page_up&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              data: {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - condition: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              value_template: &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&gt;          sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - choose:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    - condition: state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      entity_id: select.harmony_hub_2_activities&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      state: Play Nintendo&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    - if:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        - condition: state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                          entity_id: binary_sensor.vizio_tv_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                          state: &amp;quot;off&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      then:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        - service: remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                          target:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            entity_id: remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                          data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            num_repeats: 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            delay_secs: 0.4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            hold_secs: 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            device: Vizio TV&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            command: PowerOn&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        - delay:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            hours: 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            minutes: 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            seconds: 15&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            milliseconds: 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    - service: remote.send_command&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      target:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        entity_id: remote.family_room_broadlink&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        num_repeats: 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        delay_secs: 0.4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        hold_secs: 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        device: Vizio TV&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        command: InputHdmi4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              default:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                - service: select.select_option&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  target:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    entity_id: select.harmony_hub_2_activities&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    option: Play Nintendo&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - stop: &amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - condition: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              value_template: &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&gt;          sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - service: automation.trigger&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              metadata: {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                skip_condition: true&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              target:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                entity_id: automation.turn_on_family_room_speaker&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - stop: &amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - condition: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              value_template: &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&gt;          sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - service: script.kodi_remote_return&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              data: {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            - stop: &amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    - delay:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        hours: 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        minutes: 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        seconds: 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        milliseconds: 100&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  while:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    - condition: state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      entity_id: binary_sensor.remote_long_press&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      state: &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;&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;&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;&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;&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;&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;&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;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;ssh&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; apt update&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;wg genkey | sudo tee /etc/wireguard/private.key&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sudo chmod go= /etc/wireguard/private.key&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sudo cat /etc/wireguard/private.key | wg pubkey | sudo 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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;Interface&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;PrivateKey&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt; =&lt;/span&gt;&lt;span&gt; &amp;lt;strong&amp;gt;{{private key you just generated}}&amp;lt;/strong&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;ListenPort&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&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&gt;&amp;lt;strong&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #949CBB;font-style: italic;&quot;&gt;#(any port above here)&amp;lt;/strong&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;Address&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&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&gt;&amp;lt;strong&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #949CBB;font-style: italic;&quot;&gt;#(an address from a different subnet from your private LAN)&amp;lt;/strong&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;MTU&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&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 style=&quot;color: #8CAAEE;&quot;&gt;PostUp&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt; =&lt;/span&gt;&lt;span&gt; iptables -A FORWARD -i enp0s3 -j ACCEPT&lt;/span&gt;&lt;span style=&quot;color: #949CBB;font-style: italic;&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 style=&quot;color: #8CAAEE;&quot;&gt;PostDown&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt; =&lt;/span&gt;&lt;span&gt; iptables -D FORWARD -i enp0s3 -j ACCEPT&lt;/span&gt;&lt;span style=&quot;color: #949CBB;font-style: italic;&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&gt;&amp;lt;strong&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #949CBB;font-style: italic;&quot;&gt;#enp0s3 is whatever your virtual machines main interface is called&amp;lt;/strong&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 style=&quot;color: #949CBB;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;Peer&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;PublicKey&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt; =&lt;/span&gt;&lt;span&gt; &amp;lt;strong&amp;gt;{{ we do not have this yet }}&amp;lt;/strong&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;AllowedIPs&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt; =&lt;/span&gt;&lt;span&gt; 10.1.0.0/24, &amp;lt;strong&amp;gt;{{address of npm/32}}&amp;lt;/strong&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;PersistentKeepalive&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.ipv4.ip_forward=1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;net.ipv6.conf.all.forwarding=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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&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;&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;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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;&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;&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;&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;&quot; /&gt;
&lt;em&gt;&lt;strong&gt;XMCOSY+ Outdoor String Lights&lt;/strong&gt;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&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 style=&quot;color: #949CBB;&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 style=&quot;color: #949CBB;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; false&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&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 style=&quot;color: #949CBB;&quot;&gt;:&lt;/span&gt;&lt;span&gt; &amp;#39;white&amp;#39;&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&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 style=&quot;color: #949CBB;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 255&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&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 style=&quot;color: #949CBB;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 165&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&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 style=&quot;color: #949CBB;&quot;&gt;:&lt;/span&gt;&lt;span&gt; &amp;#39;&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt;23&lt;/span&gt;&lt;span&gt;eb&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt;230159&lt;/span&gt;&lt;span&gt;ff&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt;38&lt;/span&gt;&lt;span&gt;&amp;#39;&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&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 style=&quot;color: #949CBB;&quot;&gt;:&lt;/span&gt;&lt;span&gt; &amp;#39;ffff&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt;0502808080&lt;/span&gt;&lt;span&gt;ffff&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&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 style=&quot;color: #949CBB;&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&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;&quot; /&gt;
&lt;em&gt;&lt;strong&gt;LocalTuya Light Configuration&lt;/strong&gt;&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;&quot; /&gt;
&lt;em&gt;&lt;strong&gt;sensor.string_lights_scene&lt;/strong&gt;&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;&quot; /&gt;
&lt;em&gt;&lt;strong&gt;sensor.string_light_color&lt;/strong&gt;&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;&quot; /&gt;
&lt;em&gt;&lt;strong&gt;sensor.string_light_color_value&lt;/strong&gt;&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;&quot; /&gt;
&lt;em&gt;&lt;strong&gt;sensor.custom_colors&lt;/strong&gt;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  - platform: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    lights:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      string_lights:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        level_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&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&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&gt;          {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            255&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;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        value_template: &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&gt;        temperature_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&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&gt;            {{ color_temp|int(default=0) }}&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;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        color_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&gt;          {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        effect_list_template: &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&gt;        effect_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;quot;Strobe&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;quot;Fade&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;quot;Pulse&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;quot;Blink&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;quot;Chase&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;quot;Christmas&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;quot;America&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;quot;Pick 2&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;quot;Multi&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;quot;White&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;quot;Color&amp;quot; }}&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;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        min_mireds_template: &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&gt;        max_mireds_template: &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&gt;        turn_on:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          service: light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          target:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            entity_id: light.colored_string_lights&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        turn_off:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          service: light.turn_off&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          target:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            entity_id: light.colored_string_lights&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        set_level:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          - service: script.brightness_with_white_or_color&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              brightness: &amp;#39;{{ brightness|int }}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        set_color:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          - service: script.check_color_mode&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              h: &amp;#39;{{ hs[0] }}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              s: &amp;#39;{{ hs[1] }}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        set_temperature:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          - service: script.check_white_mode&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              color_temp: &amp;#39;{{color_temp|int }}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        set_effect:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          - service: localtuya.set_dp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              device_id: eb3f15638dccc2fe59wdgj&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              dp: 21&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              value: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {% if effect == &amp;#39;Strobe&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  {{ &amp;quot;scene1&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {% elif effect == &amp;#39;Fade&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  {{ &amp;quot;scene2&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {% elif effect == &amp;#39;Pulse&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  {{ &amp;quot;scene3&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {% elif effect == &amp;#39;Blink&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  {{ &amp;quot;scene4&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {% elif effect == &amp;#39;Chase&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  {{ &amp;quot;scene5&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {% elif effect == &amp;#39;Christmas&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  {{ &amp;quot;scene6&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {% elif effect == &amp;#39;America&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  {{ &amp;quot;scene7&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {{ &amp;quot;scene8&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {% elif effect == &amp;#39;Multi&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  {{ &amp;quot;scene9&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {% elif effect == &amp;#39;White&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  {{ &amp;quot;white&amp;quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {% elif effect == &amp;#39;Color&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  {{ &amp;quot;colour&amp;quot; }}&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;pre class=&quot;giallo&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;alias&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; check white mode&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; if&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; not&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;        conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; sensor.string_lights_scene&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            state&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; white&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    then&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; localtuya.set_dp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;        data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;          device_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; eb3f15638dccc2fe59wdgj&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;          dp&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 21&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;          value&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; white&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;      color_temp&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;#39;{{ color_temp }}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; light.colored_string_lights&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;mode&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; single&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class=&quot;giallo&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;alias&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; check color mode&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; if&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; not&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;        conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; sensor.string_lights_scene&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            state&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; colour&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    then&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; localtuya.set_dp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;        data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;          device_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; eb3f15638dccc2fe59wdgj&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;          dp&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 21&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;          value&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; colour&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; wait_for_trigger&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; platform&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;              -&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; sensor.string_lights_scene&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            to&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; colour&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;        timeout&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;#39;1&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;      hs_color&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;        -&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;#39;{{ h }}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;        -&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;#39;{{ s }}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;alias: brightness with white or color&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  - choose:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          - condition: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            value_template: &amp;gt;-&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;              &amp;#39;color_temp&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          - service: localtuya.set_dp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              device_id: eb3f15638dccc2fe59wdgj&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              dp: 22&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              value: &amp;#39;{{brightness|int}}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    default:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - service: rest_command.color_converter&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          brightness: &amp;#39;{{brightness|int}}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - service: localtuya.set_dp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          device_id: eb3f15638dccc2fe59wdgj&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          dp: 24&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          value: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&gt;            brightness | int ) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mode: 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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  change_color_not_brightness&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    url&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; http://nodered:1880/color-converter&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    method&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; POST&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    payload&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #F4B8E4;&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt;light.string_lights&lt;/span&gt;&lt;span style=&quot;color: #F4B8E4;&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #F4B8E4;&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt;brightness&lt;/span&gt;&lt;span style=&quot;color: #F4B8E4;&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt;)/2.55)|int}}}}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    content_type&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;    verify_ssl&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&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;&quot; /&gt;
&lt;em&gt;&lt;strong&gt;sensor.color_output&lt;/strong&gt;&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;&quot; /&gt;
&lt;em&gt;&lt;strong&gt;Node-red Flow&lt;/strong&gt;&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;&quot; /&gt;
&lt;em&gt;&lt;strong&gt;white light&lt;/strong&gt;&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;&quot; /&gt;
&lt;em&gt;&lt;strong&gt;Color Select&lt;/strong&gt;&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;&quot; /&gt;
&lt;em&gt;&lt;strong&gt;scene select&lt;/strong&gt;&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;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;alias: Change string light colors&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;description: &amp;#39;&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;trigger:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  - platform: state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    entity_id: input_select.color_1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    id: color1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  - platform: state&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    entity_id: input_select.color_2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    id: color2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;condition: []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;action:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  - choose:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          - condition: trigger&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            id: color1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          - service: localtuya.set_dp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              device_id: eb3f15638dccc2fe59wdgj&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              dp: 101&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              value: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new1 = &amp;#39;000000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new1 = &amp;#39;c0c0c0&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new1 = &amp;#39;808080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new1 = &amp;#39;ffffff&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new1 = &amp;#39;800000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new1 = &amp;#39;ff0000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new1 = &amp;#39;800080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new1 = &amp;#39;ff00ff&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new1 = &amp;#39;008000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new1 = &amp;#39;00ff00&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new1 = &amp;#39;808000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new1 = &amp;#39;ffff00&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new1 = &amp;#39;000080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new1 = &amp;#39;0000ff&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new1 = &amp;#39;008080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new1 = &amp;#39;00ffff&amp;#39; %}&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;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {{ &amp;#39;ffff0502&amp;#39; }}{{new1}}{{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;      - conditions:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          - condition: trigger&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            id: color2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sequence:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          - service: localtuya.set_dp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              device_id: eb3f15638dccc2fe59wdgj&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              dp: 101&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              value: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new2 = &amp;#39;000000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new2 = &amp;#39;c0c0c0&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new2 = &amp;#39;808080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new2 = &amp;#39;ffffff&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new2 = &amp;#39;800000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new2 = &amp;#39;ff0000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new2 = &amp;#39;800080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new2 = &amp;#39;ff00ff&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new2 = &amp;#39;008000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new2 = &amp;#39;00ff00&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new2 = &amp;#39;808000&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new2 = &amp;#39;ffff00&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new2 = &amp;#39;000080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new2 = &amp;#39;0000ff&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new2 = &amp;#39;008080&amp;#39; %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                  {% set new2 = &amp;#39;00ffff&amp;#39; %}&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;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                {{ &amp;#39;ffff0502&amp;#39; }}{{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;                new2 }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    default: []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mode: 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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- sensor:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - name: &amp;quot;Custom Color 2&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Black&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Silver&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Gray&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;White&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Maroon&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Red&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Purple&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Fuchsia&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Green&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Lime&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Olive&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Yellow&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Navy&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Blue&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Teal&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Aqua&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;          {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;- sensor:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - name: &amp;quot;Custom Color 1&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Black&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Silver&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Gray&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;White&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Maroon&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Red&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Purple&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Fuchsia&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Green&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Lime&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Olive&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Yellow&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Navy&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Blue&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Teal&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;            {{ &amp;#39;Aqua&amp;#39; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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;&quot; /&gt;
&lt;em&gt;&lt;strong&gt;Color Select Entities&lt;/strong&gt;&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;&quot; /&gt;
&lt;em&gt;&lt;strong&gt;Light Picker&lt;/strong&gt;&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;&quot; /&gt;
&lt;em&gt;&lt;strong&gt;Completed Light&lt;/strong&gt;&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;!-- TODO broken asset: re-host /wp-content/uploads/2021/11/printing.jpg --&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/11/printing.jpg&quot; alt=&quot;&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;!-- TODO broken asset: re-host /wp-content/uploads/2021/11/finished-frame.jpg --&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/11/finished-frame.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Finished Frame&lt;/p&gt;
&lt;!-- TODO broken asset: re-host /wp-content/uploads/2021/11/button-and-cord-cutouts.jpg --&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/11/button-and-cord-cutouts.jpg&quot; alt=&quot;&quot; /&gt;
&lt;em&gt;Cut outs for buttons and cord&lt;/em&gt;&lt;/p&gt;
&lt;!-- TODO broken asset: re-host /wp-content/uploads/2021/11/tablet-in-frame.jpg --&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/11/tablet-in-frame.jpg&quot; alt=&quot;&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;!-- TODO broken asset: re-host /wp-content/uploads/2021/11/future-tablet-location.jpg --&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/11/future-tablet-location.jpg&quot; alt=&quot;&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;&quot; /&gt;
&lt;em&gt;Attached frame&lt;/em&gt;&lt;/p&gt;
&lt;!-- TODO broken asset: re-host /wp-content/uploads/2021/11/cord-exit.jpg --&gt;
&lt;p&gt;&lt;img src=&quot;/wp-content/uploads/2021/11/cord-exit.jpg&quot; alt=&quot;&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;&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;&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;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E78284;font-style: italic;&quot;&gt;cd&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; /etc/dovecot&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; mkdir ssl&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E78284;font-style: italic;&quot;&gt;cd&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; ssl&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class=&quot;giallo&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;openssl&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E78284;font-style: italic;&quot;&gt;cd&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; /etc/dovecot/conf.d&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class=&quot;giallo&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ssl_cert = &amp;lt;/etc/dovecot/ssl/email.pem&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ssl_key = &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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;commonName = @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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;commonName = 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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;version: &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&gt;services:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  roundcubemail:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    image: roundcube/roundcubemail:latest&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    container_name: roundcubemail&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    restart: unless-stopped&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    volumes:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - /path/to/roundcube/www:/var/www/html&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - /path/to/roundcube/ssl:/var/ssl&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ports:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - 9002:80&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    depends_on:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - &amp;quot;roundcubedb&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    environment:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - ROUNDCUBEMAIL_DB_TYPE=pgsql&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - ROUNDCUBEMAIL_DB_HOST=roundcubedb # same as pgsql container name&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - ROUNDCUBEMAIL_DB_NAME=roundcube # same as pgsql POSTGRES_DB env name&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - ROUNDCUBEMAIL_DB_USER=roundcube # same as pgsql POSTGRES_USER env name&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - ROUNDCUBEMAIL_DB_PASSWORD=roundcube # same as pgsql POSTGRES_PASSWORD env name&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - ROUNDCUBEMAIL_DB_PORT=5432&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - ROUNDCUBEMAIL_SKIN=elastic&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;      - ROUNDCUBEMAIL_DEFAULT_PORT=993&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&gt;  roundcubedb:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    image: postgres:latest&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    container_name: roundcubedb&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    restart: unless-stopped&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    volumes:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;    environment:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - POSTGRES_DB=roundcube&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      - POSTGRES_USER=roundcube&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E78284;font-style: italic;&quot;&gt;cd&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    $config[&amp;#39;plugins&amp;#39;] = [];&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    $config[&amp;#39;log_driver&amp;#39;] = &amp;#39;stdout&amp;#39;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    $config[&amp;#39;zipdownload_selection&amp;#39;] = true;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    $config[&amp;#39;des_key&amp;#39;] = &amp;#39;some_key&amp;#39;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    include(__DIR__ . &amp;#39;/config.docker.inc.php&amp;#39;);&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    $config[&amp;#39;enable_caching&amp;#39;] = false;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    $config[&amp;#39;imap_conn_options&amp;#39;] = array(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;#39;ssl&amp;#39;         =&amp;gt; array(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &amp;#39;verify_peer&amp;#39;  =&amp;gt; true,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &amp;#39;verify_depth&amp;#39; =&amp;gt; 3,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &amp;#39;cafile&amp;#39;       =&amp;gt; &amp;#39;/var/ssl/rootCA.pem&amp;#39;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &amp;#39;allow_self_signed&amp;#39; =&amp;gt; true,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &amp;#39;verify_peer_name&amp;#39; =&amp;gt; true,&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;     $config[&amp;#39;smtp_user&amp;#39;] = &amp;#39;remote_user&amp;#39;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     $config[&amp;#39;smtp_pass&amp;#39;] = &amp;#39;remote_pass&amp;#39;;&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;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; adduser&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt; &amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt;usernam&lt;/span&gt;&lt;span&gt;e&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; usermod -aG sudo&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt; &amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt;usernam&lt;/span&gt;&lt;span&gt;e&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; apt update&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; &amp;amp;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt; sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;strong&amp;gt;# Set up according to your email provider. It will probably involve creating an application password.&amp;lt;/strong&amp;gt;&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&gt;&amp;lt;strong&amp;gt;# select one&amp;lt;/strong&amp;gt;&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&gt;&amp;lt;strong&amp;gt;# select one&amp;lt;/strong&amp;gt;&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&gt;&amp;lt;strong&amp;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&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.&amp;lt;/strong&amp;gt;&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&gt;&amp;lt;strong&amp;gt;# pick a name&amp;lt;/strong&amp;gt;&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&gt;&amp;lt;strong&amp;gt;# This section describes the local storage&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# pick a name similar to what you picked for IMAPStore&amp;lt;/strong&amp;gt;&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&gt;&amp;lt;strong&amp;gt;#The root of your mailbox. By convention the Maildir directory is in the user&amp;#39;s home folder.&amp;lt;/strong&amp;gt;&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&gt;&amp;lt;strong&amp;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.&amp;lt;/strong&amp;gt;&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&gt;&amp;lt;strong&amp;gt;# Adds additional subfolders to match IMAP folder names&amp;lt;/strong&amp;gt;&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&gt;&amp;lt;strong&amp;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&gt;# pick a name&amp;lt;/strong&amp;gt;&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&gt;&amp;lt;strong&amp;gt;# use what you have for IMAPStore above between two :&amp;#39;s&amp;lt;/strong&amp;gt;&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&gt;&amp;lt;strong&amp;gt;# use what you have for MaildirStore above between two :&amp;#39;s&amp;lt;/strong&amp;gt;&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&gt;&amp;lt;strong&amp;gt;# You can control what gets synced. &amp;#39;*&amp;#39; syncs everything.&amp;lt;/strong&amp;gt;&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&gt;&amp;lt;strong&amp;gt;# Do not remove messages marked for deletion&amp;lt;/strong&amp;gt;&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&gt;&amp;lt;strong&amp;gt;# Do not remove deleted mailboxes&amp;lt;/strong&amp;gt;&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&gt;&amp;lt;strong&amp;gt;# use the arrival date and time from the IMAP server for the original message&amp;lt;/strong&amp;gt;&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&gt;&amp;lt;strong&amp;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.&amp;lt;/strong&amp;gt;&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&gt;&amp;lt;strong&amp;gt;# automatically create necessary mailboxes locally&amp;lt;/strong&amp;gt;&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&gt;&amp;lt;strong&amp;gt;#keeps the mailbox sync state files in the local mailbox&amp;lt;/strong&amp;gt;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;mkdir&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;mbsync&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;Unit&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;Description&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&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 style=&quot;color: #949CBB;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;Service&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;Type&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&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 style=&quot;color: #8CAAEE;&quot;&gt;User&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&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 style=&quot;color: #8CAAEE;&quot;&gt;ExecStart&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;Unit&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;Description&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&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 style=&quot;color: #949CBB;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;Timer&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;OnBootSec&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&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 style=&quot;color: #8CAAEE;&quot;&gt;OnUnitActiveSec&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&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 style=&quot;color: #8CAAEE;&quot;&gt;Unit&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&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 style=&quot;color: #949CBB;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;Install&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;WantedBy&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; systemctl daemon-reload&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; systemctl enable mbsync.timer&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mail_location = mbox:~/mail:INBOX=/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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mail_location=maildir:~/Maildir:LAYOUT=fs:INBOX=~/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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;disable_plaintext_auth = 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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; systemctl enable dovecot&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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;&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;&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;&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;&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;&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;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;keyboard_remote&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; device_name&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #8CAAEE;&quot;&gt;    type&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;platform&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; event&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;event_type&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; keyboard_remote_command_received&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;event_data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  device_name&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; flirc.tv flirc Keyboard&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  key_code&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&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;&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;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&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;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; platform&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    name&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;lt;strong&amp;gt;master bath motion&amp;lt;/strong&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    state_topic&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;tele/&amp;lt;strong&amp;gt;zbbridge&amp;lt;/strong&amp;gt;/&amp;lt;strong&amp;gt;master_bath_motion&amp;lt;/strong&amp;gt;/SENSOR&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;{{ value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;&amp;lt;strong&amp;gt;master_bath_motion&amp;lt;/strong&amp;gt;&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 style=&quot;color: #8CAAEE;&quot;&gt;    payload_on&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    payload_off&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    availability_topic&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;tele/&amp;lt;strong&amp;gt;zbbridge&amp;lt;/strong&amp;gt;/LWT&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    payload_available&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;Online&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    payload_not_available&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;Offline&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    qos&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    device_class&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; platform&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    name&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;lt;strong&amp;gt;half bath door sensor&amp;lt;/strong&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    state_topic&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;tele/&amp;lt;strong&amp;gt;zbbridge&amp;lt;/strong&amp;gt;/&amp;lt;strong&amp;gt;half_bath_door&amp;lt;/strong&amp;gt;/SENSOR&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;{{ value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;&amp;lt;strong&amp;gt;half_bath_door&amp;lt;/strong&amp;gt;&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 style=&quot;color: #8CAAEE;&quot;&gt;    payload_on&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    payload_off&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    availability_topic&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;tele/&amp;lt;strong&amp;gt;zbbridge&amp;lt;/strong&amp;gt;/LWT&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    payload_available&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;Online&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    payload_not_available&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;Offline&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    qos&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    device_class&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; platform&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    name&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;lt;strong&amp;gt;half bath door battery&amp;lt;/strong&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    state_topic&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;tele/&amp;lt;strong&amp;gt;zbbridge&amp;lt;/strong&amp;gt;/&amp;lt;strong&amp;gt;half_bath_door&amp;lt;/strong&amp;gt;/SENSOR&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #CA9EE6;&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt;      {% if value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;&amp;lt;strong&amp;gt;half_bath_door&amp;lt;/strong&amp;gt;&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 style=&quot;color: #A6D189;&quot;&gt;        {{ value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;&amp;lt;strong&amp;gt;half_bath_door&amp;lt;/strong&amp;gt;&amp;#39;][&amp;#39;BatteryPercentage&amp;#39;] }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt;      {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt;        {{ states(entity_id) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt;      {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    availability_topic&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;tele/&amp;lt;strong&amp;gt;zbbridge&amp;lt;/strong&amp;gt;/LWT&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    payload_available&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;Online&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    payload_not_available&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;Offline&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    qos&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    device_class&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;battery&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    expire_after&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 86400&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    unit_of_measurement&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; platform&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    name&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;lt;strong&amp;gt;refrigerator temperature sensor&amp;lt;/strong&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    state_topic&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;tele/&amp;lt;strong&amp;gt;zbbridge&amp;lt;/strong&amp;gt;/&amp;lt;strong&amp;gt;refrigerator_temperature_sensor&amp;lt;/strong&amp;gt;/SENSOR&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #CA9EE6;&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt;      {% if value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;&amp;lt;strong&amp;gt;refrigerator_temperature_sensor&amp;lt;/strong&amp;gt;&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 style=&quot;color: #A6D189;&quot;&gt;        {{ (value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;&amp;lt;strong&amp;gt;refrigerator_temperature_sensor&amp;lt;/strong&amp;gt;&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 style=&quot;color: #A6D189;&quot;&gt;      {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt;        {{ states(entity_id) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt;      {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    availability_topic&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;tele/&amp;lt;strong&amp;gt;zbbridge&amp;lt;/strong&amp;gt;/LWT&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    payload_available&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;Online&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    payload_not_available&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;Offline&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    qos&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    device_class&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;temperature&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    expire_after&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 86400&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    unit_of_measurement&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #949CBB;&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; platform&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    name&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;lt;strong&amp;gt;refrigerator humidity sensor&amp;lt;/strong&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    state_topic&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;tele/&amp;lt;strong&amp;gt;zbbridge&amp;lt;/strong&amp;gt;/&amp;lt;strong&amp;gt;refrigerator_temperature_sensor&amp;lt;/strong&amp;gt;/SENSOR&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #CA9EE6;&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt;      {% if value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;&amp;lt;strong&amp;gt;refrigerator_temperature_sensor&amp;lt;/strong&amp;gt;&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 style=&quot;color: #A6D189;&quot;&gt;        {{ value_json[&amp;#39;ZbReceived&amp;#39;][&amp;#39;&amp;lt;strong&amp;gt;refrigerator_temperature_sensor&amp;lt;/strong&amp;gt;&amp;#39;][&amp;#39;Humidity&amp;#39;] }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt;      {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt;        {{ states(entity_id) }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt;      {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    availability_topic&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;tele/&amp;lt;strong&amp;gt;zbbridge&amp;lt;/strong&amp;gt;/LWT&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    payload_available&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;Online&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    payload_not_available&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;Offline&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    qos&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    device_class&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;quot;humidity&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    expire_after&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 86400&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    unit_of_measurement&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   - platform: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     lights:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       guest_bedroom_lamp_template:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         level_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&gt;           {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             0&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;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         value_template: &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&gt;         temperature_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&gt;           {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             0&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;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         turn_on:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;           - service: light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             data_template:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;               entity_id: light.guest_bedroom_lamp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;               brightness: &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&gt;           - service: light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             data_template:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;               entity_id: light.guest_bedroom_lamp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;               color_temp: &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&gt;         turn_off:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;           - service: light.turn_off&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             data_template:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;               entity_id: light.guest_bedroom_lamp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         set_level:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         - service: light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;           data_template:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             brightness: &amp;quot;{{ brightness|int }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             entity_id: light.guest_bedroom_lamp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         set_temperature:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         - service: script.change_brightness_and_color_temp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;           data_template:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             light_ct: light.guest_bedroom_lamp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             brightness: &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&gt;         - service: light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;           data_template:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             color_temp: &amp;quot;{{ color_temp|int }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             entity_id: light.guest_bedroom_lamp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         max_mireds_template: 370&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         min_mireds_template: 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&gt;   - platform: mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     schema: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     name: &amp;quot;Guest Bedroom Lamp&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     command_topic: &amp;quot;cmnd/zbbridge/ZbSend&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     state_topic: &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&gt;     command_on_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;       {%- if brightness is defined -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;       {%- elif color_temp is defined -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       &amp;quot;CT&amp;quot;: {{ color_temp }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       {%- else -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       &amp;quot;Power&amp;quot;: 1&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;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;     command_off_template: &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&gt;     state_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;         on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;         off&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       {% else  %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;       {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     brightness_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&gt;           254&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;         {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;       {% endif %} &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     color_temp_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&gt;           370&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;           153&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;         {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;       {% endif %} &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     availability_topic: &amp;quot;tele/zbbridge/LWT&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     payload_available: &amp;quot;Online&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     payload_not_available: &amp;quot;Offline&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     optimistic: true&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     qos: 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     max_mireds: 370&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     min_mireds: 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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;alias&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; change brightness and color temp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; choose&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;#39;{{ brightness != -1 }}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;              entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;#39;{{ light_ct }}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;              brightness&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;#39;{{ brightness }}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    default&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;mode&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; parallel&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;max&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  - platform: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    lights:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      kids_bath_1:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        friendly_name: &amp;quot;kids_bath_1&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        level_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&gt;          {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            0&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;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        value_template: &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&gt;        temperature_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&gt;          {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            0&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;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        turn_on:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          - service: light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            data_template:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              entity_id: light.kids_bath_1_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              brightness: &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&gt;          - service: light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            data_template:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              entity_id: light.kids_bath_1_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              color_temp: &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&gt;        turn_off:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          - service: light.turn_off&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            data_template:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              entity_id: light.kids_bath_1_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        set_level:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        - service: light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          data_template:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            brightness: &amp;quot;{{ brightness|int }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            entity_id: light.kids_bath_1_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        set_temperature:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        - service: script.change_brightness_and_color_temp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          data_template:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            light_ct: light.kids_bath_1_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            brightness: &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&gt;        - service: light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          data_template:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            color_temp: &amp;quot;{{ color_temp|int }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            entity_id: light.kids_bath_1_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        max_mireds_template: 370&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        min_mireds_template: 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&gt;  - platform: mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    schema: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    name: &amp;quot;kids bath 1 mqtt&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    command_topic: &amp;quot;cmnd/zbbridge/ZbSend&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_topic: &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&gt;    command_on_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;      {%- if brightness is defined -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;      {%- elif color_temp is defined -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;quot;CT&amp;quot;: {{ color_temp }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {%- else -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;quot;Power&amp;quot;: 1&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;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;    command_off_template: &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&gt;    state_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;        off&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;        on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {% else  %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;      {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    brightness_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&gt;          254&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;        {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;      {% endif %} &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    color_temp_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&gt;          370&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;          153&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;        {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;      {% endif %} &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    availability_topic: &amp;quot;tele/zbbridge/LWT&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_available: &amp;quot;Online&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_not_available: &amp;quot;Offline&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    optimistic: false&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    qos: 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_mireds: 370&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    min_mireds: 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&gt;  - platform: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    lights:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      kids_bath_2:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        friendly_name: &amp;quot;kids_bath_2&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        level_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&gt;          {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            0&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;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        value_template: &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&gt;        temperature_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&gt;          {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            0&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;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        turn_on:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          - service: light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            data_template:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              entity_id: light.kids_bath_2_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              brightness: &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&gt;          - service: light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            data_template:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              entity_id: light.kids_bath_2_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              color_temp: &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&gt;        turn_off:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          - service: light.turn_off&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            data_template:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              entity_id: light.kids_bath_2_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        set_level:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        - service: light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          data_template:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            brightness: &amp;quot;{{ brightness|int }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            entity_id: light.kids_bath_2_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        set_temperature:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        - service: script.change_brightness_and_color_temp&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          data_template:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            light_ct: light.kids_bath_2_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            brightness: &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&gt;        - service: light.turn_on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          data_template:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            color_temp: &amp;quot;{{ color_temp|int }}&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            entity_id: light.kids_bath_2_mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        max_mireds_template: 370&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        min_mireds_template: 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&gt;  - platform: mqtt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    schema: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    name: &amp;quot;kids bath 2 mqtt&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    command_topic: &amp;quot;cmnd/zbbridge/ZbSend&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_topic: &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&gt;    command_on_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;      {%- if brightness is defined -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;      {%- elif color_temp is defined -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;quot;CT&amp;quot;: {{ color_temp }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {%- else -%}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &amp;quot;Power&amp;quot;: 1&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;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      },&amp;quot;endpoint&amp;quot;:1}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    command_off_template: &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&gt;    state_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;        off&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;        on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {% else  %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;      {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    brightness_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&gt;          254&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;        {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;      {% endif %} &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    color_temp_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&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&gt;          370&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;          153&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;        {% endif %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {% else %}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;      {% endif %} &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    availability_topic: &amp;quot;tele/zbbridge/LWT&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_available: &amp;quot;Online&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_not_available: &amp;quot;Offline&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    optimistic: false&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    qos: 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_mireds: 370&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    min_mireds: 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&gt;  - platform: template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    lights:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      kids_bath:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        friendly_name: &amp;quot;kids_bath&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        level_template: &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&gt;        value_template: &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&gt;        temperature_template: &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&gt;        turn_on:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          - service: mqtt.publish&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              topic: cmnd/zbbridge/ZbSend&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              payload_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;          - service: mqtt.publish&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              topic: cmnd/zbbridge/ZbSend&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              payload_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;        turn_off:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          - service: mqtt.publish&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              topic: cmnd/zbbridge/ZbSend&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              payload_template: &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&gt;        set_level:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          - service: mqtt.publish&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              topic: cmnd/zbbridge/ZbSend&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              payload_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;        set_temperature:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          - service: script.change_brightness_and_color_temp_group&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            data_template:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              group: 101&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              brightness: &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&gt;          - service: mqtt.publish&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            data:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              topic: cmnd/zbbridge/ZbSend&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;              payload_template: &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&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&gt;        max_mireds_template: 370&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        min_mireds_template: 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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;alias&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; change brightness and color temp group&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; choose&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; conditions&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; condition&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            value_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; &amp;#39;{{ brightness != -1 }}&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;        sequence&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;          -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; mqtt.publish&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;            data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;              topic&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; cmnd/zbbridge/ZbSend&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;              payload_template&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #CA9EE6;&quot;&gt; &amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #A6D189;&quot;&gt;                255 -%}254{%- else -%}{{ brightness|int }}{%- endif -%}}}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    default&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt; []&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;mode&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; parallel&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;max&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&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;&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;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;media_player&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt; platform&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; vlc_telnet&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    name&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; vlc&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    host&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; 6872d8d8-local-vlc&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    password&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.play_media&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.vlc&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  media_content_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; /share/chime.wav&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  media_content_type&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;service&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.volume_set&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;target&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  entity_id&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&quot;&gt; media_player.vlc&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;data&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  volume_level&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&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;&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;&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;&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;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;env:tasmota32-EWELINK&lt;/span&gt;&lt;span style=&quot;color: #949CBB;&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;extends&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&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 style=&quot;color: #8CAAEE;&quot;&gt;board_build.f_cpu&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&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 style=&quot;color: #8CAAEE;&quot;&gt;board_build.f_flash&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&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 style=&quot;color: #8CAAEE;&quot;&gt;build_flags&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&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;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;#ifdef&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt; FIRMWARE_EWELINK&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;  #warning&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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 style=&quot;color: #E5C890;&quot;&gt;  #undef&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;  SERIAL_LOG_LEVEL&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;  #define&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&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 style=&quot;color: #E5C890;&quot;&gt;  #define&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt; USE_ZIGBEE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;  #undef&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;  USE_ZIGBEE_ZNP&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;  #define&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt; USE_ZIGBEE_EZSP&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;  #define&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt; USE_UFILESYS&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;  #define&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt; USE_ZIGBEE_EEPROM&lt;/span&gt;&lt;span style=&quot;color: #949CBB;font-style: italic;&quot;&gt; // T24C512A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;  #define&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt; USE_TCP_BRIDGE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;  #undef&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;  USE_ZIGBEE_CHANNEL&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;  #define&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt; USE_ZIGBEE_CHANNEL&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 11&lt;/span&gt;&lt;span style=&quot;color: #949CBB;font-style: italic;&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 style=&quot;color: #E5C890;&quot;&gt;  #define&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt; USE_ETHERNET&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;  #undef&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;  ETH_TYPE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;  #define&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt; ETH_TYPE&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 0&lt;/span&gt;&lt;span style=&quot;color: #949CBB;font-style: italic;&quot;&gt; // ETH_PHY_LAN8720&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;  #undef&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;  ETH_CLKMODE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;  #define&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt; ETH_CLKMODE&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 3&lt;/span&gt;&lt;span style=&quot;color: #949CBB;font-style: italic;&quot;&gt; // ETH_CLOCK_GPIO17_OUT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;  #undef&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;  ETH_ADDRESS&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #E5C890;&quot;&gt;  #define&lt;/span&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt; ETH_ADDRESS&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&quot;&gt; 1&lt;/span&gt;&lt;span style=&quot;color: #949CBB;font-style: italic;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;font-style: italic;&quot;&gt;platformio&lt;/span&gt;&lt;span style=&quot;color: #A6D189;&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;&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;&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;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&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&quot; style=&quot;color: #C6D0F5; background-color: #303446;&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;availability&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;  active&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: #8CAAEE;&quot;&gt;    timeout&lt;/span&gt;&lt;span style=&quot;color: #81C8BE;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #EF9F76;&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;&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>
