Code Monkey home page Code Monkey logo

homeassistant_on_openwrt's Introduction

Homeassistant on OpenWrt

This repo provides tools to install the latest version of Home Assistant. (2024.2.x) on a system with OpenWrt 23.05+ installed. It provides the reduced version of HA with only minimal list of components included. Additionally, it keeps MQTT, ESPHome, and ZHA components as they are widely used with smart home solutions.

It is distributed with a shell script that downloads and installs everything that required for a clean start.

Requirements:

  • 256 MB storage space
  • 256 MB RAM
  • OpenWrt 23.05.0 or newer installed

Generic installation

Then, download the installer and run it.

wget https://raw.githubusercontent.com/openlumi/homeassistant_on_openwrt/23.05/ha_install.sh -O - | sh

After script prints Done. you have Home Assistant installed. Start the service or reboot the device to get it start automatically. The web interface will be on 8123 port after all components load.

Home Assitant

The only components with flows included are MQTT and ZHA. After adding a component in the interface or via the config HA could install dependencies and fails on finding them after installation. In this case restarting HA could work.

Other components are not tested and may require additional changed in requirement versions or python libraries.

ZHA usage on Xiaomi Gateway

The component uses internal UART to communicate with ZigBee chip. The chip has to be flashed with a proper firmware to be able to communicate with the HA. The recommended firmware is v3.23:

https://github.com/openlumi/ZiGate/releases/download/55f8--20230114-1835/ZigbeeNodeControlBridge_JN5169_COORDINATOR_115200.bin

You could try another Zigate firmwares for JN5169 chip. The baud rate must be 115200 as it is hardcoded in zigpy-zigate.

Use /dev/ttymxc1 port for ZHA configuration, it is connected to the zigbee chip.

It is REQUIRED to erase Persistent Data Manager (PDM) before adding new devices. Otherwise, device adding fails.

Use luci zigbee tools submenu to send erase PDM command with the button or erase PDM in console:

jntool erase_pdm

Zigbee port must not be locked with any program, like ZHA or zigbee2mqtt.

NOTE: It may require restarting Home Assistant after adding a new component via the UI to let it see newly installed requirements. E.g. ZHA installs paho-mqtt and will not allow configuring it unless HA is restarted.

Enabling other components and installing custom

You may want to add more components to your HA installation. In this case you have to download tar.gz from PyPI: https://pypi.org/project/homeassistant/2024.2.0/#files Then extract the content and copy the required components to /usr/lib/python3.11/site-packages/homeassistant/components If the component uses the frontend wizard, you may want to uncomment the corresponding line in /usr/lib/python3.11/site-packages/homeassistant/generated/config_flows.py also.

Or you can create custom_components directory in /etc/homeassistant and copy it there.

Try to install requirements from manifest.json with pip3 manually to check it installs and doesn't require pre-compiled C libraries. Otherwise, you have to cross-compile python3 dependencies and install them as ipk packages.

If the dependency is already installed via opkg or via pip3 you may want to fix the strict dependency in manifest.json to a weaker one or remove versions at all.

homeassistant_on_openwrt's People

Contributors

condemil avatar devbis avatar jaschum avatar ohabu avatar xiagw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

homeassistant_on_openwrt's Issues

zeroconf

replace "zeroconf==0.39.4" with "zeroconf==0.47.1" to avoid install problem

unable to finish homeassistant init process

Fresh install on openwrt 23.05 X86_64
the install script finished with 3 dependances ERROR:

chacha20poly1305-reuseable>=0.12.1
cryptography>=42.0.2
pyopenssl>=24.0.0

resolve it by
pip install pyopenssl==24.0.0 cryptography==42.0.2 chacha20poly1305-reuseable==0.12.1

Successfully built homeassistant
Installing collected packages: homeassistant
Successfully installed homeassistant-2024.2.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

[notice] A new release of pip is available: 23.3.1 -> 24.0
[notice] To update, run: pip install --upgrade pip
Create starting script in init.d
Done.

Start the service:
/etc/init.d/homeassistant start

the init process crash when reaching the data collection page:
image

the ha service will stop and logs shows nothing related to the crash:
2024-02-15 12:58:37.952 WARNING (Recorder) [homeassistant.components.recorder.util] Ended unfinished session (id=4 from 2024-02-15 04:49:14.879923)

Script exit after opkg update

Hi, I'm trying to install HA using this script and it exits right after opkg update.

Checking the script, the next line would be:
opkg list | grep python3-base | head -n 1 | grep -Eo '\d+.\d+'

