Add HASS configurator to core add-ons (#180)

* Initial commit for HASS configurator

* Requested changes

* Update Dockerfile

* update mechanics like other core add-ons

* simplify

* Update config.json

* Update config.json

* Update Dockerfile

* Delete configurator.py

* Create run.sh

* Create map.py

* Update and rename hass-configurator/config.json to configurator/config.json

* Rename hass-configurator/Dockerfile to configurator/Dockerfile

* Update and rename hass-configurator/map.py to configurator/map.py

* Rename hass-configurator/run.sh to configurator/run.sh

* Update map.py

* add image for build

* Update Dockerfile
This commit is contained in:
Daniel Perna
2017-09-26 11:54:31 +02:00
committed by Pascal Vizeli
parent d93eec0e66
commit 4e01f98a5b
4 changed files with 90 additions and 0 deletions

25
configurator/map.py Normal file
View File

@@ -0,0 +1,25 @@
"""Mapping hass.io options.json into configurator config."""
import json
from pathlib import Path
import sys
hassio_options = Path("/data/options.json")
# Read hass.io options
with hassio_options.open('r') as json_file:
options = json.loads(json_file.read())
configurator = {
'BASEPATH': "/config",
'HASS_API': options['homeassistant_api'],
'HASS_API_PASSWORD': options['homeassistant_password'],
'CREDENTIALS': options['credentials'],
'SSL_CERTIFICATE': options['certfile'] if options['ssl'] else None,
'SSL_KEY': options['keyfile'] if options['ssl'] else None,
'ALLOWED_NETWORKS': options['allowed_networks'],
'BANNED_IPS': options['banned_ips'],
'IGNORE_PATTERN': options['ignore_pattern'],
}
with Path(sys.argv[1]).open('w') as json_file:
json_file.write(json.dumps(configurator))