Big restructuring - repo is now a full home assistant config directory

This commit is contained in:
Martin Bauer
2019-06-30 19:37:32 +02:00
parent d35b9e132e
commit 808727ad92
79 changed files with 14378 additions and 27 deletions

View File

@@ -1,8 +1,9 @@
import os
from util import DeviceInfo, add_to_group
from ruamel.yaml import YAML
import knx_conf as knx
script_path = os.path.dirname(os.path.realpath(__file__))
yaml = YAML()
@@ -74,8 +75,8 @@ def add_knx_devices(devices, groups):
DeviceInfo("WohnzimmerSteckdose2", "Wohnzimmer Steckdose 2", 'living_area'),
]
imported_csv = knx.import_ets5_csv_file('knx_data/export_project1.csv')
imported_csv.update(knx.import_ets5_csv_file('knx_data/export_project2.csv'))
imported_csv = knx.import_ets5_csv_file(os.path.join(script_path, 'knx_data/export_project1.csv'))
imported_csv.update(knx.import_ets5_csv_file(os.path.join(script_path, 'knx_data/export_project2.csv')))
knx.extent(devices, knx.create_lights(lights, imported_csv))
knx.extent(devices, knx.create_shutters(shutters, imported_csv))
@@ -88,7 +89,8 @@ def add_knx_devices(devices, groups):
def add_fhem_devices(devices, groups):
fhem_yaml = yaml.load(open('fhem.yaml'))
fhem_yaml_path = os.path.join(script_path, 'fhem.yaml')
fhem_yaml = yaml.load(open(fhem_yaml_path))
for device_type, device_list in fhem_yaml.items():
if device_type not in devices:
devices[device_type] = []
@@ -111,19 +113,25 @@ def add_light_groups(groups):
groups.update(light_groups)
def main():
group_dict = yaml.load(open('groups.yaml'))
def create_config(target_directory):
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))
all_devices = {}
add_knx_devices(all_devices, group_dict)
add_fhem_devices(all_devices, group_dict)
with open('output/configuration.yaml', 'w') as output:
output.write(open('manual_config.yaml', 'r').read())
with open(os.path.join(target_directory, 'configuration.yaml'), 'w') as output:
output.write("# Dont' edit manually! this is generated!\n\n")
output.write(open(manual_config_path, 'r').read())
yaml.dump(all_devices, output)
add_light_groups(group_dict)
yaml.dump(group_dict, open('output/groups.yaml', 'w'))
with open(os.path.join(target_directory, 'groups.yaml'), 'w') as output:
output.write("# Dont' edit manually! this is generated!\n\n")
yaml.dump(group_dict, output)
if __name__ == '__main__':
main()
create_config(target_directory=os.getcwd())

View File

@@ -86,6 +86,12 @@ media_player:
host: avreceiver
vacuum:
- platform: xiaomi_miio
host: rockrobo
token: 515a69497537766d4f7a38756b4b654d
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

View File

@@ -1,368 +0,0 @@
# -------------------- Martin Arbeitszimmer ---------------------------------
- name: Arbeitszimmer Martin Orange
entities:
light.arbeitszimmer_martin_deckenlampe:
state: off
light.arbeitszimmer_martin:
state: on
brightness: 229
color_temp: 484
light.arbeitszimmer_martin_oben:
state: on
brightness: 216
xy_color: [0.569, 0.397]
light.arbeitszimmer_martin_unten:
state: on
brightness: 214
xy_color: [0.2, 0.102]
- name: Arbeitszimmer Martin Blau Grün
entities:
light.arbeitszimmer_martin_deckenlampe:
state: off
light.arbeitszimmer_martin:
state: on
brightness: 173
xy_color: [0.429, 0.483]
light.arbeitszimmer_martin_oben:
state: on
brightness: 186
xy_color: [0.565,0.398]
light.arbeitszimmer_martin_unten:
state: on
brightness: 247
xy_color: [0.219,0.137]
- name: Arbeitszimmer Martin Hell
entities:
light.arbeitszimmer_martin_deckenlampe:
state: on
brightness: 252
light.arbeitszimmer_martin:
state: on
brightness: 252
xy_color: [0.429, 0.483]
light.arbeitszimmer_martin_oben:
state: on
brightness: 247
xy_color: [0.44, 0.485]
light.arbeitszimmer_martin_unten:
state: on
brightness: 249
xy_color: [0.219, 0.137]
# -------------------- Wohnbereich -----------------------------------------
- name: Wohnbereich Orange
entities:
light.kuche_deckenlampe:
state: on
brightness: 38
light.wohnzimmer_deckenlampe:
state: on
brightness: 38
light.esszimmer_deckenlampe_west:
state: on
brightness: 38
light.esszimmer_deckenlampe_mitte:
state: on
brightness: 38
light.esszimmer_schrankleuchte:
state: off
light.kuche_links:
state: on
brightness: 153
xy_color: [0.54, 0.435]
light.kuche_rechts:
state: on
brightness: 242
xy_color: [0.557, 0.396]
light.kuche_vorne:
state: on
color_temp: 477
brightness: 114
light.wohnzimmer_kugel:
state: on
brightness: 229
color_temp: 492
light.wohnzimmer_stehlampe:
state: on
brightness: 191
color_temp: 428
light.wohnzimmer_stehlampe_oben:
state: on
brightness: 127
color_temp: 492
light.wohnzimmer_regal_rechts:
state: on
brightness: 191
xy_color: [0.618, 0.366]
light.wohnzimmer_regal_links:
state: on
brightness: 191
xy_color: [0.53, 0.443]
- name: Wohnbereich Blau Grün
entities:
light.kuche_deckenlampe:
state: on
brightness: 38
light.wohnzimmer_deckenlampe:
state: on
brightness: 51
light.esszimmer_deckenlampe_west:
state: on
brightness: 38
light.esszimmer_deckenlampe_mitte:
state: on
brightness: 38
light.esszimmer_schrankleuchte:
state: off
light.kuche_links:
state: on
brightness: 198
xy_color: [0.156, 0.218]
light.kuche_rechts:
state: on
brightness: 252
xy_color: [0.171, 0.353]
light.kuche_vorne:
state: on
brightness: 130
xy_color: [0.158, 0.053]
light.wohnzimmer_kugel:
state: on
brightness: 252
xy_color: [0.46, 0.408]
light.wohnzimmer_stehlampe:
state: on
brightness: 153
xy_color: [0.183, 0.062]
light.wohnzimmer_stehlampe_oben:
state: on
brightness: 150
xy_color: [0.184, 0.068]
light.wohnzimmer_regal_rechts:
state: on
brightness: 252
xy_color: [0.143, 0.113]
light.wohnzimmer_regal_links:
state: on
brightness: 252
xy_color: [0.222, 0.636]
- name: Wohnbereich Grün
entities:
light.kuche_deckenlampe:
state: off
light.wohnzimmer_deckenlampe:
state: off
light.esszimmer_deckenlampe_west:
state: off
light.esszimmer_deckenlampe_mitte:
state: off
light.esszimmer_schrankleuchte:
state: off
light.kuche_links:
state: on
brightness: 198
xy_color: [0.4038, 0.555]
light.kuche_rechts:
state: on
brightness: 252
xy_color: [0.4771, 0.4957]
light.kuche_vorne:
state: on
brightness: 130
xy_color: [0.1987, 0.5792]
light.wohnzimmer_kugel:
state: on
brightness: 252
xy_color: [0.4084, 0.5168]
light.wohnzimmer_stehlampe:
state: on
brightness: 153
xy_color: [0.4084, 0.5168]
light.wohnzimmer_stehlampe_oben:
state: on
brightness: 150
xy_color: [0.40, 0.53]
light.wohnzimmer_regal_rechts:
state: on
brightness: 252
xy_color: [0.1635, 0.3502]
light.wohnzimmer_regal_links:
state: on
brightness: 252
xy_color: [0.2075, 0.6584]
- name: Wohnbereich Meditation
entities:
light.kuche_deckenlampe:
state: off
light.wohnzimmer_deckenlampe:
state: off
light.esszimmer_deckenlampe_west:
state: off
light.esszimmer_deckenlampe_mitte:
state: off
light.esszimmer_schrankleuchte:
state: off
light.kuche_links:
state: on
brightness: 255
xy_color: [0.5428, 0.3887]
light.kuche_rechts:
state: on
brightness: 255
xy_color: [0.2927, 0.2242]
light.kuche_vorne:
state: on
brightness: 255
xy_color: [0.6, 0.377]
light.wohnzimmer_kugel:
state: on
brightness: 255
xy_color: [0.3581, 0.287]
light.wohnzimmer_stehlampe:
state: on
brightness: 255
xy_color: [0.3581, 0.287]
light.wohnzimmer_stehlampe_oben:
state: on
brightness: 255
xy_color: [0.5993, 0.3765]
light.wohnzimmer_regal_rechts:
state: on
brightness: 255
xy_color: [0.2925, 0.2231]
light.wohnzimmer_regal_links:
state: on
brightness: 255
xy_color: [0.2075, 0.6584]
# Ganglicht
cover.esszimmer_fenster_rollo:
position: 100
cover.kuche_fenster_rollo:
position: 100
cover.wohnzimmer_fenster_rollo:
position: 100
cover.wohnzimmer_terrassentur_rollo:
position: 100
- name: Wohnbereich Kuscheln
entities:
light.kuche_deckenlampe:
state: off
light.wohnzimmer_deckenlampe:
state: off
light.esszimmer_deckenlampe_west:
state: off
light.esszimmer_deckenlampe_mitte:
state: off
light.esszimmer_schrankleuchte:
state: off
light.kuche_links:
state: on
brightness: 190
xy_color: [0.5609, 0.4111]
light.kuche_rechts:
state: on
brightness: 190
xy_color: [0.5609, 0.4111]
light.kuche_vorne:
state: on
brightness: 190
xy_color: [0.561, 0.4042]
light.wohnzimmer_kugel:
state: on
brightness: 190
xy_color: [0.5609, 0.4042]
light.wohnzimmer_stehlampe:
state: on
brightness: 190
xy_color: [0.5609, 0.4042]
light.wohnzimmer_stehlampe_oben:
state: on
brightness: 190
xy_color: [0.5609, 0.4042]
light.wohnzimmer_regal_rechts:
state: on
brightness: 190
xy_color: [0.5609, 0.4111]
light.wohnzimmer_regal_links:
state: on
brightness: 190
xy_color: [0.5609, 0.4111]
# Ganglicht
light.gang_bogen:
state: on
brightness: 255
xy_color: [0.6313, 0.361]
light.gang_licht:
state: off
# Rollos
cover.esszimmer_fenster_rollo:
position: 0
cover.kuche_fenster_rollo:
position: 0
cover.wohnzimmer_fenster_rollo:
position: 0
cover.wohnzimmer_terrassentur_rollo:
position: 0
# -------------------- Schlafzimmer -----------------------------------------
- name: Schlafzimmer Ganz Dunkel
entities:
light.schlafzimmer_deckenlampe:
state: off
light.schlafzimmer:
state: on
brightness: 1
color_temp: 477
- name: Schlafzimmer Dunkel
entities:
light.schlafzimmer_deckenlampe:
state: off
light.schlafzimmer:
state: on
brightness: 15
color_temp: 477
- name: Schalfzimmer Orange
entities:
light.schlafzimmer_deckenlampe:
state: off
light.schlafzimmer:
state: on
brightness: 127
color_temp: 477
- name: Schlafzimmer Blau
entities:
light.schlafzimmer_deckenlampe:
state: off
light.schlafzimmer:
state: on
brightness: 130
xy_color: [0.158, 0.053]
- name: Schlafzimmer Ganz Hell
entities:
light.schlafzimmer_deckenlampe:
state: on
brightness: 255
light.schlafzimmer:
state: on
brightness: 255
color_temp: 255

