Bug 256885 - [NEW PORT] www/py-homeassistant: Open-source home automation platform
Summary: [NEW PORT] www/py-homeassistant: Open-source home automation platform
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ports-bugs (Nobody)
Keywords: feature, needs-qa
Depends on: 252072 252073 252078 252081 256883 256884
  Show dependency treegraph
Reported: 2021-06-29 12:43 UTC by Ivan Rozhuk
Modified: 2021-07-31 09:52 UTC (History)
4 users (show)

See Also:
koobs: maintainer-feedback? (rozhuk.im)

patch (19.67 KB, patch)
2021-06-29 12:43 UTC, Ivan Rozhuk
no flags Details | Diff
patch (17.92 KB, patch)
2021-07-01 04:36 UTC, Ivan Rozhuk
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Rozhuk 2021-06-29 12:43:56 UTC
Created attachment 226109 [details]

Open source home automation that puts local control and privacy first.
Powered by a worldwide community of tinkerers and DIY enthusiasts.
Perfect to run on a Raspberry Pi or a local server.

WWW: https://www.home-assistant.io/

patch contains also few dep ports
Comment 1 Ivan Rozhuk 2021-06-29 12:46:45 UTC
This port uses Virtual Environment and will download and install via pip all required python packets.
Comment 2 Guangyuan Yang freebsd_committer 2021-06-29 20:25:38 UTC
A quick review:

- # $FreeBSD$ is deprecated and no longer needed.
- Please rewrite some of the pkg-descr files as per porters-handbook [1], which states "the content of pkg-descr must be longer than the COMMENT line from the Makefile. It must explain in more depth what the port is all about."
- USES=python:3.{5,6}+ can be rewritten as USES=python

[1]: https://docs.freebsd.org/en/books/porters-handbook/quick-porting/#porting-desc

Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2021-06-30 00:08:32 UTC
@Reporter Can you detail how this works with respect to standard modes of port installation and dependencies, the virtualenv process and behaviour, particularly with respect to dependency versions as they get updated by pip over time, versus whats installed by ports/pkg.
Comment 4 Chris Hutchinson 2021-06-30 00:22:27 UTC
Thanks for creating this port!
I'd like to make a request;

Given that this is a new port proposal. Can this pr's title be prefaced as such?

[NEW PORT] www/py-homeassistant: Open-source home automation platform running on Python 3

or just

[NEW PORT] www/py-homeassistant: Open-source home automation platform running on Python

as Python 2 is no longer available. :-)
Comment 5 Ivan Rozhuk 2021-06-30 01:12:11 UTC
(In reply to Kubilay Kocak from comment #3)

This port (py-homeassistant only) does not respect FreeBSD ports deps, I suppose.

First attempt was to make standard port that installs all deps during installation from ports tree.
I success with this, but HA is useless/unsupportable in this mode: it starts and you can configure it. But then you try to add some integration - HA report that you have missed deps. (There is an app argument to disable pip auto installer)
There is 1800 "integrations" (plugins): https://www.home-assistant.io/integrations/ this mean that complete port will all features will require to install more than 2000 ports. We have no most of these ports in ports tree.
And I can not do this work.

In current state port installs all requirements to allow it to bootstrap.
And some ports that auto loaded at bootstrap by pip.
I'am force to downgrade some pip packets versions to use python packets from system.
Probably better will be remove all additional ports and let pip install it.

As far as I understand HA install via pip all packets that missed or version mismatch.
Original HA deps mostly have fixed versions (== x.y.z), and I replace it to >= for some ports from ports tree.

Bootstrap is in homeassistant_precmd().
Without this HA will require more ports to start first time and produce some errors at first 1-2 attempt to start.

First port version was done in time of python 3.7.
After update python to 3.8 and reinstall HA it bootstrap and download all 3.8 pip packets into /var/db/homeassistant/deps/lib/python3.8/site-packages.
I remove by hands /var/db/homeassistant/deps/lib/python3.7 to clean up space.

Current port state: it is installs and work, but have some non critical issues:
1. on info page /config/info it does not show that it is Virtual Environment
2. chromium does not work with web ui, some error in script
3. ff some times glitches in web ui, refresh page fix this
Probably all these issues may be fixed if more ports will have version that HA requires instead of that I force to use from ports tree.

I run it few days and have few integrations: IPP, MQTT+tasmota (mosquitto, 1 device: ESP8266+BME680), mobile app (4 devices), weather - all works fine.
"recorder" configured to use mariadb (db_url: mysql+pymysql://...).
Comment 6 Ivan Rozhuk 2021-07-01 04:36:45 UTC
Created attachment 226148 [details]
Comment 7 Guangyuan Yang freebsd_committer 2021-07-31 09:52:40 UTC
Currently don't have the capacity to test this - back to pool.