mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-17 21:24:20 +01:00
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:
committed by
Pascal Vizeli
parent
d93eec0e66
commit
4e01f98a5b
25
configurator/map.py
Normal file
25
configurator/map.py
Normal 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))
|
||||
Reference in New Issue
Block a user