fixes - ui stuff

This commit is contained in:
Martin Bauer 2019-06-21 01:58:58 +02:00
parent 7b4c21204a
commit 53ed91e59b
9 changed files with 236 additions and 57 deletions

View File

@ -1,40 +1,60 @@
# Add only entities here that are auto-discovered (not FHEM and KNX devices)
default_view: default_view:
view: true view: true
icon: mdi:home icon: mdi:home
living_area: living_area:
name: Wohnbereich name: Wohnbereich
view: true entities:
- light.kuche_links
- light.kuche_rechts
- light.kuche_vorne
- light.wohnzimmer_kugel
- light.wohnzimmer_stehlampe
- light.wohnzimmer_stehlampe_oben
- light.wohnzimmer_regal_rechts
- light.wohnzimmer_regal_links
bedroom: bedroom:
name: Schlafzimmer name: Schlafzimmer
view: true entities:
- light.schlafzimmer
hallway: hallway:
name: Gang name: Gang
view: true entities:
- light.gang_bogen
outside: outside:
name: Außen name: Außen
view: true
office_martin: office_martin:
name: Arbeitszimmer name: Arbeitszimmer
view: true entities:
- light.arbeitszimmer_martin_oben
- light.arbeitszimmer_martin_unten
- light.arbeitszimmer_martin
office_rebecca: office_rebecca:
name: Arbeitszimmer Rebecca name: Arbeitszimmer Rebecca
view: true entities:
- light.arbeitszimmer_rebecca
bathroom: bathroom:
name: Bad name: Bad
view: true
other: other:
name: Rest name: Rest
view: true
first_floor: first_floor:
name: Oben name: Oben
view: true

View File

@ -100,6 +100,17 @@ def add_fhem_devices(devices, groups):
devices[device_type].append(device) devices[device_type].append(device)
def add_light_groups(groups):
light_groups = {
f"light_{group_id}": {
'name': content['name'] + " Lichter",
'entities': [e for e in content['entities'] if e.startswith('light.')],
}
for group_id, content in groups.items() if 'name' in content
}
groups.update(light_groups)
def main(): def main():
group_dict = yaml.load(open('groups.yaml')) group_dict = yaml.load(open('groups.yaml'))
@ -110,6 +121,7 @@ def main():
with open('output/configuration.yaml', 'w') as output: with open('output/configuration.yaml', 'w') as output:
output.write(open('manual_config.yaml', 'r').read()) output.write(open('manual_config.yaml', 'r').read())
yaml.dump(all_devices, output) yaml.dump(all_devices, output)
add_light_groups(group_dict)
yaml.dump(group_dict, open('output/groups.yaml', 'w')) yaml.dump(group_dict, open('output/groups.yaml', 'w'))

View File

@ -14,11 +14,30 @@ homeassistant:
latitude: 49.369477 latitude: 49.369477
longitude: 10.9831468 longitude: 10.9831468
customize_glob: customize:
cover.*: cover.arbeitszimmer_martin_rollo:
half_position: 25 half_position: 16
cover.arbeitszimmer_rebecca_rollo:
half_position: 16
cover.schlafzimmer_rollo_gross:
half_position: 16
cover.schlafzimmer_rollo_klein:
half_position: 16
cover.esszimmer_fenster_rollo:
half_position: 25
cover.kuche_fenster_rollo:
half_position: 25
cover.wohnzimmer_fenster_rollo:
half_position: 25
cover.wohnzimmer_terrassentur_rollo:
half_position: 25
# Custom stuff
dimmer: dimmer:
cover_half:
#logger: #logger:
# default: info # default: info

View File

@ -28,11 +28,11 @@
light.arbeitszimmer_martin_oben: light.arbeitszimmer_martin_oben:
state: on state: on
brightness: 186 brightness: 186
xy_color: [0.569, 0.397] xy_color: [0.565,0.398]
light.arbeitszimmer_martin_unten: light.arbeitszimmer_martin_unten:
state: on state: on
brightness: 247 brightness: 247
xy_color: [0.2, 0.102] xy_color: [0.219,0.137]
- name: Arbeitszimmer Martin Hell - name: Arbeitszimmer Martin Hell
entities: entities:

View File

