diff --git a/.gitignore b/.gitignore index 90f7a1d..cef67f6 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,4 @@ node_modules /groups.yaml /configuration.yaml /home-assistant_v2.db - +/secrets.yaml diff --git a/.storage/auth b/.storage/auth index 63e2fd0..08008f9 100644 --- a/.storage/auth +++ b/.storage/auth @@ -57,7 +57,7 @@ "created_at": "2019-05-28T15:36:44.634951+00:00", "id": "952866338b694f5b806eb4cdb8fd19f4", "jwt_key": "fb1989218b2d6690fc17636866615d04f53352c179ded55cfc4d7d509c1c8354b17088f51a016b14e9b851a6faae274bf0f83fb7049bd0707c435f23113f3316", - "last_used_at": "2019-06-30T18:30:19.144896+00:00", + "last_used_at": "2019-06-30T19:59:11.266552+00:00", "last_used_ip": "192.168.178.71", "token": "5f7f4f3e8063e4e74570095749ec752bc1b74b26f6e4c20d0fe219753339e9d5ac44e2582d02257a9e2dc9116a79f668350bbad81dabd21ff52b08a109a2f5d8", "token_type": "normal", diff --git a/.storage/core.restore_state b/.storage/core.restore_state index 3d2f7c5..95527e0 100644 --- a/.storage/core.restore_state +++ b/.storage/core.restore_state @@ -1,7 +1,7 @@ { "data": [ { - "last_seen": "2019-06-30T19:44:11.001489+00:00", + "last_seen": "2019-06-30T20:14:56.454572+00:00", "state": { "attributes": { "editable": true, diff --git a/config_creation/main.py b/config_creation/main.py index 3e66761..9923042 100644 --- a/config_creation/main.py +++ b/config_creation/main.py @@ -1,4 +1,5 @@ import os +import argparse from util import DeviceInfo, add_to_group from ruamel.yaml import YAML import knx_conf as knx @@ -113,7 +114,7 @@ def add_light_groups(groups): groups.update(light_groups) -def create_config(target_directory): +def create_config(target_directory, development=False): groups_yaml_path = os.path.join(script_path, 'groups.yaml') manual_config_path = os.path.join(script_path, 'manual_config.yaml') group_dict = yaml.load(open(groups_yaml_path)) @@ -132,6 +133,16 @@ def create_config(target_directory): output.write("# Dont' edit manually! this is generated!\n\n") yaml.dump(group_dict, output) + with open(os.path.join(target_directory, 'secrets.yaml'), 'w') as output: + output.write("# Dont' edit manually! this is generated!\n\n") + output.write(open(os.path.join(script_path, 'secrets.yaml'), 'r').read()) + output.write("\n\n") + additional_file = 'secrets_development.yaml' if development else 'secrets_deploy.yaml' + output.write(open(os.path.join(script_path, additional_file), 'r').read()) + if __name__ == '__main__': - create_config(target_directory=os.getcwd()) + parser = argparse.ArgumentParser() + parser.add_argument("-d", "--dev", help="create config file for development", action="store_true") + args = parser.parse_args() + create_config(target_directory=os.getcwd(), development=args.dev) diff --git a/config_creation/manual_config.yaml b/config_creation/manual_config.yaml index dfccd62..f87a008 100644 --- a/config_creation/manual_config.yaml +++ b/config_creation/manual_config.yaml @@ -54,19 +54,20 @@ cover_half: tts: - platform: watson_tts - watson_apikey: X_tnnoaZGOwxZlqUn07wkD2G-0vaaAuOw6I6d_6jpCf7 + watson_apikey: !secret watson_api_key watson_url: https://gateway-lon.watsonplatform.net/text-to-speech/api voice: de-DE_BirgitVoice output_format: audio/flac output_audio_rate: 44100 + knx: rate_limit: 20 tunneling: - host: server # knxd to work together with old home automation server - #host: 192.168.178.65 # network bridge + host: !secret knxd_host port: 3671 - local_ip: 192.168.178.76 + local_ip: !secret local_ip + fhem: host: server @@ -91,7 +92,7 @@ media_player: vacuum: - platform: xiaomi_miio host: rockrobo - token: 515a69497537766d4f7a38756b4b654d + token: !secret local_ip group: !include groups.yaml diff --git a/config_creation/secrets.yaml b/config_creation/secrets.yaml new file mode 100644 index 0000000..006b434 --- /dev/null +++ b/config_creation/secrets.yaml @@ -0,0 +1,3 @@ +vacuum_token: 515a69497537766d4f7a38756b4b654d +watson_api_key: X_tnnoaZGOwxZlqUn07wkD2G-0vaaAuOw6I6d_6jpCf7 +knxd_host: server #directly the network bridge: 192.168.178.65 diff --git a/config_creation/secrets_deploy.yaml b/config_creation/secrets_deploy.yaml new file mode 100644 index 0000000..fab8429 --- /dev/null +++ b/config_creation/secrets_deploy.yaml @@ -0,0 +1 @@ +local_ip: 192.168.178.80 diff --git a/config_creation/secrets_development.yaml b/config_creation/secrets_development.yaml new file mode 100644 index 0000000..1057988 --- /dev/null +++ b/config_creation/secrets_development.yaml @@ -0,0 +1 @@ +local_ip: 192.168.178.76 diff --git a/run.sh b/run.sh deleted file mode 100644 index 1d00c0a..0000000 --- a/run.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -./make_config.sh -./make_custom_frontend.sh - -python -m homeassistant --config /config \ No newline at end of file diff --git a/run_on_server.sh b/run_on_server.sh new file mode 100644 index 0000000..2fa6f1f --- /dev/null +++ b/run_on_server.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +./make_config.sh server +./make_custom_frontend.sh + +python -m homeassistant --config /config \ No newline at end of file diff --git a/secrets.yaml b/secrets.yaml deleted file mode 100644 index e69de29..0000000