Skip to content

The requested page could not be found (404). This is the default page.

Alternative map provider for Home Assistant

I've encountered the following issue with Home Assistant. I use HA to track people on the map. But when I look at the map I can't always determine where a person is because some important details are missing on the map, such as building numbers, as well as POIs and object names.

HA uses CARTO as its map provider. The CARTO map seems to be based on OpenStreetMap, but has less details. And moreover HA uses light gray or dark gray variant which has even less details than the default colored map.

Check the difference between light gray CARTO vs default CARTO vs OpenStreetMap:

So I decided to replace the map provider with OpenStreetMap. This can be done by editing the source code and rebuilding the frontend.

Here are the steps.

- Ensure that you have nodejs and yarn installed on your machine. They are needed to build the frontend.

- Clone the git repository

$ git clone https://github.com/home-assistant/frontend.git

- Move to the repo directory

$ cd frontend

- Checkout the frontend version that corresponds to your HA version (20210504.0 for Home Assistant 2021.5.1)

$ git checkout 20210504.0

- Download the patch (or create it manually by pasting the patch contents into your favorite text editor)

$ wget https://vampik.ru/uploads/osm.patch

- Apply the patch

$ git apply osm.patch

- Run initial setup

$ script/setup

- Run production build - this can take a large amount of time (around 40 minutes on my server, for example)

$ script/build_frontend

- hass_frontend directory will appear here. Find your Home Assistant frontend directory (/opt/homeassistant/lib/python3.8/site-packages/hass_frontend in my case, yours may differ depending on the installation path and python version) and replace its contents with the contents of the newly generated hass_frontend directory.

- Restart Home Assistant

Here is the patch: osm.patch

diff --git a/src/common/dom/setup-leaflet-map.ts b/src/common/dom/setup-leaflet-map.ts
index 50bc77840..eddbd4db9 100644
--- a/src/common/dom/setup-leaflet-map.ts
+++ b/src/common/dom/setup-leaflet-map.ts
@@ -50,14 +50,12 @@ const createTileLayer = (
   darkMode: boolean
 ): TileLayer =>
   leaflet.tileLayer(
-    `https://{s}.basemaps.cartocdn.com/${
-      darkMode ? "dark_all" : "light_all"
-    }/{z}/{x}/{y}${leaflet.Browser.retina ? "@2x.png" : ".png"}`,
+    `https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png`,
     {
       attribution:
-        '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>, &copy; <a href="https://carto.com/attributions">CARTO</a>',
-      subdomains: "abcd",
+        '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
+      subdomains: "abc",
       minZoom: 0,
-      maxZoom: 20,
+      maxZoom: 19,
     }
   );

Obviously this should be done again every time you upgrade your Home Assistant.

Missing virtio drivers after genkernel upgrade on Gentoo

After upgrading genkernel to version 4.0.0_rc1 or higher on Gentoo you may encounter that your KVM virtual machine doesn't boot with a newly built kernel or doesn't have the networking or something else. The reason is that virtio drivers are now disabled by default in genkernel's kernel config.
The solution is to either make use of --virtio command line option or manually enable all needed drivers in the kernel config.

The same also applies to bcache - use --bcache or manually enable CONFIG_BCACHE and to HyperV in genkernel 4.0.0 or higher - use --hyperv or manually enable all needed drivers.

No console on tty1 after systemd upgrade on Gentoo

After upgrading systemd to version 242 or higher on Gentoo you may encounter that you do not have a console on tty1 anymore.

To fix this you need to issue the following commands:

  # systemctl enable getty@tty1.service
  # systemctl enable remote-fs.target

This is not needed for new installs after 2019-08-12 since there was a fix for new installs. However upgrading old existing installs is still affected.

Gentoo bug #691854.

Swapfile issue after kernel upgrade

After upgrading to Linux kernel 5.7 or higher you may encounter an issue with a swapfile created using fallocate.

  [    3.675736] swapon: swapfile has holes
  [    3.684412] systemd[1]: swapfile.swap: Swap process exited, code=exited, status=255/EXCEPTION
  [    3.684417] systemd[1]: swapfile.swap: Failed with result 'exit-code'.
  [    3.685196] systemd[1]: Failed to activate swap /swapfile.