View File

@@ -1,4 +1,6 @@
resources:
- type: module
url: /local/custom_ui/compact-custom-header.js?v=0.0.1
- type: js
url: /local/custom_ui/state-card-custom-cover.js
- type: js
@@ -12,6 +14,11 @@ resources:
title: Home
views:
- cards:
- main_config: true
swipe: true
swipe_animate: flip
type: 'custom:compact-custom-header'
voice: hide
- aspect_ratio: 16x9
entities:
- group.living_area
@@ -23,11 +30,22 @@ views:
- color: '#2eacd7'
name: Blau
scene: scene.wohnbereich_blau_grun
- color: green
name: Grün
scene: scene.wohnbereich_grun
- color: '#9f9cac'
icon: 'mdi:weather-night'
name: Kuscheln
scene: scene.wohnbereich_kuscheln
type: 'custom:room-glance-card'
- artwork: cover
entity: media_player.martins_ipad_2
hide:
power_state: false
source: true
volume: true
icon: 'mdi:spotify'
type: 'custom:mini-media-player'
- entities:
- entity: light.kuche_deckenlampe
name: Decke Küche
@@ -52,6 +70,31 @@ views:
show_header_toggle: true
title: Küche/Esszimmer
type: entities
- artwork: cover
entity: media_player.kitchenpi
hide:
power_state: false
source: true
volume: false
shuffle: false
icon: 'mdi:music'
type: 'custom:mini-media-player'
shortcuts:
columns: 4
list:
- name: B5
type: music
id: >-
http://dg-br-http-dus-dtag-cdn.cast.addradio.de/br/b5aktuell/live/mp3/128/stream.mp3?ar-distributor=f0a1
icon: 'mdi:alpha-r'
- name: BigBand
icon: 'mdi:alpha-b'
type: music
id: 'spotify:playlist:37i9dQZF1DX6G7arXBXa3A'
- name: LateNightJazz
icon: 'mdi:alpha-j'
type: music
id: 'spotify:playlist:37i9dQZF1DX4wta20PHgwo'
- entities:
- entity: light.wohnzimmer_deckenlampe
name: Decke
@@ -88,6 +131,7 @@ views:
icon: 'mdi:sofa'
title: Wohnbereich
- cards:
- type: 'custom:compact-custom-header'
- aspect_ratio: 16x9
entities:
- group.bedroom
@@ -110,7 +154,6 @@ views:
- card:
title: Lichter die noch an sind
type: entities
show_empty: false
entities:
- entity: group.light_hallway
icon: 'mdi:door-closed'
@@ -121,14 +164,57 @@ views:
- entity: group.light_office_martin
icon: 'mdi:monitor-multiple'
name: Martins Büro
show_empty: false
state_filter:
- 'on'
type: entity-filter
- artwork: cover
entity: media_player.bedroompi
hide:
power_state: false
source: true
volume: false
shuffle: false
icon: 'mdi:music'
type: 'custom:mini-media-player'
shortcuts:
label: Playlists
list:
- name: Regen
type: music
id: 'spotify:playlist:37i9dQZF1DXbcPC6Vvqudd'
- name: Wellen
type: music
id: 'spotify:playlist:37i9dQZF1DX9if5QDLdzCa'
- name: Different Sleeping List
type: music
id: 'spotify:playlist:37i9dQZF1DX7heGeZ10YDi'
- name: LateNightJazz
type: music
id: 'spotify:playlist:37i9dQZF1DX4wta20PHgwo'
- name: Romantic Jazz
type: music
id: 'spotify:playlist:2AmjhSAm6iI0qrXXhQyHgk'
- name: Klassik zum Entspannen
type: music
id: 'spotify:playlist:37i9dQZF1DX8Dd9bxD1WYH'
- entities:
- entity: light.schlafzimmer_deckenlampe
name: Deckenlampe
- entity: light.schlafzimmer
name: Fluter
- entity: cover.schlafzimmer_rollo_gross
name: Rollo Groß
type: 'custom:state-card-custom-cover'
- entity: cover.schlafzimmer_rollo_klein
name: Rollo Klein
type: 'custom:state-card-custom-cover'
show_header_toggle: false
type: entities
icon: 'mdi:bed-empty'
title: Schlafzimmer
- title: Martins Büro
icon: 'mdi:monitor-multiple'
cards:
- cards:
- type: 'custom:compact-custom-header'
- aspect_ratio: 16x9
entities:
- group.office_martin
@@ -155,17 +241,20 @@ views:
- entity: light.arbeitszimmer_martin_unten
name: Stehlampe Unten
- entity: cover.arbeitszimmer_martin_rollo
name: Rollo Arbeitszimmer
name: Rollo
type: 'custom:state-card-custom-cover'
- entity: binary_sensor.arbeitszimmer_martin_bewegungsmelder_bewegung
format: relative
name: Bewegung
secondary_info: last-changed
format: relative
- entity: sensor.arbeitszimmer_martin_bewegungsmelder_helligkeit
name: Helligkeit
show_header_toggle: false
type: entities
icon: 'mdi:monitor-multiple'
title: Martins Büro
- cards:
- type: 'custom:compact-custom-header'
- entities:
- entity: sensor.trockner_verbrauch
name: Trockner aktuell
@@ -234,13 +323,4 @@ views:
points_per_hour: 30
type: 'custom:mini-graph-card'
title: Admin
- cards:
- artwork: cover
entity: media_player.kitchenpi
hide:
power_state: false
source: true
volume: true
icon: 'mdi:spotify'
type: 'custom:mini-media-player'
title: Test
icon: mdi:settings