mirror of
https://github.com/YunoHost-Apps/homeassistant_ynh.git
synced 2024-09-03 19:26:16 +02:00
commit
d20e6f4a89
9 changed files with 139 additions and 28 deletions
|
@ -17,13 +17,13 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
|||
|
||||
Home automation platform
|
||||
|
||||
**Shipped version:** 2022.12.0~ynh1
|
||||
**Shipped version:** 2022.12.6~ynh1
|
||||
|
||||
**Demo:** https://demo.home-assistant.io
|
||||
|
||||
## Screenshots
|
||||
|
||||
![Screenshot of Home Assistant](./doc/screenshots/screenshot1)
|
||||
![Screenshot of Home Assistant](./doc/screenshots/screenshot1.png)
|
||||
|
||||
## Disclaimers / important information
|
||||
|
||||
|
|
|
@ -17,13 +17,13 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
|
|||
|
||||
Plateforme domotique
|
||||
|
||||
**Version incluse :** 2022.12.0~ynh1
|
||||
**Version incluse :** 2022.12.6~ynh1
|
||||
|
||||
**Démo :** https://demo.home-assistant.io
|
||||
|
||||
## Captures d'écran
|
||||
|
||||
![Capture d'écran de Home Assistant](./doc/screenshots/screenshot1)
|
||||
![Capture d'écran de Home Assistant](./doc/screenshots/screenshot1.png)
|
||||
|
||||
## Avertissements / informations importantes
|
||||
|
||||
|
|
|
@ -2,6 +2,14 @@
|
|||
; Manifest
|
||||
domain="domain.tld"
|
||||
is_public=1
|
||||
home="Home"
|
||||
latitude="32.87336"
|
||||
longitude="117.22743"
|
||||
elevation="430"
|
||||
unit_system="metric"
|
||||
currency="USD"
|
||||
country="US"
|
||||
time_zone="America/Los_Angeles"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=0
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
homeassistant:
|
||||
name: __HOME__
|
||||
latitude: __LATITUDE__
|
||||
longitude: __LONGITUDE__
|
||||
elevation: __ELEVATION__
|
||||
unit_system: __UNIT_SYSTEM__
|
||||
currency: __CURRENCY__
|
||||
country: __COUNTRY__
|
||||
time_zone: __TIME_ZONE__
|
||||
external_url: "https://__DOMAIN__"
|
||||
auth_providers:
|
||||
- type: command_line
|
||||
|
|
Before Width: | Height: | Size: 226 KiB After Width: | Height: | Size: 226 KiB |
|
@ -6,7 +6,7 @@
|
|||
"en": "Home automation platform",
|
||||
"fr": "Plateforme domotique"
|
||||
},
|
||||
"version": "2022.12.0~ynh1",
|
||||
"version": "2022.12.6~ynh1",
|
||||
"url": "https://github.com/home-assistant/home-assistant",
|
||||
"upstream": {
|
||||
"license": "Apache-2.0",
|
||||
|
@ -41,6 +41,71 @@
|
|||
"fr": "Dans le cas contraire, l'application sur Smartphone ne fonctionnera pas"
|
||||
},
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "home",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Name of the location where Home Assistant is running."
|
||||
},
|
||||
"default": "Home"
|
||||
},
|
||||
{
|
||||
"name": "latitude",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Latitude of your location required to calculate the time the sun rises and sets--> https://www.openstreetmap.org"
|
||||
},
|
||||
"default": 32.87336
|
||||
},
|
||||
{
|
||||
"name": "longitude",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Longitude of your location required to calculate the time the sun rises and sets --> https://www.openstreetmap.org"
|
||||
},
|
||||
"default": 117.22743
|
||||
},
|
||||
{
|
||||
"name": "elevation",
|
||||
"type": "number",
|
||||
"ask": {
|
||||
"en": "Altitude above sea level in meters. Impacts sunrise data."
|
||||
},
|
||||
"default": 430
|
||||
},
|
||||
{
|
||||
"name": "unit_system",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "metric for Metric, us_customary for US Customary. This also sets temperature_unit, Celsius for Metric and Fahrenheit for US Customary."
|
||||
},
|
||||
"choices": ["metric", "us_customary"],
|
||||
"default": "metric"
|
||||
},
|
||||
{
|
||||
"name": "currency",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Pick your currency code from the column Code of Wikipedia’s list of ISO 4217 active codes --> https://en.wikipedia.org/wiki/ISO_4217#Active_codes"
|
||||
},
|
||||
"default": "USD"
|
||||
},
|
||||
{
|
||||
"name": "country",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Country in which Home Assistant is running. This may, for example, influence radio settings to comply with local regulations. The country should be specified as an ISO 3166.1 alpha-2 code. Pick your country from the column Code of Wikipedia’s list of ISO 31661 alpha-2 officially assigned code --> https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements"
|
||||
},
|
||||
"default": "US"
|
||||
},
|
||||
{
|
||||
"name": "time_zone",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Pick your time zone from the column TZ of Wikipedia’s list of tz database time zones --> https://en.wikipedia.org/wiki/List_of_tz_database_time_zones"
|
||||
},
|
||||
"default": "America/Los_Angeles"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#=================================================
|
||||
|
||||
# Release to install
|
||||
app_version=2022.12.0
|
||||
app_version=2022.12.6
|
||||
|
||||
# Package dependencies
|
||||
pkg_dependencies="python3 python3-dev python3-venv python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libopenjp2-7 libtiff5 libturbojpeg0 libmariadb-dev libmariadb-dev-compat rustc"
|
||||
|
@ -13,7 +13,7 @@ pkg_dependencies="python3 python3-dev python3-venv python3-pip libffi-dev libssl
|
|||
# Requirements (Major.Minor.Patch)
|
||||
# PY_VERSION=$(curl -s "https://www.python.org/ftp/python/" | grep ">3.9" | tail -n1 | cut -d '/' -f 2 | cut -d '>' -f 2)
|
||||
# Pyhton 3.9.2 will be shiped with bullseye
|
||||
py_required_version=3.9.2
|
||||
py_required_version=3.10.9
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
|
@ -74,10 +74,13 @@ myynh_install_python () {
|
|||
# Check python version from APT
|
||||
local py_apt_version=$(python3 --version | cut -d ' ' -f 2)
|
||||
|
||||
# Usefull variables
|
||||
local python_major=${python%.*}
|
||||
|
||||
# Check existing built version of python in /usr/local/bin
|
||||
if [ -e "/usr/local/bin/python${python:0:3}" ]
|
||||
if [ -e "/usr/local/bin/python$python_major" ]
|
||||
then
|
||||
local py_built_version=$(/usr/local/bin/python${python:0:3} --version \
|
||||
local py_built_version=$(/usr/local/bin/python$python_major --version \
|
||||
| cut -d ' ' -f 2)
|
||||
else
|
||||
local py_built_version=0
|
||||
|
@ -98,12 +101,12 @@ myynh_install_python () {
|
|||
# Built >= Required
|
||||
ynh_print_info --message="Using already used python3 built version..."
|
||||
|
||||
py_app_version="/usr/local/bin/python${py_built_version:0:3}"
|
||||
py_app_version="/usr/local/bin/python${py_built_version%.*}"
|
||||
|
||||
else
|
||||
ynh_print_info --message="Installing additional dependencies to build python..."
|
||||
|
||||
pkg_dependencies="${pkg_dependencies} tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libbz2-dev libexpat1-dev liblzma-dev wget tar"
|
||||
pkg_dependencies="${pkg_dependencies} tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libbz2-dev libexpat1-dev liblzma-dev wget tar libnss3-dev libreadline-dev"
|
||||
ynh_install_app_dependencies "${pkg_dependencies}"
|
||||
|
||||
# APT < Minimal & Actual < Minimal => Build & install Python into /usr/local/bin
|
||||
|
@ -136,7 +139,7 @@ myynh_install_python () {
|
|||
ynh_secure_remove "$tmpdir"
|
||||
|
||||
# Set version
|
||||
py_app_version="/usr/local/bin/python${python:0:3}"
|
||||
py_app_version="/usr/local/bin/python$python_major"
|
||||
fi
|
||||
fi
|
||||
# Save python version in settings
|
||||
|
@ -145,26 +148,33 @@ myynh_install_python () {
|
|||
|
||||
# Install/Upgrade Homeassistant in virtual environement
|
||||
myynh_install_homeassistant () {
|
||||
ynh_exec_as $app -H -s /bin/bash -c " \
|
||||
echo 'create the virtual environment' \
|
||||
&& $py_app_version -m venv "$final_path" \
|
||||
&& echo 'activate the virtual environment' \
|
||||
&& source "$final_path/bin/activate" \
|
||||
&& echo 'install last version of wheel' \
|
||||
&& pip --cache-dir "$data_path/.cache" install --upgrade wheel \
|
||||
&& echo 'install last version of mysqlclient' \
|
||||
&& pip --cache-dir "$data_path/.cache" install --upgrade mysqlclient \
|
||||
&& echo 'install Home Assistant' \
|
||||
&& pip --cache-dir "$data_path/.cache" install --upgrade $app==$app_version \
|
||||
"
|
||||
# Create the virtual environment
|
||||
ynh_exec_as $app $py_app_version -m venv --without-pip "$final_path"
|
||||
|
||||
# Run source in a 'sub shell'
|
||||
(
|
||||
# activate the virtual environment
|
||||
set +o nounset
|
||||
source "$final_path/bin/activate"
|
||||
set -o nounset
|
||||
|
||||
# add pip
|
||||
ynh_exec_as $app "$final_path/bin/python3" -m ensurepip
|
||||
|
||||
# install last version of wheel
|
||||
ynh_exec_as $app "$final_path/bin/pip3" --cache-dir "$data_path/.cache" install --upgrade wheel
|
||||
|
||||
# install last version of mysqlclient
|
||||
ynh_exec_as $app "$final_path/bin/pip3" --cache-dir "$data_path/.cache" install --upgrade mysqlclient
|
||||
|
||||
# install Home Assistant
|
||||
ynh_exec_as $app "$final_path/bin/pip3" --cache-dir "$data_path/.cache" install --upgrade $app==$app_version
|
||||
)
|
||||
}
|
||||
|
||||
# Upgrade the virtual environment directory
|
||||
myynh_upgrade_venv_directory () {
|
||||
ynh_exec_as $app -H -s /bin/bash -c " \
|
||||
echo 'Upgrade the virtual environment directory' \
|
||||
&& $py_app_version -m venv --upgrade "$final_path" \
|
||||
"
|
||||
ynh_exec_as $app $py_app_version -m venv --upgrade "$final_path"
|
||||
}
|
||||
|
||||
# Set permissions
|
||||
|
|
|
@ -26,6 +26,14 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
home=$YNH_APP_ARG_HOME
|
||||
latitude=$YNH_APP_ARG_LATITUDE
|
||||
longitude=$YNH_APP_ARG_LONGITUDE
|
||||
elevation=$YNH_APP_ARG_ELEVATION
|
||||
unit_system=$YNH_APP_ARG_UNIT_SYSTEM
|
||||
currency=$YNH_APP_ARG_CURRENCY
|
||||
country=$YNH_APP_ARG_COUNTRY
|
||||
time_zone=$YNH_APP_ARG_TIME_ZONE
|
||||
|
||||
#=================================================
|
||||
# DEFINE USEFULL VARS
|
||||
|
@ -184,6 +192,8 @@ ynh_systemd_action --service_name=$app --action=restart
|
|||
ynh_script_progression --message="Configuring permissions..."
|
||||
|
||||
[ $is_public -eq 1 ] && ynh_permission_update --permission="main" --add="visitors"
|
||||
# Allow the web UI to use its own API without Yunohost/SSOWat interfering with it. Home Assistant authentication should still be in effect.
|
||||
ynh_permission_create --permission="api" --label="api" --url="/api" --allowed="visitors" "all_users" --auth_header="false" --show_tile="false" --protected="true"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
|
@ -31,6 +31,16 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
|
||||
# Create a permission if needed
|
||||
if ! ynh_permission_exists --permission="api"; then
|
||||
ynh_permission_create --permission="api" --label="api" --url="/api" --allowed="visitors" "all_users" --auth_header="false" --show_tile="false" --protected="true"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue