2019-03-17 20:41:07 +01:00
|
|
|
#!/usr/bin/with-contenv bashio
|
2019-01-02 12:21:26 +01:00
|
|
|
# ==============================================================================
|
2019-02-13 16:54:02 +01:00
|
|
|
# Community Hass.io Add-ons: ESPHome
|
|
|
|
# This files installs the user ESPHome version if specified
|
2019-01-02 12:21:26 +01:00
|
|
|
# ==============================================================================
|
|
|
|
|
2019-02-13 16:54:02 +01:00
|
|
|
declare esphome_version
|
2019-01-02 12:21:26 +01:00
|
|
|
|
2019-03-17 20:41:07 +01:00
|
|
|
if bashio::config.has_value 'esphome_version'; then
|
|
|
|
esphome_version=$(bashio::config 'esphome_version')
|
2019-12-05 12:01:12 +01:00
|
|
|
if [[ $esphome_version == *":"* ]]; then
|
|
|
|
IFS=':' read -r -a array <<< "$esphome_version"
|
|
|
|
username=${array[0]}
|
|
|
|
ref=${array[1]}
|
|
|
|
else
|
|
|
|
username="esphome"
|
|
|
|
ref=$esphome_version
|
|
|
|
fi
|
|
|
|
full_url="https://github.com/${username}/esphome/archive/${ref}.zip"
|
2019-03-17 20:41:07 +01:00
|
|
|
bashio::log.info "Installing esphome version '${esphome_version}' (${full_url})..."
|
2019-10-19 16:31:03 +02:00
|
|
|
pip3 install -U --no-cache-dir "${full_url}" \
|
2019-03-17 20:41:07 +01:00
|
|
|
|| bashio::exit.nok "Failed installing esphome pinned version."
|
2019-01-02 16:34:38 +01:00
|
|
|
fi
|