<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="pretty-atom-feed.xsl" type="text/xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  
  <title>An Engineer From Portugal</title>
  <subtitle>Thoughts on tech, pitfalls, and the occasional rant.</subtitle>
  <link href="https://couto.io/feed/feed.xml" rel="self" />
  <link href="https://couto.io/" />
  <updated>2026-09-14T22:22:00Z</updated>
  <id>https://couto.io/</id>
  <author>
    <name>Elisiário Couto</name>
  </author>
  <entry>
    <title>Connecting my ISP fiber directly to an OpenWrt box</title>
    <link href="https://couto.io/blog/no-isp-router-openwrt/" />
    <updated>2026-09-14T22:22:00Z</updated>
    <id>https://couto.io/blog/no-isp-router-openwrt/</id>
    <content type="html">&lt;p&gt;I&#39;ve been in contact with OpenWrt since my first job in 2013 and it&#39;s been amazing
to see an open-source project enduring the test of time like this, not without
some drama such as the &lt;a href=&quot;https://openwrt.org/about#announcing_the_openwrtlede_merge&quot;&gt;LEDE fork and the subsequent merge&lt;/a&gt; back in 2016-2018, but, more recently,
also having first-class citizen hardware like the &lt;a href=&quot;https://openwrt.org/toh/openwrt/one&quot;&gt;OpenWrt One&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I always wanted to have the least hardware possible to manage my network, more importantly
I would like to avoid equipment from my ISP, the so called CPE, short for Customer Premises Equipment.&lt;/p&gt;
&lt;p&gt;Historically, ISPs in Portugal installed two units in the client&#39;s location:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Optical_line_termination&quot;&gt;ONT/ONU&lt;/a&gt;: the medium converter, from fiber to RJ45. Optical Network Terminal in ITU-T terminology, Optical Network Unit in IEEE.&lt;/li&gt;
&lt;li&gt;Wireless Router: limited in what you can do&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;More recently, more and more ISPs install an all-in-one router that includes the ONT.&lt;/p&gt;
&lt;p&gt;People that wanted to use their network to the fullest extent, relied on bridge mode to
their own router, using the ISP&#39;s router as the medium converter basically.&lt;/p&gt;
&lt;figure class=&quot;image-figure &quot; style=&quot;max-width: 400px; margin: 0 auto;&quot;&gt;
					&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://couto.io/blog/no-isp-router-openwrt/Bdcv3Io-Pr-1181.avif&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://couto.io/blog/no-isp-router-openwrt/Bdcv3Io-Pr-1181.webp&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://couto.io/blog/no-isp-router-openwrt/Bdcv3Io-Pr-1181.png&quot; alt=&quot;The MEO-branded FiberGateway GR141IG&quot; width=&quot;1181&quot; height=&quot;1609&quot;&gt;&lt;/picture&gt;
					&lt;figcaption&gt;The MEO-branded FiberGateway GR141IG&lt;/figcaption&gt;
				&lt;/figure&gt;
&lt;p&gt;When I contracted MEO, they installed this MEO-branded GR141IG. After exploring the settings,
I&#39;ve noticed some things that I wasn&#39;t able to do:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Change the DNS to all the DHCP clients&lt;/li&gt;
&lt;li&gt;Disabling the public hotspot feature&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In addition, I&#39;ve been running Pi-Hole and a WireGuard tunnel on a Dell Optiplex Micro. Having
to dig through the menus to port forward stuff was annoying me.&lt;/p&gt;
&lt;p&gt;After talking with a coworker and friend, he told me that he was able to connect his MEO fiber to an
OpenWrt device.&lt;/p&gt;
&lt;h2 id=&quot;hardware&quot;&gt;Hardware&lt;/h2&gt;
&lt;p&gt;I&#39;ve chosen a Banana Pi R3, a powerful router board with a quad-core ARM A53, 2GB of RAM, 8GB of eMMC flash, 2 x SFP 2.5Gb ports and 5 x 1Gb ports.&lt;/p&gt;
&lt;figure class=&quot;image-figure &quot;&gt;
					&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://couto.io/blog/no-isp-router-openwrt/pUN-pD_mh4-800.avif&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://couto.io/blog/no-isp-router-openwrt/pUN-pD_mh4-800.webp&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://couto.io/blog/no-isp-router-openwrt/pUN-pD_mh4-800.jpeg&quot; alt=&quot;Banana Pi R3, with 2 SFP cages and 5 Ethernet ports&quot; width=&quot;800&quot; height=&quot;400&quot;&gt;&lt;/picture&gt;
					&lt;figcaption&gt;Banana Pi R3, with 2 SFP cages and 5 Ethernet ports&lt;/figcaption&gt;
				&lt;/figure&gt;
&lt;p&gt;To connect the fiber, I needed a GPON/XPON SFP Stick, I&#39;ve bought this Luleey Elec LL-XS2510 on AliExpress. It is important to know what type of connector you have, if it has a green tip it is the APC (&amp;quot;Angled Physical Contact&amp;quot;). If it is blue it is the UPC (&amp;quot;Ultra Physical Contact&amp;quot;) version. This little device is actually another &amp;quot;router&amp;quot;, it runs Linux and it is configured through a webpage.&lt;/p&gt;
&lt;figure class=&quot;image-figure &quot;&gt;
					&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://couto.io/blog/no-isp-router-openwrt/1-IaiddlOf-1200.avif&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://couto.io/blog/no-isp-router-openwrt/1-IaiddlOf-1200.webp&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://couto.io/blog/no-isp-router-openwrt/1-IaiddlOf-1200.jpeg&quot; alt=&quot;The Luleey Elec LL-XS2510 XPON ONU stick&quot; width=&quot;1200&quot; height=&quot;1600&quot;&gt;&lt;/picture&gt;
					&lt;figcaption&gt;The Luleey Elec LL-XS2510 XPON ONU stick&lt;/figcaption&gt;
				&lt;/figure&gt;
&lt;h2 id=&quot;configuration&quot;&gt;Configuration&lt;/h2&gt;
&lt;p&gt;I found a few hints on a Portuguese forum, Zwame, where some people were not successful establishing a link with the ISP-owned OLT, the device at the other end of the fiber.
Nevertheless, I tried to set up the GPON.&lt;/p&gt;
&lt;p&gt;Some sticks like this don&#39;t start the management interface if they don&#39;t detect any link so I connected the fiber to the SFP module and booted the Banana Pi R3.
I had to SNAT from my network to the SFP interface (I can&#39;t remember why actually) but eventually I landed on the GPON management interface.&lt;/p&gt;
&lt;p&gt;Logged in with the good ol&#39; &lt;code&gt;admin:admin&lt;/code&gt;, navigated to the Settings page and there I needed to setup the authentication of the connection.&lt;/p&gt;
&lt;p&gt;Apparently, MEO uses the serial number and a PLOAM password for authenticating each subscriber line.&lt;/p&gt;
&lt;p&gt;Take the serial number from the sticker on the bottom of the router. I&#39;m using &lt;code&gt;5054494EA1B2C3D4&lt;/code&gt; here instead of mine, yours will be different.&lt;/p&gt;
&lt;p&gt;The serial is the GPON serial in raw hex. Decoding it as ASCII + hex:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;50 54 49 4E&lt;/code&gt; is &lt;code&gt;PTIN&lt;/code&gt; (PT Inovação, MEO&#39;s vendor ID) in ASCII&lt;/li&gt;
&lt;li&gt;&lt;code&gt;A1 B2 C3 D4&lt;/code&gt; &lt;strong&gt;the equipment identifier&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Take the equipment identifier and add &lt;code&gt;PTIN&lt;/code&gt; in the beginning, producing the serial &lt;code&gt;PTINA1B2C3D4&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The PLOAM password I used is &lt;code&gt;1234567890&lt;/code&gt;. It worked 🤷‍♂️.&lt;/p&gt;
&lt;figure class=&quot;image-figure &quot;&gt;
					&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://couto.io/blog/no-isp-router-openwrt/RrRuaUO3lO-2000.avif&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://couto.io/blog/no-isp-router-openwrt/RrRuaUO3lO-2000.webp&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://couto.io/blog/no-isp-router-openwrt/RrRuaUO3lO-2000.jpeg&quot; alt=&quot;PON Status page showing ONU State O5 and the optical readings&quot; width=&quot;2000&quot; height=&quot;1300&quot;&gt;&lt;/picture&gt;
					&lt;figcaption&gt;PON Status page showing ONU State O5 and the optical readings&lt;/figcaption&gt;
				&lt;/figure&gt;
&lt;p&gt;I got an O5, fully operational, ranged and authenticated by the OLT!&lt;/p&gt;
&lt;p&gt;After that, created a new interface with VLAN 12 and attached WAN with DHCP and DHCPv6 enabled.&lt;/p&gt;
&lt;p&gt;Everything is working perfectly, multicast/unicast on the TV box from the ISP, IPv6 with a &lt;code&gt;/56&lt;/code&gt; delegated prefix.&lt;/p&gt;
&lt;p&gt;Recently I was not getting the delegated prefix, and, after a talk with Claude he told me to try to set a DUID-LL, &lt;code&gt;0003 0001 &amp;lt;original MAC address of the ISP router&amp;gt;&lt;/code&gt; and it worked. Your mileage may vary.&lt;/p&gt;
&lt;h2 id=&quot;custom-firmware-for-the-extra-mile&quot;&gt;Custom firmware for the extra mile&lt;/h2&gt;
&lt;p&gt;Since I want some tools installed in the router and I like to tinker, I set up an OpenWrt buildroot and I leave you with a non-exhaustive list of good stuff:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;AdGuard Home: moved away from Pi-Hole&lt;/li&gt;
&lt;li&gt;WireGuard and LuCI package&lt;/li&gt;
&lt;li&gt;Tailscale and LuCI package&lt;/li&gt;
&lt;li&gt;Beszel from &lt;a href=&quot;https://github.com/vernette/beszel-agent-openwrt&quot;&gt;vernette/beszel-agent-openwrt&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Footstrap: modern theme from &lt;a href=&quot;https://github.com/VizzleTF/luci-theme-footstrap&quot;&gt;VizzleTF/luci-theme-footstrap&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;figure class=&quot;image-figure &quot;&gt;
					&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://couto.io/blog/no-isp-router-openwrt/aIv7pN8uGW-2000.avif&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://couto.io/blog/no-isp-router-openwrt/aIv7pN8uGW-2000.webp&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://couto.io/blog/no-isp-router-openwrt/aIv7pN8uGW-2000.jpeg&quot; alt=&quot;LuCI with the Footstrap theme, showing the fiber up on sfp1 and the WAN port unused&quot; width=&quot;2000&quot; height=&quot;1207&quot;&gt;&lt;/picture&gt;
					&lt;figcaption&gt;LuCI with the Footstrap theme, showing the fiber up on sfp1 and the WAN port unused&lt;/figcaption&gt;
				&lt;/figure&gt;
&lt;h2 id=&quot;was-it-worth-it&quot;&gt;Was it worth it?&lt;/h2&gt;
&lt;p&gt;Absolutely. I get to configure everything network-related in OpenWrt&#39;s web interface LuCI.
From DNS records, DHCP rules, AdGuard enforced at network level, WireGuard, Tailscale, all
running on the same box that terminates the fiber, so the Optiplex is free for my beefier self-hosted services.&lt;/p&gt;
&lt;p&gt;Notice the port status in the screenshot above: the fiber comes in on &lt;code&gt;sfp1&lt;/code&gt;, and the
port actually labelled &lt;code&gt;wan&lt;/code&gt; has no link at all. It is just another LAN port now.&lt;/p&gt;
&lt;p&gt;I&#39;ve been running this for a full year now, hope this gets easier for the consumer in the future.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Connecting my Mitsubishi Electric aircons to my smart home</title>
    <link href="https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/" />
    <updated>2025-02-10T00:00:00Z</updated>
    <id>https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/</id>
    <content type="html">&lt;figure class=&quot;image-figure &quot;&gt;
					&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/wXcYcdJK0j-3680.avif&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/wXcYcdJK0j-3680.webp&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/wXcYcdJK0j-3680.png&quot; alt=&quot;Home Assistant with Mitsubishi air conditioners without MELCloud&quot; width=&quot;3680&quot; height=&quot;2382&quot;&gt;&lt;/picture&gt;
					&lt;figcaption&gt;Home Assistant with Mitsubishi air conditioners without MELCloud&lt;/figcaption&gt;
				&lt;/figure&gt;
&lt;p&gt;I recently moved to a new apartment that has a Mitsubishi Electric HVAC system, commonly known as an air conditioner.&lt;/p&gt;
&lt;p&gt;The setup consists of 1 outdoor unit (MXZ-3F68VF) and 3 ceiling concealed ducted indoor units (SEZ-M35DA2).
On each room that as an indoor unit, there are also PAR-40MAA wall controls.&lt;/p&gt;
&lt;h2 id=&quot;the-official-way&quot;&gt;The &amp;quot;official&amp;quot; way&lt;/h2&gt;
&lt;figure class=&quot;image-figure &quot;&gt;
					&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/q5zc6AGEVE-1920.avif&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/q5zc6AGEVE-1920.webp&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/q5zc6AGEVE-1920.jpeg&quot; alt=&quot;Mitsubishi MAC-568IF-E&quot; width=&quot;1920&quot; height=&quot;1440&quot;&gt;&lt;/picture&gt;
					&lt;figcaption&gt;Mitsubishi MAC-568IF-E&lt;/figcaption&gt;
				&lt;/figure&gt;
&lt;p&gt;On an initial search, I discovered that Mitsubishi sells a Wireless Adapter (MAC-568IF-E) that
you can hook up to each indoor unit. The wireless adapter connects to a Wi-Fi network and, to
control your A/C, you use the MELCloud app.&lt;/p&gt;
&lt;p&gt;Unfortunately, the cheapest seller I found was asking for approximately €70 per piece, €210 since I have three units.
At this price point, I immediately started searching for alternatives.&lt;/p&gt;
&lt;h2 id=&quot;searching-for-alternatives&quot;&gt;Searching for alternatives&lt;/h2&gt;
&lt;p&gt;On my last post, I was using Homebridge to integrate non-HomeKit devices into my Apple Home ecosystem. In the meantime, I&#39;ve been following Home Assistant progress and
decided to give it a shot since it could replace my Homebridge installation. I was very surprised on how quick and easy it was to set up Home Assistant in a container.&lt;/p&gt;
&lt;p&gt;Since Home Assistant automatically discovered a lot of devices in my apartment, I started searching for a way to integrate my Air Conditioners into Home Assistant.&lt;/p&gt;
&lt;p&gt;In the forums, I found some people talking about ESPHome and how they&#39;ve connected Mitsubishi Electric systems with a cheap ESP32 board.&lt;/p&gt;
&lt;h2 id=&quot;esphome&quot;&gt;ESPHome&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://esphome.io&quot;&gt;ESPHome&lt;/a&gt;, is a project that simplifies the configuration and firmware creation for microcontrollers.
It is now included in the &lt;a href=&quot;https://www.openhomefoundation.org&quot;&gt;Open Home Foundation&lt;/a&gt;, an organization from the creators of Home Assistant that houses
other very interesting projects like &lt;a href=&quot;https://kno.wled.ge&quot;&gt;WLED&lt;/a&gt; - I&#39;m planning another post where I used WLED to control a LED light strip.&lt;/p&gt;
&lt;p&gt;ESP32 is a very popular family of microcontrollers made by &lt;a href=&quot;https://www.espressif.com&quot;&gt;Espressif&lt;/a&gt;, usually with Wi-Fi and Bluetooth radios, very cheap (around €10) and with a
very reliable track history.&lt;/p&gt;
&lt;p&gt;According to &lt;a href=&quot;https://github.com/echavet/MitsubishiCN105ESPHome/discussions/83&quot;&gt;this GitHub discussion&lt;/a&gt;, this guy successfully
connected a &lt;a href=&quot;https://shop.m5stack.com/products/atoms3-lite-esp32s3-dev-kit&quot;&gt;M5Stack Atom S3 Lite&lt;/a&gt; to his heat pump board, so I ordered the same parts.&lt;/p&gt;
&lt;figure class=&quot;image-figure &quot;&gt;
					&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/_-AuxN0pld-786.avif&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/_-AuxN0pld-786.webp&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/_-AuxN0pld-786.jpeg&quot; alt=&quot;M5Stack AtomS3 Lite compared to a dollar coin&quot; width=&quot;786&quot; height=&quot;429&quot;&gt;&lt;/picture&gt;
					&lt;figcaption&gt;M5Stack AtomS3 Lite compared to a dollar coin&lt;/figcaption&gt;
				&lt;/figure&gt;
&lt;h2 id=&quot;parts&quot;&gt;Parts&lt;/h2&gt;
&lt;p&gt;This is the list of parts I ordered and links to &lt;a href=&quot;https://mauser.pt&quot;&gt;mauser.pt&lt;/a&gt;, a Portuguese electronics shop:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://mauser.pt/catalog/product_info.php?products_id=095-1461&quot;&gt;M5Stack AtomS3 Lite&lt;/a&gt;: small ESP32 device, nicely packaged with a couple of buttons and LEDs&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://mauser.pt/catalog/product_info.php?products_id=096-6569&quot;&gt;Grove Cables&lt;/a&gt;: to connect the AtomS3 to the air-con board&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://mauser.pt/catalog/product_info.php?products_id=011-3514&quot;&gt;PAP-05V-S Connectors&lt;/a&gt;: female connector to CN105, the connector on the air-con, used
to replace one end of the Grove cable&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;installation&quot;&gt;Installation&lt;/h2&gt;
&lt;p&gt;First, I created the configuration file for ESPHome with the help of the information on the &lt;a href=&quot;https://github.com/echavet/MitsubishiCN105ESPHome/discussions/83&quot;&gt;GitHub discussion&lt;/a&gt;,
you can find my configuration files in this repository: &lt;a href=&quot;https://github.com/elisiariocouto/mitsubishi-aircon-homeassistant&quot;&gt;elisiariocouto/mitsubishi-aircon-homeassistant&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Feel free to use the repository as a baseline for your installation.&lt;/p&gt;
&lt;p&gt;After putting my configuration file in a new folder, I installed ESPHome via &lt;code&gt;brew install esphome&lt;/code&gt; on my laptop, connected my Atom device to my laptop using a USB-C to USB-C cable
and ran:&lt;/p&gt;
&lt;pre class=&quot;language-console&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-console&quot;&gt;esphome upload ac-livingroom.yaml&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After that, I discovered the Atom in my Wi-Fi network, connected to its IP and was presented with ESPHome&#39;s web interface.&lt;/p&gt;
&lt;figure class=&quot;image-figure &quot;&gt;
					&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/YJKU4gibnh-3452.avif&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/YJKU4gibnh-3452.webp&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/YJKU4gibnh-3452.png&quot; alt=&quot;ESPHome Web Interface&quot; width=&quot;3452&quot; height=&quot;1422&quot;&gt;&lt;/picture&gt;
					&lt;figcaption&gt;ESPHome Web Interface&lt;/figcaption&gt;
				&lt;/figure&gt;
&lt;p&gt;Now that I know the device boots and connects to my Wi-Fi network, it&#39;s time to connect it to the air conditioner board.&lt;/p&gt;
&lt;p&gt;First I needed to change one of the ends of the grove cable to the correct connector.&lt;/p&gt;
&lt;p&gt;With a small pair of tweezers, I pulled the Grove connector tabs that make the crimped part stuck on the connector in order to
remove the crimped cable from the connector. I did this to all the four wires and inserted them in the 5-pin connector as shown in the image.&lt;/p&gt;
&lt;figure class=&quot;image-figure &quot;&gt;
					&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/civRYb0fOP-3024.avif&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/civRYb0fOP-3024.webp&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/civRYb0fOP-3024.jpeg&quot; alt=&quot;Some wires detached from connector&quot; width=&quot;3024&quot; height=&quot;4032&quot;&gt;&lt;/picture&gt;
					&lt;figcaption&gt;Some wires detached from connector&lt;/figcaption&gt;
				&lt;/figure&gt;
&lt;p&gt;In the GitHub discussion there were instructions on the pinout of the CN105 connector and the JST female connector should be connected as you see in the image shared there. You can guide yourself using the small triangle in the connector. That pin should not have any wire connected.&lt;/p&gt;
&lt;figure class=&quot;image-figure &quot;&gt;
					&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/LavQGZhfQ3-1200.avif&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/LavQGZhfQ3-1200.webp&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/LavQGZhfQ3-1200.png&quot; alt=&quot;CN105, small triangle points to pin 1: unused - pin 2: black (GND) - pin 3: red (5V) - pin 4: white (TX GPIO2) - pin 5: yellow (RX GPIO1)&quot; width=&quot;1200&quot; height=&quot;904&quot;&gt;&lt;/picture&gt;
					&lt;figcaption&gt;CN105, small triangle points to pin 1: unused - pin 2: black (GND) - pin 3: red (5V) - pin 4: white (TX GPIO2) - pin 5: yellow (RX GPIO1)&lt;/figcaption&gt;
				&lt;/figure&gt;
&lt;figure class=&quot;image-figure &quot;&gt;
					&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/XN7siIgpsy-3840.avif&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/XN7siIgpsy-3840.webp&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/XN7siIgpsy-3840.jpeg&quot; alt=&quot;Here is the end result, what a beauty!&quot; width=&quot;3840&quot; height=&quot;2160&quot;&gt;&lt;/picture&gt;
					&lt;figcaption&gt;Here is the end result, what a beauty!&lt;/figcaption&gt;
				&lt;/figure&gt;
&lt;p&gt;Done with the connections, it was time to turn off the breaker for the air conditioners, access the air-con indoor unit, remove the metal plate covering the board and connecting
the home-made device to the CN105 connector. The hardest part was discovering the actual connector in the board, but with the help of my mobile phone&#39;s flashlight I was able to locate it. &lt;strong&gt;By the way, usually it&#39;s a red connector 🫡&lt;/strong&gt;&lt;/p&gt;
&lt;figure class=&quot;image-figure &quot;&gt;
					&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/C9ZQ4UET2--3024.avif&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/C9ZQ4UET2--3024.webp&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/C9ZQ4UET2--3024.jpeg&quot; alt=&quot;AtomS3 Lite hooked to one indoor unit board&quot; width=&quot;3024&quot; height=&quot;4032&quot;&gt;&lt;/picture&gt;
					&lt;figcaption&gt;AtomS3 Lite hooked to one indoor unit board&lt;/figcaption&gt;
				&lt;/figure&gt;
&lt;h2 id=&quot;usage&quot;&gt;Usage&lt;/h2&gt;
&lt;p&gt;Using the &lt;a href=&quot;https://www.home-assistant.io/integrations/esphome/&quot;&gt;ESPHome integration&lt;/a&gt; in Home Assistant, I just needed to add the device and everything worked automatically.&lt;/p&gt;
&lt;p&gt;I can even add the Air Conditioners to Apple Home via the &lt;a href=&quot;https://www.home-assistant.io/integrations/homekit&quot;&gt;HomeKit Bridge&lt;/a&gt; integration, which is a very reliable
integration that replaced my old Homebridge installation.&lt;/p&gt;
&lt;div class=&quot;image-grid-breakout&quot;&gt;&lt;div class=&quot;image-grid&quot;&gt;
&lt;figure class=&quot;image-figure &quot;&gt;
					&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/VIPaoJ5m_R-1179.avif&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/VIPaoJ5m_R-1179.webp&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/VIPaoJ5m_R-1179.jpeg&quot; alt=&quot;Device exposed to Apple Home, controlling modes and fan speed.&quot; width=&quot;1179&quot; height=&quot;2556&quot;&gt;&lt;/picture&gt;
					&lt;figcaption&gt;Device exposed to Apple Home, controlling modes and fan speed.&lt;/figcaption&gt;
				&lt;/figure&gt;
&lt;figure class=&quot;image-figure &quot;&gt;
					&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/jrmUz4eBrc-1179.avif&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/jrmUz4eBrc-1179.webp&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://couto.io/blog/mitsubishi-air-conditioner-diy-homeassistant/jrmUz4eBrc-1179.jpeg&quot; alt=&quot;For some reason, the &#39;Dry&#39; mode does not appear in the menu.&quot; width=&quot;1179&quot; height=&quot;2556&quot;&gt;&lt;/picture&gt;
					&lt;figcaption&gt;For some reason, the &#39;Dry&#39; mode does not appear in the menu.&lt;/figcaption&gt;
				&lt;/figure&gt;
&lt;/div&gt;&lt;/div&gt;
</content>
  </entry>
  <entry>
    <title>Automating my apartment: Part 1</title>
    <link href="https://couto.io/blog/automating-my-apartment-part-1/" />
    <updated>2023-05-01T00:00:00Z</updated>
    <id>https://couto.io/blog/automating-my-apartment-part-1/</id>
    <content type="html">&lt;figure class=&quot;image-figure &quot;&gt;
					&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://couto.io/blog/automating-my-apartment-part-1/quw5yL9Nd7-1080.avif&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://couto.io/blog/automating-my-apartment-part-1/quw5yL9Nd7-1080.webp&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://couto.io/blog/automating-my-apartment-part-1/quw5yL9Nd7-1080.jpeg&quot; alt=&quot;Not my apartment. Photo by Влад Хмара on Unsplash&quot; width=&quot;1080&quot; height=&quot;886&quot;&gt;&lt;/picture&gt;
					&lt;figcaption&gt;Not my apartment. Photo by Влад Хмара on Unsplash&lt;/figcaption&gt;
				&lt;/figure&gt;
&lt;p&gt;This is the first part of a series of posts on how I automated parts of my daily routine in my apartment. First steps into the Smart Home world, HomeKit, Thread, Matter, mDNS, and some rabbit holes. Subscribe to be notified of the rest of the story.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;This journey started on a usual night at my apartment. I was watching some random Netflix series on my TV, lying on the couch when bedtime came, triggering this nightly routine:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Turn off the TV&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Turn off the floor shade next to it&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Walk to the bedroom, turning off the main living room light&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Turn on the bedroom light&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Go around the bed to turn on the nightstand lamps&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Close the shades&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Go back to the bedroom entrance to turn off the bedroom light&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;hygiene time&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Turn off the nightstand lamps&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Sleep&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Since I spend most of my time thinking about how to automate boring and repetitive tasks, this ritual was a perfect candidate for automation.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Saying “Goodnight” to the Living Room smart speaker should do all of this — stopping at the hygiene step&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Alright, let’s do this.&lt;/p&gt;
&lt;h3 id=&quot;first-things-first&quot;&gt;First things first&lt;/h3&gt;
&lt;p&gt;This automation must follow a simple rule: I don’t want to lose the ability to turn on and off lights with my current analog switches. After some searching, I found Shelly, a Bulgarian company that sells Wi-Fi switches that you can retrofit into any common analog switch.&lt;/p&gt;
&lt;p&gt;&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://couto.io/blog/automating-my-apartment-part-1/VdqBjUn3iH-861.avif&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://couto.io/blog/automating-my-apartment-part-1/VdqBjUn3iH-861.webp&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://couto.io/blog/automating-my-apartment-part-1/VdqBjUn3iH-861.png&quot; alt=&quot;&quot; width=&quot;861&quot; height=&quot;240&quot;&gt;&lt;/picture&gt;&lt;/p&gt;
&lt;p&gt;I bought two cheap Shelly 1, their entry-level device. After some DIY electrician work (double-checking that the circuit breaker was off), I installed the first Shelly behind the main living room light switch. With the circuit breaker up, I installed the Shelly app on my iPhone, configured Shelly to connect to my home Wi-Fi network, and, &lt;em&gt;ta-da&lt;/em&gt; 🎉, I can turn on and off my living room light with a click of a button on the app.&lt;/p&gt;
&lt;p&gt;I was very pleased with the build quality and reliability of the Shelly devices. At the time, if someone asked me for recommendations, Shelly would be a no-brainer.&lt;/p&gt;
&lt;div class=&quot;image-grid-breakout&quot;&gt;&lt;div class=&quot;image-grid&quot;&gt;
&lt;figure class=&quot;image-figure &quot; style=&quot;max-width: 300px; margin: 0 auto;&quot;&gt;
					&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://couto.io/blog/automating-my-apartment-part-1/eZTgAgnIzA-720.avif&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://couto.io/blog/automating-my-apartment-part-1/eZTgAgnIzA-720.webp&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://couto.io/blog/automating-my-apartment-part-1/eZTgAgnIzA-720.jpeg&quot; alt=&quot;Shelly App&quot; width=&quot;720&quot; height=&quot;1561&quot;&gt;&lt;/picture&gt;
					&lt;figcaption&gt;Shelly App&lt;/figcaption&gt;
				&lt;/figure&gt;
&lt;figure class=&quot;image-figure &quot; style=&quot;max-width: 300px; margin: 0 auto;&quot;&gt;
					&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://couto.io/blog/automating-my-apartment-part-1/zbWWWBaqAd-720.avif&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://couto.io/blog/automating-my-apartment-part-1/zbWWWBaqAd-720.webp&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://couto.io/blog/automating-my-apartment-part-1/zbWWWBaqAd-720.jpeg&quot; alt=&quot;Room Screen&quot; width=&quot;720&quot; height=&quot;1561&quot;&gt;&lt;/picture&gt;
					&lt;figcaption&gt;Room Screen&lt;/figcaption&gt;
				&lt;/figure&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;h3 id=&quot;connecting-to-homekit&quot;&gt;Connecting to HomeKit&lt;/h3&gt;
&lt;p&gt;As my phone and computer are Apple devices, it felt natural to expand this integration to Apple’s smart home ecosystem — HomeKit. However, Shelly does not have support for HomeKit. After some research, I found a &lt;a href=&quot;https://github.com/mongoose-os-apps/shelly-homekit&quot;&gt;custom firmware that adds support for HomeKit&lt;/a&gt; but you lose the Shelly Cloud connection feature. As this was not a big deal at the time, I flashed the custom firmware following the easy instructions on the GitHub repo. Another &lt;em&gt;ta-da&lt;/em&gt; 🎉, it worked perfectly.&lt;/p&gt;
&lt;p&gt;This was my first step into HomeKit.&lt;/p&gt;
&lt;p&gt;I immediately liked Apple’s Home app interface better than the Shelly app — I like apps that follow the OS design principles or have a strong design language, none of the previous applies to Shelly.&lt;/p&gt;
&lt;p&gt;Although the custom firmware was working, there were a couple of things that were boring me:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;I couldn’t control the Shelly device when I wasn’t connected to my home network&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Bugfixes or new features in Shelly’s official firmware need to be implemented in the open-source contributors of the custom firmware, which can take some time or not happen at all&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Fortunately, I found &lt;a href=&quot;https://homebridge.io&quot;&gt;HomeBridge&lt;/a&gt;, a project that advertises itself as a smart home hub to HomeKit, with &lt;a href=&quot;https://www.npmjs.com/search?q=keywords:homebridge-plugin&quot;&gt;lots of plugins&lt;/a&gt; to connect non-HomeKit devices to Apple’s ecosystem. It is lightweight, thus it can be installed in a Raspberry Pi or some old Linux box you have.&lt;/p&gt;
&lt;p&gt;I reverted the Shelly firmware to the official one, picked up an old Intel NUC I had building up dust, installed HomeBridge and the &lt;a href=&quot;https://github.com/alexryd/homebridge-shelly&quot;&gt;homebridge-shelly&lt;/a&gt; plugin, and, you guessed it, &lt;em&gt;ta-da&lt;/em&gt; 🎉!&lt;/p&gt;
&lt;figure class=&quot;image-figure &quot;&gt;
					&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://couto.io/blog/automating-my-apartment-part-1/vPVWmPdDWQ-1456.avif&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://couto.io/blog/automating-my-apartment-part-1/vPVWmPdDWQ-1456.webp&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://couto.io/blog/automating-my-apartment-part-1/vPVWmPdDWQ-1456.jpeg&quot; alt=&quot;I’m impatient.&quot; width=&quot;1456&quot; height=&quot;762&quot;&gt;&lt;/picture&gt;
					&lt;figcaption&gt;I’m impatient.&lt;/figcaption&gt;
				&lt;/figure&gt;
&lt;h3 id=&quot;automation-and-scenes&quot;&gt;Automation and Scenes&lt;/h3&gt;
&lt;p&gt;At this point, I set up the second Shelly on the floor shade next to the TV. When I turn on the main living room light, I also like to turn on the floor shade. With Apple Home’s &lt;em&gt;Automation&lt;/em&gt; feature, I could turn on/off both lights simultaneously:&lt;/p&gt;
&lt;figure class=&quot;image-figure &quot; style=&quot;max-width: 300px; margin: 0 auto;&quot;&gt;
					&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;https://couto.io/blog/automating-my-apartment-part-1/TO2JVHlIUK-1179.avif&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;https://couto.io/blog/automating-my-apartment-part-1/TO2JVHlIUK-1179.webp&quot;&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;https://couto.io/blog/automating-my-apartment-part-1/TO2JVHlIUK-1179.png&quot; alt=&quot;Nice extra feature, this automation only triggers after the sun sets down&quot; width=&quot;1179&quot; height=&quot;2556&quot;&gt;&lt;/picture&gt;
					&lt;figcaption&gt;Nice extra feature, this automation only triggers after the sun sets down&lt;/figcaption&gt;
				&lt;/figure&gt;
&lt;p&gt;Additionally, I created a &lt;em&gt;Scene&lt;/em&gt; in Apple Home that turns off the main living room light, the floor shade, and the TV (an LG which had HomeKit integration out of the box).&lt;/p&gt;
&lt;p&gt;I must say that picking up my iPhone and saying “Hey Siri, goodnight” and looking at everything turning off instantly while walking to my bedroom feels good.&lt;/p&gt;
&lt;p&gt;In the next part, I discovered Matter and started building a Thread network.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Git LFS Migrate All Branches</title>
    <link href="https://couto.io/blog/migrate-all-branches-to-git-lfs/" />
    <updated>2019-11-14T14:32:01Z</updated>
    <id>https://couto.io/blog/migrate-all-branches-to-git-lfs/</id>
    <content type="html">&lt;blockquote&gt;
&lt;p&gt;Git is a distributed version control system, meaning the entire history of the
repository is transferred to the client during the cloning process.
&lt;strong&gt;For projects containing large files, particularly large files that are
modified regularly, this initial clone can take a huge amount of time&lt;/strong&gt;, as
every version of every file has to be downloaded by the client. &lt;strong&gt;Git LFS&lt;/strong&gt;
(Large File Storage) is a Git extension developed by Atlassian, GitHub, and
a few other open source contributors, that &lt;strong&gt;reduces the impact of large files
in your repository by downloading the relevant versions of them lazily&lt;/strong&gt;.
Specifically, large files are downloaded during the checkout process rather
than during cloning or fetching. [^1]&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;[^1]: &lt;em&gt;&lt;a href=&quot;https://www.atlassian.com/git/tutorials/git-lfs&quot;&gt;Atlassian Git LFS Tutorial&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;My quest was simple: migrate all the binary files in a repository to
Git LFS in all branches without breaking stuff.&lt;/p&gt;
&lt;p&gt;After searching a bit, I found multiple ways of achieving this.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https://github.com/rtyley/bfg-repo-cleaner&quot;&gt;BFG Repo Cleaner&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https://github.com/git-lfs/git-lfs&quot;&gt;&lt;code&gt;git-lfs&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;round-1-git-lfs&quot;&gt;Round 1: Git LFS ❌&lt;/h3&gt;
&lt;p&gt;My first try was to use &lt;code&gt;git lfs migrate import --include=&amp;quot;*.jpg,*.png&lt;/code&gt;
directly into my freshly cloned version of the repo:&lt;/p&gt;
&lt;pre class=&quot;language-shell&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-shell&quot;&gt;migrate: Fetching remote refs: &lt;span class=&quot;token punctuation&quot;&gt;..&lt;/span&gt;., &lt;span class=&quot;token keyword&quot;&gt;done&lt;/span&gt;
migrate: Sorting commits: &lt;span class=&quot;token punctuation&quot;&gt;..&lt;/span&gt;., &lt;span class=&quot;token keyword&quot;&gt;done&lt;/span&gt;
Error &lt;span class=&quot;token keyword&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; rev-list &lt;span class=&quot;token parameter variable&quot;&gt;--stdin&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;--reverse&lt;/span&gt; --topo-order --do-walk --: &lt;span class=&quot;token builtin class-name&quot;&gt;exit&lt;/span&gt; status &lt;span class=&quot;token number&quot;&gt;128&lt;/span&gt; fatal: bad revision &lt;span class=&quot;token string&quot;&gt;&#39;^refs/remotes/origin/1.0&#39;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Found that you can include the git &lt;em&gt;refs&lt;/em&gt; you want, but I wanted a way of
migrating all the files in all the branches automatically.
Many tutorials that I&#39;ve found online refer to BFG Repo Cleaner
so let&#39;s give it a try.&lt;/p&gt;
&lt;h3 id=&quot;round-2-bfg&quot;&gt;Round 2: BFG ❌&lt;/h3&gt;
&lt;p&gt;Installed Java and BFG, cloned a bare version of the repo using
&lt;code&gt;git clone --mirror &amp;lt;git-repo&amp;gt;&lt;/code&gt; and ran the tool pointing to the bare repo:&lt;/p&gt;
&lt;pre class=&quot;language-shell&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-shell&quot;&gt;bfg --convert-to-git-lfs &lt;span class=&quot;token string&quot;&gt;&quot;*.{jpg,png}&quot;&lt;/span&gt; --no-blob-protection &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;git-repo&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;.git&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This was indeed fast, but I&#39;ve found that BFG adds a &lt;code&gt;.gitattributes&lt;/code&gt; file
inside every folder where it finds a to-be tracked LFS file. This was not
the way I intended it to be, I prefer a single &lt;code&gt;.gitattributes&lt;/code&gt; file in the
the repo&#39;s root directory.&lt;/p&gt;
&lt;p&gt;Also, I don&#39;t know why, but when I cloned the post-BFG repo, Git LFS didn&#39;t
download the files. 🤷‍♂️&lt;/p&gt;
&lt;h3 id=&quot;round-3-git-lfs-again&quot;&gt;Round 3: Git LFS (again) ✅&lt;/h3&gt;
&lt;p&gt;Next thing was to try to run Git LFS on the bare repo:&lt;/p&gt;
&lt;pre class=&quot;language-shell&quot; tabindex=&quot;0&quot;&gt;&lt;code class=&quot;language-shell&quot;&gt;&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; clone &lt;span class=&quot;token parameter variable&quot;&gt;--mirror&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;git-repo&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;
&lt;span class=&quot;token builtin class-name&quot;&gt;cd&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;&amp;lt;&lt;/span&gt;git-repo&lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt;.git
&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; lfs migrate &lt;span class=&quot;token function&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;--include&lt;/span&gt;&lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;*.jpg,*.png&quot;&lt;/span&gt; &lt;span class=&quot;token parameter variable&quot;&gt;--everything&lt;/span&gt;
&lt;span class=&quot;token function&quot;&gt;git&lt;/span&gt; push &lt;span class=&quot;token parameter variable&quot;&gt;--force&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The remote denied the &lt;code&gt;git push --force&lt;/code&gt; because of the protected branches and
tags on GitLab, but after I&#39;ve unlocked them, it worked 🎉&lt;/p&gt;
&lt;p&gt;All the files were moved to the LFS storage, the history was rewritten to have
the new file pointers and the &lt;code&gt;.gitattributes&lt;/code&gt; files were added in the
root directory in every git &lt;em&gt;ref&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;I forgot to enable the &lt;code&gt;--everything&lt;/code&gt; switch on my first run, maybe that works
as well, but the bare-repo clone was faster anyway.&lt;/p&gt;
</content>
  </entry>
</feed>