Used secrets file to distinguish development vs. deployment
This commit is contained in:
		
							parent
							
								
									28e3b77c15
								
							
						
					
					
						commit
						383973c255
					
				| 
						 | 
					@ -8,4 +8,4 @@ node_modules
 | 
				
			||||||
/groups.yaml
 | 
					/groups.yaml
 | 
				
			||||||
/configuration.yaml
 | 
					/configuration.yaml
 | 
				
			||||||
/home-assistant_v2.db
 | 
					/home-assistant_v2.db
 | 
				
			||||||
 | 
					/secrets.yaml
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -57,7 +57,7 @@
 | 
				
			||||||
                "created_at": "2019-05-28T15:36:44.634951+00:00",
 | 
					                "created_at": "2019-05-28T15:36:44.634951+00:00",
 | 
				
			||||||
                "id": "952866338b694f5b806eb4cdb8fd19f4",
 | 
					                "id": "952866338b694f5b806eb4cdb8fd19f4",
 | 
				
			||||||
                "jwt_key": "fb1989218b2d6690fc17636866615d04f53352c179ded55cfc4d7d509c1c8354b17088f51a016b14e9b851a6faae274bf0f83fb7049bd0707c435f23113f3316",
 | 
					                "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",
 | 
					                "last_used_ip": "192.168.178.71",
 | 
				
			||||||
                "token": "5f7f4f3e8063e4e74570095749ec752bc1b74b26f6e4c20d0fe219753339e9d5ac44e2582d02257a9e2dc9116a79f668350bbad81dabd21ff52b08a109a2f5d8",
 | 
					                "token": "5f7f4f3e8063e4e74570095749ec752bc1b74b26f6e4c20d0fe219753339e9d5ac44e2582d02257a9e2dc9116a79f668350bbad81dabd21ff52b08a109a2f5d8",
 | 
				
			||||||
                "token_type": "normal",
 | 
					                "token_type": "normal",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    "data": [
 | 
					    "data": [
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            "last_seen": "2019-06-30T19:44:11.001489+00:00",
 | 
					            "last_seen": "2019-06-30T20:14:56.454572+00:00",
 | 
				
			||||||
            "state": {
 | 
					            "state": {
 | 
				
			||||||
                "attributes": {
 | 
					                "attributes": {
 | 
				
			||||||
                    "editable": true,
 | 
					                    "editable": true,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,5 @@
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
 | 
					import argparse
 | 
				
			||||||
from util import DeviceInfo, add_to_group
 | 
					from util import DeviceInfo, add_to_group
 | 
				
			||||||
from ruamel.yaml import YAML
 | 
					from ruamel.yaml import YAML
 | 
				
			||||||
import knx_conf as knx
 | 
					import knx_conf as knx
 | 
				
			||||||
| 
						 | 
					@ -113,7 +114,7 @@ def add_light_groups(groups):
 | 
				
			||||||
    groups.update(light_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')
 | 
					    groups_yaml_path = os.path.join(script_path, 'groups.yaml')
 | 
				
			||||||
    manual_config_path = os.path.join(script_path, 'manual_config.yaml')
 | 
					    manual_config_path = os.path.join(script_path, 'manual_config.yaml')
 | 
				
			||||||
    group_dict = yaml.load(open(groups_yaml_path))
 | 
					    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")
 | 
					        output.write("# Dont' edit manually! this is generated!\n\n")
 | 
				
			||||||
        yaml.dump(group_dict, output)
 | 
					        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__':
 | 
					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)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,19 +54,20 @@ cover_half:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tts:
 | 
					tts:
 | 
				
			||||||
  - platform: watson_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
 | 
					    watson_url: https://gateway-lon.watsonplatform.net/text-to-speech/api
 | 
				
			||||||
    voice: de-DE_BirgitVoice
 | 
					    voice: de-DE_BirgitVoice
 | 
				
			||||||
    output_format: audio/flac
 | 
					    output_format: audio/flac
 | 
				
			||||||
    output_audio_rate: 44100
 | 
					    output_audio_rate: 44100
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
knx:
 | 
					knx:
 | 
				
			||||||
  rate_limit: 20
 | 
					  rate_limit: 20
 | 
				
			||||||
  tunneling:
 | 
					  tunneling:
 | 
				
			||||||
    host: server  # knxd to work together with old home automation server
 | 
					    host: !secret knxd_host
 | 
				
			||||||
    #host: 192.168.178.65 # network bridge
 | 
					 | 
				
			||||||
    port: 3671
 | 
					    port: 3671
 | 
				
			||||||
    local_ip: 192.168.178.76
 | 
					    local_ip: !secret local_ip
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fhem:
 | 
					fhem:
 | 
				
			||||||
  host: server
 | 
					  host: server
 | 
				
			||||||
| 
						 | 
					@ -91,7 +92,7 @@ media_player:
 | 
				
			||||||
vacuum:
 | 
					vacuum:
 | 
				
			||||||
  - platform: xiaomi_miio
 | 
					  - platform: xiaomi_miio
 | 
				
			||||||
    host: rockrobo
 | 
					    host: rockrobo
 | 
				
			||||||
    token: 515a69497537766d4f7a38756b4b654d
 | 
					    token: !secret local_ip
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
group: !include groups.yaml
 | 
					group: !include groups.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
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					local_ip: 192.168.178.80
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					local_ip: 192.168.178.76
 | 
				
			||||||
							
								
								
									
										6
									
								
								run.sh
								
								
								
								
							
							
						
						
									
										6
									
								
								run.sh
								
								
								
								
							| 
						 | 
					@ -1,6 +0,0 @@
 | 
				
			||||||
#!/bin/bash
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
./make_config.sh
 | 
					 | 
				
			||||||
./make_custom_frontend.sh
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
python -m homeassistant --config /config
 | 
					 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,6 @@
 | 
				
			||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					./make_config.sh server
 | 
				
			||||||
 | 
					./make_custom_frontend.sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					python -m homeassistant --config /config
 | 
				
			||||||
		Loading…
	
		Reference in New Issue