The result of this line is empty, and removing the last grep, it shows:
python3-base - 3.10.9-1 - This package contains only the interpreter and the bare minimum for the interpreter to start.

I'm on Orange Pi custom firmware that I compiled myself:
Model: Xunlong Orange Pi R1 Plus LTS
Architecture: ARMv8 Processor rev 4
Target Platform: rockchip/armv8
Firmware Version: OpenWrt 22.03.2 r19803-9a599fee93 / LuCI openwrt-22.03 branch git-22.288.45147-96ec0cd
Kernel Version: 5.10.146

Could you please help me understand what is wrong?
Thank you =D

How to update?

Is it possible to have it upgrade to the latest version automatically?
I have tried to modify the $HOMEASSISTANT_MAJOR_VERSION to 2022.12 in .sh in order to update the Homeassistant to ver 2022.12, but it failed.

Error Messages:

Using /usr/lib/python3.9/site-packages
Finished processing dependencies for pycognito==2022.1.0
Installing python-ipp...
/tmp/python-ipp-0.12.1
sed: requirements.txt: No such file or directory

Using /usr/lib/python3.9/site-packages
Finished processing dependencies for pycognito==2022.1.0
Installing python-ipp...
/tmp/python-ipp-0.12.1
python3: can't open file '/tmp/python-ipp-0.12.1/setup.py': [Errno 2] No such file or directory

How to fix it or update?

Homeassistant have to be restarted before each access.

Homeassistant face me "loading data" forever and ever, and ever. Somettimes it reacheable after i restarted it, but only 1 time.

ramips/mt7621

OpenWrt 23.05.0 r23497-6637af95aa / LuCI openwrt-23.05 branch git-24.040.70644-45b9e79

256 RAM

32 GB Extroot

2GB SWAP

Uninstall

Hi! Is there a way to uninstall it right?

bluetooth to wifi proxy support missing?

Has anyone managed to get btproxy to wifi working ? I flashed a esp32 with btproxy enabled but i am unable to autodiscover a new govee-ble temperature and humidity sensor on this stripped down home assistant. The same setup works fine on a full install of home assistant on a raspberry pi

Any ideas on what settings to enable for this

Errors when installing

Collected errors:

  • opkg_install_cmd: Cannot install package python3-cryptography.
  • pkg_hash_check_unresolved: cannot find dependency python3-cryptography for python3-pyopenssl
  • pkg_hash_fetch_best_installation_candidate: Packages for python3-pyopenssl found, but incompatible with the architectures configured
  • opkg_install_cmd: Cannot install package python3-pyopenssl.

image

HA Log error radios==0.1.1 package not able to be installed

Hi, I found a few problem with the latest installation script.

After the install finished. I checked the homeassistant logs system->log

there are multiple errors in the log related to async wait functions inside the python code.
and a message that pip is not able to install "radios==0.1.1," needed for the radio integration.

FIX:
add "opkg install python3-pycares" this dependency is missing.

Other problem, install script stops at pip install of zeroconfig package

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. 
aioesphomeapi 13.0.2 requires noiseprotocol<1.0,>=0.3.1, which is not installed. 
aioesphomeapi 13.0.2 requires protobuf>=3.19.0, which is not installed. 
aioesphomeapi 13.0.2 requires async-timeout>=4.0, but you have async-timeout 3.0.1 which is incompatible. 

I'm not sure if this is a real issue or not, looking at the script it seems these pip dependencies can be ignore. to work around the install from stopping I removed the line from the top of the script:
set -e

A better alternative would be to install the missing dependencies.
noiseprotocol & protobuf can be installed using pip without issues it seems.

Fix for: async-timeout>=4.0
To fix this I compiled a new version of the async-timeout version. openwrt build system

PKG_VERSION:=4.0.2
PKG_HASH:=2163e1640ddb52b7a8c80d0a67a08587e5d245cc9c553a74a847056bc2976b15

Please note that I'm using different hardware (ZBT - WG1608 router 32MB flash 512MB ram MT7621 compiled custom kernel to support Float emulation needed for numpy) but I believe this is not related to the problems above.
aliexpress WG1608

lastly: Many many thanks for this installation script, It helped me so much. I learned so much from this and I went from total linux noob to quite capable user :D. I studied this script in detail line by line, added comments to everything trying to figure out how you managed to get this working, its amazing thank you for your work.

"sed: unmatched '/'" stops the installation.

wget https://raw.githubusercontent.com/openlumi/homeassistant_on
_openwrt/23.05/ha_install.sh -O - | sh
Downloading 'https://raw.githubusercontent.com/openlumi/homeassistant_on_openwrt/23.05/ha_install.sh'
Connecting to 185.199.109.133:443
Writing to stdout

  •                100% |*******************************| 24469   0:00:00 ETA
    