@ -5,15 +5,29 @@ resources:
url: /local/custom_ui/lovelace-toggle-lock-entity-row/toggle-lock-entity-row.js url: /local/custom_ui/lovelace-toggle-lock-entity-row/toggle-lock-entity-row.js
- type: module - type: module
url: /local/custom_ui/mini-graph-card-bundle.js?v=0.4.3 url: /local/custom_ui/mini-graph-card-bundle.js?v=0.4.3
- type: module
url: /local/custom_ui/mini-media-player-bundle.js?v=1.2.0
- type: js
url: /local/custom_ui/room-glance-card.js
title: Home title: Home
views: views:
- cards: - cards:
- entities: - aspect_ratio: 16x9
- light.wohnzimmer_deckenlampe entities:
- light.wohnzimmer_kugel - group.living_area
image: /local/living_room.jpg image: /local/img/living_area_16_9.jpg
title: Wohnzimmer scenes:
type: picture-glance - color: '#f07a1d'
name: Orange
scene: scene.wohnbereich_orange
- color: '#2eacd7'
name: Blau
scene: scene.wohnbereich_blau_grun
- color: '#9f9cac'
icon: 'mdi:weather-night'
name: Kuscheln
scene: scene.wohnbereich_kuscheln
type: 'custom:room-glance-card'
- entities: - entities:
- entity: light.kuche_deckenlampe - entity: light.kuche_deckenlampe
name: Decke Küche name: Decke Küche
@ -71,11 +85,87 @@ views:
show_header_toggle: true show_header_toggle: true
title: Gang title: Gang
type: entities type: entities
icon: 'mdi:sofa'
title: Wohnbereich title: Wohnbereich
- badges: - cards:
- sensor.fritz_box_7490_kbyte_sec_received - aspect_ratio: 16x9
- sensor.fritz_box_7490_kbyte_sec_sent entities:
- group.bedroom
image: /local/img/bedroom_16_9.jpg
scenes:
- color: '#ccc'
icon: 'mdi:sleep'
name: Dunkel
scene: scene.schlafzimmer_ganz_dunkel
- color: '#f07a1d'
name: Orange
scene: scene.schlafzimmer_orange
- color: '#fdef56'
name: Hell
scene: scene.schlafzimmer_ganz_hell
- color: '#2eacd7'
name: Blau
scene: scene.schlafzimmer_blau
type: 'custom:room-glance-card'
- card:
title: Lichter die noch an sind
type: entities
show_empty: false
entities:
- entity: group.light_hallway
icon: 'mdi:door-closed'
name: Gang
- entity: group.light_living_area
icon: 'mdi:sofa'
name: Wohnzimmer/Esszimmer
- entity: group.light_office_martin
icon: 'mdi:monitor-multiple'
name: Martins Büro
state_filter:
- 'on'
type: entity-filter
icon: 'mdi:bed-empty'
title: Schlafzimmer
- title: Martins Büro
icon: 'mdi:monitor-multiple'
cards: cards:
- aspect_ratio: 16x9
entities:
- group.office_martin
image: /local/img/office_martin_16_9.jpg
name: Arbeitszimmer
scenes:
- color: '#f07a1d'
name: Orange
scene: scene.arbeitszimmer_martin_orange
- color: '#2eacd7'
name: Blau
scene: scene.arbeitszimmer_martin_blau_grun
- color: '#fff'
name: Hell
scene: scene.arbeitszimmer_martin_hell
type: 'custom:room-glance-card'
- entities:
- entity: light.arbeitszimmer_martin_deckenlampe
name: Deckenlampe
- entity: light.arbeitszimmer_martin
name: Fluter
- entity: light.arbeitszimmer_martin_oben
name: Stehlampe Oben
- entity: light.arbeitszimmer_martin_unten
name: Stehlampe Unten
- entity: cover.arbeitszimmer_martin_rollo
name: Rollo Arbeitszimmer
type: 'custom:state-card-custom-cover'
- entity: binary_sensor.arbeitszimmer_martin_bewegungsmelder_bewegung
name: Bewegung
secondary_info: last-changed
format: relative
- entity: sensor.arbeitszimmer_martin_bewegungsmelder_helligkeit
name: Helligkeit
show_header_toggle: false
type: entities
- cards:
- entities: - entities:
- entity: sensor.trockner_verbrauch - entity: sensor.trockner_verbrauch
name: Trockner aktuell name: Trockner aktuell
@ -145,15 +235,12 @@ views:
type: 'custom:mini-graph-card' type: 'custom:mini-graph-card'
title: Admin title: Admin
- cards: - cards:
- entities: - artwork: cover
- light.arbeitszimmer_martin_deckenlampe entity: media_player.kitchenpi
- name: Rollo Arbeitszimmer hide:
entity: cover.arbeitszimmer_martin_rollo power_state: false
type: 'custom:state-card-custom-cover' source: true
- binary_sensor.arbeitszimmer_martin_bewegungsmelder_bewegung volume: true
- sensor.arbeitszimmer_martin_bewegungsmelder_helligkeit icon: 'mdi:spotify'
- switch.bad_lufter type: 'custom:mini-media-player'
show_header_toggle: false
title: Test
type: entities
title: Test title: Test

View File

@ -0,0 +1,45 @@
""" Service to set covers half open"""
import logging
import voluptuous as vol
from homeassistant.components.cover import DOMAIN as COVER_DOMAIN, ATTR_POSITION
from homeassistant.const import SERVICE_SET_COVER_POSITION, ATTR_ENTITY_ID
# The domain of your component. Should be equal to the name of your component.
from homeassistant.helpers.service import async_extract_entity_ids
DOMAIN = "cover_half"
# List of component names (string) your component depends upon.
# We depend on group because group will be loaded after all the components that
# initialize devices have been setup.
DEPENDENCIES = ['group', 'cover']
# Name of the service that we expose.
SERVICE_SET_HALF = 'set_half'
ATTR_HALF_POSITION = 'half_position'
# Shortcut for the logger
_LOGGER = logging.getLogger(__name__)
# Validate that all required config options are given.
CONFIG_SCHEMA = vol.Schema({
DOMAIN: vol.Schema({})
}, extra=vol.ALLOW_EXTRA)
async def async_setup(hass, config):
"""Setup example component."""
async def async_set_half_service(service):
entity_ids = await async_extract_entity_ids(hass, service, expand_group=True)
for entity_id in entity_ids:
data = {
ATTR_ENTITY_ID: entity_id,
ATTR_POSITION: hass.states.get(entity_id).attributes.get(ATTR_HALF_POSITION, 20)
}
await hass.services.async_call(COVER_DOMAIN, SERVICE_SET_COVER_POSITION, data)
hass.services.async_register(DOMAIN, SERVICE_SET_HALF, async_set_half_service)
return True

View File

@ -0,0 +1,7 @@
dim:
description: Sets shutters half open
fields:
entity_id:
description: Name(s) of entities or groups
example: 'cover.living_room'

View File

@ -56,6 +56,9 @@ async def async_setup(hass, config):
for entity_id in entity_ids: for entity_id in entity_ids:
brightness = hass.states.get(entity_id).attributes.get('brightness', 0) brightness = hass.states.get(entity_id).attributes.get('brightness', 0)
state = hass.states.get(entity_id).state
if state == 'off':
continue
if factor is not None: if factor is not None:
data = {ATTR_BRIGHTNESS: clip_value(brightness * factor)} data = {ATTR_BRIGHTNESS: clip_value(brightness * factor)}
if offset is not None: if offset is not None:

28
todo
View File

@ -1,38 +1,24 @@
- watson TTS add new RATE configuration and create merge request [ok]
- add brighter/darker action (service!)
- add scenes [ok]
- try in frontend [ok]
-
- add half state for FHEM covers
- frontend cards for rooms with light stuff - frontend cards for rooms with light stuff
- implement shutter - half open service [ok]
- frontend card: use group to set [ok]
- add HUE lights to groups
- add KNX motion sensors & leds - add KNX motion sensors & leds
-
LIRC connection [ok]
Squeezebox: Squeezebox:
- standard setup - standard setup
- radio service - radio service
FHEM: FHEM:
- check FHEM reconnection [ok] - check FHEM reconnection
- what happens when FHEM stops? [ok]
- what happens when stick is pulled? - what happens when stick is pulled?
Owntracks Owntracks
- try basic owntracks setup - try basic owntracks setup
Other: - grouped motion sensors (last motion where and when)
- grouped motion sensors (last motion where and when)
- media player card:
https://github.com/kalkih/mini-media-player