Solution: re-create the swapfile using dd.

  # truncate -s 0 /swapfile
  # dd if=/dev/zero of=/swapfile bs=1M count=1024 status=progress
  # mkswap /swapfile
  # swapon -a

Gentoo overlay

My personal Gentoo overlay: https://github.com/anyuta1166/gentoo-overlay

Here is the list of my ebuilds with their modifications:

app-misc/mosquitto

  • add systemd USE flag to compile with systemd support if present
  • use systemd unit file provided by the upstream

dev-lang/php

  • add the patch by Manuel Mausz to fix the 9 years old bug #53611 (fastcgi_param PHP_VALUE pollutes other sites) (not yet accepted by upstream)
  • add the patch by Manuel Mausz that changes the mode of PHP_VALUE from ZEND_INI_USER to ZEND_INI_PERDIR and disables PHP_ADMIN_VALUE

media-sound/murmur

  • fix systemd unit startup error by moving configuration file from /etc/murmur/murmur.ini to /etc/murmur.ini as expected by upstream

Gentoo bug: #689208 (partially accepted).

net-dns/dnsdist

  • patch systemd unit file to make use of dnsdist user/group

net-dns/pdns-recursor

  • remove chroot option because it is incompatible with the systemd unit file provided by the upstream, according to the upstream policy (see #4848 #4179: Our policy is, don't chroot.)
  • remove quiet option because it is on by default, and thus there is no need to modify it

It is impossible to start the service if using systemd without either removing chroot option or modifying the systemd unit file.

net-firewall/iptables

  • use custom systemd unit file
    Gentoo bug: #555920 (no answer)

net-proxy/shadowsocks-libev

  • use configuration and systemd unit files provided by the upstream

to be continued..

Модификация прошивки "от энтузиастов" для маршрутизаторов Asus, D-Link, Netgear

Прошивка от Vampik - не является самостоятельной прошивкой, это модификация прошивки 1.9.2.7-d/-rtn от энтузиастов (авторы - lly и theMIROn). Она в свою очередь является продолжением небезызвестных прошивок "от Олега".

Разработка модификации прекращена в 2013 г. в связи с устареванием оборудования и отсутствием поддержки новых моделей в ядре.

Последние версии прошивки:

Устаревшая прошивка ветки -d

Новая прошивка ветки -rtn

Примечания к поддерживаемым моделям:

D-Link DIR-320 rev. A1, A2. Прошивка -rtn урезанной версии из-за 4 МБ флеш-памяти. Удалена поддержка веб-камер, FTP-сервер, Samba, NFS, SNMP, tcpdump. Поддержка принтеров ограничена (отсутствует поддержка LPR). Поддержка USB-накопителей ограничена (отсутствует поддержка NTFS и утилиты для форматирования и проверки файловой системы). Доступна полная версия устаревшей прошивки ветки -d, но в ней нет поддержки новых модемов. Переход с оригинальной прошивки D-Link осуществляется через промежуточную прошивку DIR320-wimax-1.2.6.bin. Переход со старой прошивки от энтузиастов для WL500GPv2 осуществляется загрузкой прошивки по tftp в момент включения роутера. IP-адрес загрузчика: 192.168.0.1, на устройстве с которого производится прошивка необходимо установить адрес из подсети 192.168.0.0/24. После перехода на прошивку от энтузиастов обязателен сброс настроек.

Asus WL-700gE. Поддерживается только в случае перепайки флеш-памяти с 2 МБ на 8 МБ.

D-Link DIR-620 rev. C1. Нет поддержки второй версии этой ревизии, возможна неполная поддержка начиная со сборки 3.0.6.5218.

NetGear WNR3500L v1. Маркировка на корпусе: WNR3500U/WNR3500L. Требуется внимательно выбирать версию прошивки. Прошивки для v1 и v2 несовместимы между собой. Восстановление после загрузки неправильной версии прошивки возможно только при наличии USB-TTL конвертера.

NetGear WNR3500L v2. Маркировка на корпусе: WNR3500L v2. Требуется внимательно выбирать версию прошивки. Прошивки для v1 и v2 несовместимы между собой. Восстановление после загрузки неправильной версии прошивки возможно только при наличии USB-TTL конвертера. Промежуточная версия для перехода с родной прошивки: entware-wnr3500lv2.chk