Download completed (24469 bytes)

Installing Home Assistant 2024.2.1 ...

Install base requirements from feed...
Downloading https://downloads.openwrt.org/releases/23.05.0/targets/ramips/mt7621/packages/Packages.gz
Updated list of available packages in /usr/lib/opkg/lists/openwrt_core
Downloading https://downloads.openwrt.org/releases/23.05.0/targets/ramips/mt7621/packages/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/23.05.0/packages/mipsel_24kc/base/Packages.gz
Updated list of available packages in /usr/lib/opkg/lists/openwrt_base
Downloading https://downloads.openwrt.org/releases/23.05.0/packages/mipsel_24kc/base/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/23.05.0/packages/mipsel_24kc/luci/Packages.gz
Updated list of available packages in /usr/lib/opkg/lists/openwrt_luci
Downloading https://downloads.openwrt.org/releases/23.05.0/packages/mipsel_24kc/luci/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/23.05.0/packages/mipsel_24kc/packages/Packages.gz
Updated list of available packages in /usr/lib/opkg/lists/openwrt_packages
Downloading https://downloads.openwrt.org/releases/23.05.0/packages/mipsel_24kc/packages/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/23.05.0/packages/mipsel_24kc/routing/Packages.gz
Updated list of available packages in /usr/lib/opkg/lists/openwrt_routing
Downloading https://downloads.openwrt.org/releases/23.05.0/packages/mipsel_24kc/routing/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/23.05.0/packages/mipsel_24kc/telephony/Packages.gz
Updated list of available packages in /usr/lib/opkg/lists/openwrt_telephony
Downloading https://downloads.openwrt.org/releases/23.05.0/packages/mipsel_24kc/telephony/Packages.sig
Signature check passed.
Detected Python 3.11
Package python3-base (3.11.7-1) installed in root is up to date.
Package python3-pynacl (1.5.0-3) installed in root is up to date.
Package python3-ciso8601 (2.3.0-1) installed in root is up to date.
Package patch (2.7.6-7) installed in root is up to date.
Package unzip (6.0-8) installed in root is up to date.
Package libjpeg-turbo (2.1.4-2) installed in root is up to date.
Package python3-aiohttp (3.8.5-1) installed in root is up to date.
Package python3-aiohttp-cors (0.7.0-2) installed in root is up to date.
Package python3-async-timeout (4.0.2-1) installed in root is up to date.
Package python3-asyncio (3.11.7-1) installed in root is up to date.
Package python3-attrs (23.1.0-1) installed in root is up to date.
Package python3-bcrypt (4.0.1-1) installed in root is up to date.
Package python3-boto3 (1.28.7-1) installed in root is up to date.
Package python3-botocore (1.31.7-1) installed in root is up to date.
Package python3-certifi (2023.7.22-1) installed in root is up to date.
Package python3-cffi (1.16.0-1) installed in root is up to date.
Package python3-cgi (3.11.7-1) installed in root is up to date.
Package python3-cgitb (3.11.7-1) installed in root is up to date.
Package python3-chardet (5.1.0-1) installed in root is up to date.
Package python3-codecs (3.11.7-1) installed in root is up to date.
Package python3-cryptodome (3.18.0-1) installed in root is up to date.
Package python3-cryptodomex (3.18.0-1) installed in root is up to date.
Package python3-cryptography (41.0.7-1) installed in root is up to date.
Package python3-ctypes (3.11.7-1) installed in root is up to date.
Package python3-dateutil (2.8.2-2) installed in root is up to date.
Package python3-dbm (3.11.7-1) installed in root is up to date.
Package python3-decimal (3.11.7-1) installed in root is up to date.
Package python3-defusedxml (0.7.1-1) installed in root is up to date.
Package python3-distutils (3.11.7-1) installed in root is up to date.
Package python3-docutils (0.20.1-1) installed in root is up to date.
Package python3-email (3.11.7-1) installed in root is up to date.
Package python3-greenlet (2.0.2-1) installed in root is up to date.
Package python3-idna (3.4-1) installed in root is up to date.
Package python3-jinja2 (3.1.2-1) installed in root is up to date.
Package python3-jmespath (1.0.1-1) installed in root is up to date.
Package python3-light (3.11.7-1) installed in root is up to date.
Package python3-logging (3.11.7-1) installed in root is up to date.
Package python3-lzma (3.11.7-1) installed in root is up to date.
Package python3-markupsafe (2.1.3-1) installed in root is up to date.
Package python3-multidict (6.0.4-1) installed in root is up to date.
Package python3-multiprocessing (3.11.7-1) installed in root is up to date.
Package python3-ncurses (3.11.7-1) installed in root is up to date.
Package python3-netdisco (3.0.0-1) installed in root is up to date.
Package python3-netifaces (0.11.0-1) installed in root is up to date.
Package python3-openssl (3.11.7-1) installed in root is up to date.
Package python3-pillow (9.5.0-2) installed in root is up to date.
Package python3-pip (23.2.1-1) installed in root is up to date.
Package python3-pkg-resources (68.2.2-1) installed in root is up to date.
Package python3-ply (3.11-2) installed in root is up to date.
Package python3-psutil (5.9.5-1) installed in root is up to date.
Package python3-pycparser (2.21-2) installed in root is up to date.
Package python3-pydoc (3.11.7-1) installed in root is up to date.
Package python3-pyopenssl (23.2.0-1) installed in root is up to date.
Package python3-pytz (2023.3-1) installed in root is up to date.
Package python3-requests (2.30.0-1) installed in root is up to date.
Package python3-s3transfer (0.6.1-1) installed in root is up to date.
Package python3-setuptools (68.2.2-1) installed in root is up to date.
Package python3-six (1.16.0-1) installed in root is up to date.
Package python3-slugify (8.0.1-1) installed in root is up to date.
Package python3-sqlalchemy (2.0.20-1) installed in root is up to date.
Package python3-sqlite3 (3.11.7-1) installed in root is up to date.
Package python3-unittest (3.11.7-1) installed in root is up to date.
Package python3-urllib (3.11.7-1) installed in root is up to date.
Package python3-urllib3 (2.0.4-1) installed in root is up to date.
Package python3-xml (3.11.7-1) installed in root is up to date.
Package python3-yaml (6.0.1-1) installed in root is up to date.
Package python3-yarl (1.9.2-1) installed in root is up to date.
Unknown package 'python3-gdbm'.
Package python3-pycares (4.3.0-2) installed in root is up to date.
Unknown package 'python3-numpy'.
find: /usr/lib/python3.11/site-packages/numpy: No such file or directory
Install base requirements from PyPI...
Requirement already satisfied: wheel in /usr/lib/python3.11/site-packages (0.42.0)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Requirement already satisfied: aioesphomeapi==21.0.2 in /usr/lib/python3.11/site-packages (from -r /tmp/requirements_nodeps.txt (line 1)) (21.0.2)
Requirement already satisfied: esphome-dashboard-api==1.2.3 in /usr/lib/python3.11/site-packages (from -r /tmp/requirements_nodeps.txt (line 2)) (1.2.3)
Requirement already satisfied: zeroconf==0.131.0 in /usr/lib/python3.11/site-packages (from -r /tmp/requirements_nodeps.txt (line 3)) (0.131.0)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
sed: unmatched '/'

Cannot install package python3-numpy on OpenWrt 22.03.0-rc4

I just removed the package install from the script and everything seems fine so far. Maybe just take out this package from the main list and try-and-let-fail if it does not exist.

I think that the requirements are way off though. Newifi-D1 OpenWrt 22.03.0-rc4 with no much installed and storage is at 456 MB used of 1000MB after install. I would much rather avoid cross compiling but I am not sure openwrt can compile even with big extroot. Swap file is something like 50MB of 256MB used.
I think it would be better to have something like:
mount | grep overlay | grep "/dev/sd"
to check extroot exists and suggest usb extroot with ssd drive or hd before proceeding with install. I do not think there are any routers with these kinds of available disk space. I could see this this kind of script doing some pretty severe damage to routers not up to the task. Also simple bash-fu "free | grep Swap" would be a good requirement.

Anyway, I shall proceed with the painful task of configuring HA but the user interface already feels much faster than on much higher specified orangepi pc I had it on previously. I know, dusty old dual core MIPS beating modern quad core Arm... I think it might be because people are using slow TF cards with raspberries and orange pi.

doesnt appear to work for Banana PI BPI-R4 / missing dependency libbz2

Banana PI BPI-R4

Collected errors:

  • pkg_hash_check_unresolved: cannot find dependency libbz2-1.0 for python3-light
  • pkg_hash_fetch_best_installation_candidate: Packages for python3-light found, but incompatible with the architectures configured
  • satisfy_dependencies_for: Cannot satisfy the following dependencies for python3-pynacl:
  • libbz2-1.0
  • opkg_install_cmd: Cannot install package python3-pynacl.

Is it HomeAssistant OS or docker container?

Hello!
Does this module install HomeAssistant OS and allow you to install addons such as MQTT? (Or its just a docker container)
I use x86 openwrt as host system, will Zigbee USB sticks detect and work with this instance?

MQTT broken on 2022.12.8

Changes in MQTT in HA 2022.12 broke the installation script:

  1. MQTT integration now requires text component, which apparently gets removed by the script.
  2. After adding missing text component, I get this error:
2022-12-24 09:40:27.203 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry 127.0.0.1 for mqtt
File "/usr/lib/python3.10/site-packages/homeassistant/components/mqtt/__init__.py", line 543, in async_setup_entry
File "/usr/lib/python3.10/site-packages/homeassistant/components/mqtt/__init__.py", line 510, in async_forward_entry_setup_and_setup_discovery
File "/usr/lib/python3.10/site-packages/homeassistant/components/mqtt/device_automation.py", line 13, in <module>
File "/usr/lib/python3.10/site-packages/homeassistant/components/mqtt/device_trigger.py", line 28, in <module>
from . import debug_info, trigger as mqtt_trigger
File "/usr/lib/python3.10/site-packages/homeassistant/components/mqtt/trigger.py", line 33, in <module>
vol.Required(CONF_TOPIC): mqtt.util.valid_subscribe_topic_template,
AttributeError: module 'homeassistant.components.mqtt' has no attribute 'util'

util.py is present in ./components/mqtt directory. Some bug reports with similar issues have been resolved by installing missing pip packages, but it is unclear which package is missing. paho-mqtt was not installed despite being mentioned in MQTT integration manifest, but installing it manually did not solve the issue.

I'm trying to install HA on Xiaomi DGNWG05LM with OpenWRT 22.03.2 r19803-9a599fee93

Unfortunately, I'm not experienced enough to debug this issue further.

Integration error: ffmpeg - Integration 'ffmpeg' not found.

Unable to set up dependencies of homekit. Setup failed for dependencies: ffmpeg
I already have FFmpeg installed via opkg, but the ffmpeg path in configuration.yaml shows these prompts whether or not I set it.Homekit and Onvif cannot be installed

HA Companion iOS app login error

After getting the HA instance running, logging in from safari or a desktop works, but trying to use the iOS app after logging in leads to the following error:

Error Code: alamofire.AFError error 9

The only resource I could find related to this was this

However, turning off private address didn't work.

I have no idea if this could be due to HA or having HA on openwrt, if I am being a bother in anyway I more than happy to close this issue.

Bundle and publish as official opkg

Hello,

Are you considering to bundle and publish this into an official opkg package so that anyone can easily find it and use it?

It seems to fulfill all the requirements, like having a init daemon to easily manage the application.

Thank you for the very useful script!

Adding components

Hi, how to add components and configs?
How configs miio component?
I deleted the integration weather, how do I get it back?

script fails at install of "frozenlist-1.3.3" package using pip

The script fails when it tries to install the frozenlist package using pip.
The cause of this problem is that frozenlist-1.3.3 tries to install using "Accelerated build" which is looking for the gcc compiler which is not installed.
script output:

Collecting frozenlist>=1.1.1
  Downloading frozenlist-1.3.3.tar.gz (66 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.6/66.6 kB 4.1 MB/s eta 0:00:00
  error: subprocess-exited-with-error
  
  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 2
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  Installing build dependencies ... error
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 2
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

FIX:
I have found 2 possible solutions for this problem:
Option 1. Patch "setup.py" to force a pure python install:

cd /tmp
wget https://files.pythonhosted.org/packages/e9/10/d629476346112b85c912527b9080944fd2c39a816c2225413dbc0bb6fcc0/frozenlist-1.3.3.tar.gz -O - > frozenlist-1.3.3.tar.gz
tar -zxf frozenlist-1.3.3.tar.gz
cd frozenlist-1.3.3
sed -i 's/if NO_EXTENSIONS:/if 1:/' setup.py
pip3 install --no-cache-dir --no-dependencies .
pip3 install --no-cache-dir --no-dependencies aiosignal
pip3 install --no-cache-dir --no-dependencies charset-normalizer

Option 2. Install gcc so the accelerated build install is possible
This will work but the gcc ipk file is very big ~40MB. It can be removed after installing frozenlist.

opkg install gcc
pip3 install --no-cache-dir --no-dependencies frozenlist
pip3 install --no-cache-dir --no-dependencies aiosignal
pip3 install --no-cache-dir --no-dependencies charset-normalizer
opkg remove gcc

Hardware
WG1608 - ZBT
Dual band WiFi router, 1x WAN, 4x LAN, 1x USB 3.0, 1x SIM, 1x microSDXC, 1x M-PCIE, 1x M.2
RAM: 512MB DDR3
Flash: 32MB (SPI Flash)
MT7621A - MediaTek: MIPS 1004Kc @880MHz 2C/4T (Dual Core/Quad Thread)
Aliexpress product page

Software
Custom build of OpenWrt master branch for my target hardware (>2022.03.02).
Why, because of the numpy requirement for homeassistant I needed to compile my own openwrt image and ipk package of numpy with SOFT_FLOAT (target options) disabled so numpy can be selected inside the menuconfig for compilation.
To make numpy work Floating Point emulation needs to be enabled in the kernel_menuconfig this is why a custom openWrt image was required for me to get homeassistant working. (Note because of the custom kernel all required packages need to be recompiled, packages downloaded from the openwrt feeds will not work.

pip complaining about update

This does not seem to be an issue but a quality of life improvement. The output of the script looks better without these messages.

[notice] A new release of pip available: 22.2.2 -> 22.3.1
[notice] To update, run: pip install --upgrade pip

Every package that is installed using pip will result in a message about an message that there is an update for pip available.

Fix:
add pip install --upgrade pip to the script. before pip install is called.

I had issues before with a package not installing, an update to setuptools fixed this for me. So maybe also add:
pip install --upgrade setuptools

Problem with libsqlite3

2022-03-05 10:06:07 ERROR (MainThread) [homeassistant.setup] Setup failed for recorder: Unable to import component: Error loading shared library libsqlite3.so.0: No such file or directory (needed by /usr/
2022-03-05 10:06:07 ERROR (MainThread) [homeassistant.setup] Setup failed for recorder: Unable to import component: Error loading shared library libsqlite3.so.0: No such file or directory (needed by /usr/
lib/python3.9/lib-dynload/_sqlite3.cpython-39.so)
2022-03-05 10:06:13 ERROR (MainThread) [homeassistant.setup] Setup failed for analytics: Unable to import component: Error loading shared library libsqlite3.so.0: No such file or directory (needed by /usr
/lib/python3.9/lib-dynload/_sqlite3.cpython-39.so)
2022-03-05 10:06:13 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of onboarding. Setup failed for dependencies: analytics
2022-03-05 10:06:13 ERROR (MainThread) [homeassistant.setup] Setup failed for onboarding: (DependencyError(...), 'Could not setup dependencies: analytics')
2022-03-05 10:06:13 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of frontend. Setup failed for dependencies: onboarding
2022-03-05 10:06:13 ERROR (MainThread) [homeassistant.setup] Setup failed for frontend: (DependencyError(...), 'Could not setup dependencies: onboarding')
2022-03-05 10:06:14 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of history. Setup failed for dependencies: recorder
2022-03-05 10:06:14 ERROR (MainThread) [homeassistant.setup] Setup failed for history: (DependencyError(...), 'Could not setup dependencies: recorder')
2022-03-05 10:06:14 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of logbook. Setup failed for dependencies: frontend, recorder
2022-03-05 10:06:14 ERROR (MainThread) [homeassistant.setup] Setup failed for logbook: (DependencyError(...), 'Could not setup dependencies: frontend, recorder')
2022-03-05 10:06:14 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of my. Setup failed for dependencies: frontend
2022-03-05 10:06:14 ERROR (MainThread) [homeassistant.setup] Setup failed for my: (DependencyError(...), 'Could not setup dependencies: frontend')
2022-03-05 10:06:14 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of map. Setup failed for dependencies: frontend
2022-03-05 10:06:14 ERROR (MainThread) [homeassistant.setup] Setup failed for map: (DependencyError(...), 'Could not setup dependencies: frontend')
2022-03-05 10:06:15 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of energy. Setup failed for dependencies: history, recorder
2022-03-05 10:06:15 ERROR (MainThread) [homeassistant.setup] Setup failed for energy: (DependencyError(...), 'Could not setup dependencies: history, recorder')
2022-03-05 10:06:20 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of default_config. Setup failed for dependencies: energy, frontend, history, logbook, map, my
2022-03-05 10:06:20 ERROR (MainThread) [homeassistant.setup] Setup failed for default_config: (DependencyError(...), 'Could not setup dependencies: energy, frontend, history, logbook, map, my')
2022-03-05 10:06:20 WARNING (MainThread) [homeassistant.bootstrap] Detected that frontend did not load. Activating safe mode
2022-03-05 10:06:20 WARNING (MainThread) [homeassistant.helpers.frame] Detected integration that called async_timeout.current_task. The current_task call is deprecated and calls will fail after Home Assis
tant 2022.3; use asyncio.current_task instead. Please report issue for ssdp using this method at homeassistant/components/ssdp/__init__.py, line 520: return await self._description_cache.async_get_descrip
tion_dict(location) or {}
2022-03-05 10:06:22 ERROR (MainThread) [homeassistant.setup] Setup failed for analytics: Unable to import component: Error loading shared library libsqlite3.so.0: No such file or directory (needed by /usr
/lib/python3.9/lib-dynload/_sqlite3.cpython-39.so)
2022-03-05 10:06:24 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of onboarding. Setup failed for dependencies: analytics
2022-03-05 10:06:24 ERROR (MainThread) [homeassistant.setup] Setup failed for onboarding: (DependencyError(...), 'Could not setup dependencies: analytics')
2022-03-05 10:06:24 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of frontend. Setup failed for dependencies: onboarding
2022-03-05 10:06:24 ERROR (MainThread) [homeassistant.setup] Setup failed for frontend: (DependencyError(...), 'Could not setup dependencies: onboarding')

Some issue with dependency, but lib files is present in the lib folder

root@OpenWrt:/tmp# ls /usr/lib/python3.9/lib-dynload
_asyncio.cpython-39.so            _ctypes_test.cpython-39.so        _multibytecodec.cpython-39.so     _ssl.cpython-39.so                mmap.cpython-39.so
_bisect.cpython-39.so             _curses.cpython-39.so             _multiprocessing.cpython-39.so    _statistics.cpython-39.so         ossaudiodev.cpython-39.so
_blake2.cpython-39.so             _curses_panel.cpython-39.so       _opcode.cpython-39.so             _struct.cpython-39.so             parser.cpython-39.so
_bz2.cpython-39.so                _datetime.cpython-39.so           _pickle.cpython-39.so             _uuid.cpython-39.so               pyexpat.cpython-39.so
_codecs_cn.cpython-39.so          _dbm.cpython-39.so                _posixshmem.cpython-39.so         _xxsubinterpreters.cpython-39.so  readline.cpython-39.so
_codecs_hk.cpython-39.so          _decimal.cpython-39.so            _posixsubprocess.cpython-39.so    _xxtestfuzz.cpython-39.so         resource.cpython-39.so
_codecs_iso2022.cpython-39.so     _elementtree.cpython-39.so        _queue.cpython-39.so              _zoneinfo.cpython-39.so           select.cpython-39.so
_codecs_jp.cpython-39.so          _gdbm.cpython-39.so               _random.cpython-39.so             array.cpython-39.so               spwd.cpython-39.so
_codecs_kr.cpython-39.so          _hashlib.cpython-39.so            _sha1.cpython-39.so               audioop.cpython-39.so             syslog.cpython-39.so
_codecs_tw.cpython-39.so          _heapq.cpython-39.so              _sha256.cpython-39.so             binascii.cpython-39.so            termios.cpython-39.so
_contextvars.cpython-39.so        _json.cpython-39.so               _sha3.cpython-39.so               cmath.cpython-39.so               unicodedata.cpython-39.so
_crypt.cpython-39.so              _lsprof.cpython-39.so             _sha512.cpython-39.so             fcntl.cpython-39.so               xxlimited.cpython-39.so
_csv.cpython-39.so                _lzma.cpython-39.so               _socket.cpython-39.so             grp.cpython-39.so
_ctypes.cpython-39.so             _md5.cpython-39.so                _sqlite3.cpython-39.so            math.cpython-39.so

Installation Script error

Have installed HA on openwrt before on the same device and it worked, but I had to reset it and reinstall HA,

However upon reinstall the script stops at
sed: /usr/lib/python3.9/site-packages/serial/tools/list_ports_linux.py: No such file or directory.
I have rerun the script several times and have rebooted the router. I would prefer to resolve this problem w/o resetting my device.

For referance it is NOT a Xiaomi Gateway, considering the command in question in the script is associated with it.

# show internal serial ports for Xiaomi Gateway sed -i 's/ttyXRUSB\*/ttymxc[1-9]/' /usr/lib/python${PYTHON_VERSION}/site-packages/serial/tools/list_ports_linux.py sed -i 's/if info.subsystem != "platform"]/]/' /usr/lib/python${PYTHON_VERSION}/site-packages/serial/tools/list_ports_linux.py

Cannot install package python3-greenlet

I'm getting the following error when running the ha_install.sh script:

opkg_install_cmd: Cannot install package python3-greenlet.

Here is a part of the log:

Package python3-email (3.7.13-1) installed in root is up to date.
Unknown package 'python3-greenlet'.
Package python3-idna (2.9-1) installed in root is up to date.
...
Configuring patch.
Collected errors:
 * opkg_install_cmd: Cannot install package python3-greenlet.

log.txt

Memory usage

Hi, I tried your script on a NETGEAR R7800 (Nighthawk X4S AC2600) with 128 MB / 512 MB memory. But the script failed after some time when trying to create dir /usr/bin/hass with out of memory. Do you have any info about the consumed size of the full installation of home assistant and where the memory is needed? Maybe its just about some megabytes I could possibly free up before the next try.

Setup failed for telegram_bot

Hi.
When I'm try to add telegram_bot in Home Assistant:

Logger: homeassistant.util.package
Source: util/package.py:98
First occurred: 19:06:55 (1 occurrences)
Last logged: 19:06:55

Unable to install package python-telegram-bot==13.1: ERROR: Command errored out with exit status 1: /usr/bin/python3 /usr/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-92p4tyow/overlay --no-warn-script-location -v --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.6.0' wheel 'cffi>=1.8,!=1.11.3; platform_python_implementation != '"'"'PyPy'"'"'' Check the logs for full command output. WARNING: You are using pip version 20.1.1; however, version 21.1.2 is available. You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.

error: subprocess-exited-with-error

[notice] A new release of pip available: 22.3.1 -> 23.0.1
[notice] To update, run: pip install --upgrade pip
Installing python-miio...
Processing /tmp/python-miio-0.5.12
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 2
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
Installing build dependencies ... error
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 2
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

[notice] A new release of pip available: 22.3.1 -> 23.0.1
[notice] To update, run: pip install --upgrade pip
root@OpenWrt:/# pip3 uninstall homeassistant
WARNING: Skipping homeassistant as it is not installed.
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

FULL LOGS: https://pastebin.com/ybGLhFEZ

gdbm install fail

error with running the sh file.
1,sum mismatch ,I have to install every python3-XXX.ipk with --force-check,
2,no package named python3-gdbm

Error on transport creation for incoming connection

Hello.
I have installed Homeassistant from branch 23.05 on my system:

Raspberry Pi 3 Model B Rev 1.2
OpenWrt 23.05.0 r23497-6637af95aa / LuCI openwrt-23.05 branch git-23.236.53405-fc638c8

The installation was performed on a clean system by running <ha_install.sh> without errors. Services homeassistant and hass-configurator are started properly after reboot and running. I can access hass-configurator locally on port 3218, but can't access homeassistant on port 8123.
Here is error part of homeassistant debug log:

2024-01-02 08:25:39.271 ERROR (MainThread) [homeassistant] Error doing job: Error on transport creation for incoming connection
Traceback (most recent call last):
File "/usr/lib/python3.11/asyncio/selector_events.py", line 208, in _accept_connection2
File "/usr/lib/python3.11/site-packages/aiohttp/web_server.py", line 62, in call
TypeError: RequestHandler.init() got an unexpected keyword argument 'handler_cancellation'

Beside that, I tried installation from branch 21.05 and it works.
Can you help, what could be wrong with 23.05?

"pip install numpy" fails because of Fortran

camera requires numpy. camera is required by mqtt. On top of that mqtt is required by tasmota.
"pip install numpy --no-cache-dir --force-reinstall --no-binary :all -v --log /root/numpy_inst2"
fails with

  INFO: unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
  running build_src
  INFO: build_src
  INFO: building py_modules sources
  creating build
  creating build/src.linux-mips-3.10
  creating build/src.linux-mips-3.10/numpy
  creating build/src.linux-mips-3.10/numpy/distutils
  INFO: building library "npymath" sources
  WARN: Could not locate executable armflang
  WARN: Could not locate executable gfortran
  WARN: Could not locate executable f95
  WARN: Could not locate executable ifort
  WARN: Could not locate executable ifc
  WARN: Could not locate executable lf95
  WARN: Could not locate executable pgfortran
  WARN: Could not locate executable nvfortran
  WARN: Could not locate executable f90
  WARN: Could not locate executable f77
  WARN: Could not locate executable fort
  WARN: Could not locate executable efort
  WARN: Could not locate executable efc
  WARN: Could not locate executable g77
  WARN: Could not locate executable g95
  WARN: Could not locate executable pathf95
  WARN: Could not locate executable nagfor
  WARN: Could not locate executable frt
  WARN: don't know how to compile Fortran code on platform 'posix'


  [Errno 2] No such file or directory: 'gcc'

Any ideas on how to get around this issue? Seems to be same regardless of version. Why is HA depending on Fortran anyway?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.