Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dwain committed Feb 3, 2020
1 parent 7505009 commit 5997bb3
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 39 deletions.
2 changes: 1 addition & 1 deletion dwains-theme/configs-samples/house_information.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
house_information:
#house_information:
# favorites:
# - entity: binary_sensor.doorbell_button
# icon_on: fas:bell
Expand Down
2 changes: 1 addition & 1 deletion dwains-theme/configs-samples/persons.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
persons:
#persons:
# - name: Dwain
# track: person.dwain
# picture_path: 'foldername/images/persons/dwain.jpg'
28 changes: 10 additions & 18 deletions dwains-theme/plugins/button-cards-templates/rooms/room/device.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@
room_device:
show_name: true
show_icon: true
show_state: false
show_label: true
show_state: true
show_label: false
show_last_changed: true
color: 'auto'
label: >
[[[
if (typeof(entity) === 'undefined') return;
if(entity.state == 'on') {
if ('brightness' in entity.attributes) {
if (entity.attributes && (entity.attributes.brightness <= 255)) {
var bri = Math.round(entity.attributes.brightness / 2.55);
return 'On, ' + (bri ? bri : '0') + '%';
}
}
} else {
return 'Off';
}
]]]
styles:
grid:
- grid-template-areas: '"i n""i l"'
- grid-template-areas: '"i n""i s""i l"'
- grid-template-columns: 30% 70%
- grid-template-rows: min-content
card:
Expand All @@ -40,8 +27,13 @@ room_device:
- justify-self: start
- font-size: 15px
- align-self: center
label:
state:
- justify-self: start
- align-self: left
- font-size: 13px
- color: var(--dwains-theme-grey)
label:
- justify-self: start
- align-self: left
- font-size: 12px
- color: var(--dwains-theme-grey)
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
room_media_player:
show_name: true
show_icon: true
show_state: false
show_label: true
show_state: true
show_last_changed: true
color: 'auto'
label: >
[[[
return entity.state;
]]]
styles:
grid:
- grid-template-areas: '"i n""i l"'
- grid-template-areas: '"i n""i s""i l"'
- grid-template-columns: 30% 70%
- grid-template-rows: min-content
card:
Expand All @@ -30,8 +26,13 @@ room_media_player:
- justify-self: start
- font-size: 15px
- align-self: center
label:
state:
- justify-self: start
- align-self: left
- font-size: 13px
- color: var(--dwains-theme-grey)
label:
- justify-self: start
- align-self: left
- font-size: 12px
- color: var(--dwains-theme-grey)
38 changes: 32 additions & 6 deletions dwains-theme/views/main/01.homepage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
layout: horizontal
justify_content: start
cards:
{% if _d_t_config.rooms %}
- type: custom:button-card
template: header_house_information
name: >
Expand Down Expand Up @@ -72,53 +73,70 @@
{% endif %}
{% endif %}
{% endfor %}
return ((onLights >= 1) ? ((onLights == 1) ? '1 light on' : onLights + ' lights on') : 'All lights off')
if(lights == 0){
return 'House information';
} else {
return ((onLights >= 1) ? ((onLights == 1) ? '1 light on' : onLights + ' lights on') : 'All lights off')
}
]]]
label: >
[[[
var doorsInfo = '';
var windowsInfo = '';
var openDoors = 0;
var doors = 0;
var openWindows = 0;
var windows = 0;
{% for room in _d_t_config.rooms %}
//Do some things for the doors
{% if room["door"] %}
{% if room["door"].split('.')[0] == 'binary_sensor' %}
//This room has only 1 door
doors++;
if(states['{{ room["door"] }}'].state == 'on') {
openDoors++;
}
{% else %}
//This room has group of doors
states['{{ room["door"] }}'].attributes['entity_id'].forEach(function(entity){
doors++;
if(states[entity].state == 'on'){
openDoors++;
}
});
{% endif %}
{% endif %}
var doorsInfo = ((openDoors >= 1) ? ((openDoors == 1) ? '1 door open' : openDoors + ' doors open') : 'All doors closed')
if(doors > 0){
doorsInfo = ((openDoors >= 1) ? ((openDoors == 1) ? '1 door open' : openDoors + ' doors open') : 'All doors closed')
}
//Do some things for the windows
{% if room["window"] %}
{% if room["window"].split('.')[0] == 'binary_sensor' %}
//This room has only 1 window
windows++;
if(states['{{ room["window"] }}'].state == 'on') {
openWindows++;
}
{% else %}
//This room has group of windows
states['{{ room["window"] }}'].attributes['entity_id'].forEach(function(entity){
windows++;
if(states[entity].state == 'on'){
openWindows++;
}
});
{% endif %}
{% endif %}
var windowsInfo = ((openWindows >= 1) ? ((openWindows == 1) ? '1 window open' : openWindows + ' windows open') : 'All windows closed')
if(windows > 0){
windowsInfo = ((openWindows >= 1) ? ((openWindows == 1) ? '1 window open' : openWindows + ' windows open') : 'All windows closed')
}
{% endfor %}
return doorsInfo + '<br>' + windowsInfo;
return (doorsInfo ? doorsInfo + '<br>' : '') + windowsInfo;
]]]
{% endif %}
{% if _d_t_config.global["weather"] %}
- type: custom:button-card
template: header_weather
Expand All @@ -131,8 +149,16 @@
{% if _d_t_config.global["inside_temperature"] %}
label: >
[[[
return states['{{ _d_t_config.global["inside_temperature"] }}'].attributes.current_temperature + '° inside';
{% if _d_t_config.global["inside_temperature"].split('.')[0] == 'sensor' %}
return (Math.round(states['{{ _d_t_config.global["inside_temperature"] }}'].state * 10) / 10) + '° inside';
{% elif _d_t_config.global["inside_temperature"].split('.')[0] == 'climate' %}
return states['{{ _d_t_config.global["inside_temperature"] }}'].attributes.current_temperature + '° inside';
{% else %}
return 'NaN';
{% endif %}
]]]
{% else %}
label: '&nbsp;'
{% endif %}
{% endif %}
{% if _d_t_config.persons %}
Expand Down
2 changes: 1 addition & 1 deletion dwains-theme/views/main/03.scenes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- title: Scenes
path: scenes
icon: 'far:play-circle'
icon: 'mdi:play-circle-outline'
cards:
#Header
- !include
Expand Down
1 change: 0 additions & 1 deletion dwains-theme/views/main/more/house_information.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

- title: House information
path: more_house_information
icon: 'mdi:information-variant'
cards:
- type: vertical-stack
cards:
Expand Down
8 changes: 8 additions & 0 deletions dwains-theme/views/main/rooms/room.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@
entity: {{ room["light"] }}
template: rooms_child
icon: 'far:lightbulb'
styles:
img_cell:
- padding-left: 5px
- width: 40px
state:
- value: 'on'
icon: 'fas:lightbulb'
Expand Down Expand Up @@ -229,6 +233,10 @@
entity: {{ room["climate"] if room["climate"] else room["temperature"] }}
template: rooms_child
icon: 'fas:thermometer-three-quarters'
styles:
img_cell:
- padding-left: 8px
- width: 37px
name: Temperature
tap_action:
action: navigate
Expand Down
12 changes: 11 additions & 1 deletion user-package-sample/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,17 @@
# I recommend using subfolders it's better organized this way

# sensor: !include_dir_merge_list configuration/sensor/
# binary_sensor: !include_dir_merge_list configuration/binary_sensor/
# group: !include_dir_merge_named configuration/groups/
# automation: !include_dir_merge_list configuration/automations/
# script: !include_dir_merge_named configuration/scripts/

# switch: !include_dir_merge_list configuration/switch/

#Some more examples
# light: !include_dir_merge_list configuration/light/
# fan: !include_dir_merge_list configuration/fan/
# cover: !include_dir_merge_list configuration/cover/
# camera: !include_dir_merge_list configuration/camera/
# input_boolean: !include_dir_merge_named configuration/input_boolean/
# input_select: !include_dir_merge_named configuration/input_select/
# scene: !include configuration/scenes.yaml
21 changes: 21 additions & 0 deletions user-package-sample/configuration/automations/kitchen/spots.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

# WHEN KEUKENLAMP TURNS ON, TURN KEUKENSPOTS ON 1H BEFORE SUNSET AND TILL SUNRISE
- id: '1533504863293'
alias: Keukenspotjes aan
initial_state: 'true'
trigger:
- entity_id: light.keuken
platform: state
to: 'on'
condition:
condition: or
conditions:
- after: sunset
condition: sun
after_offset: "-01:00:00"
- before: sunrise
condition: sun
action:
- data:
entity_id: light.keuken_spotjes
service: light.turn_on
2 changes: 0 additions & 2 deletions user-package-sample/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@
# tado_username: yourusername
# tado_password: yourpassword

# imap_username: [email protected]
# imap_password: afgewerkt
2 changes: 2 additions & 0 deletions user-package-sample/views/addons/statistics.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# dwains_theme

# An example file on a custom page (addon)

- type: custom:mod-card
Expand Down

0 comments on commit 5997bb3

Please sign in to comment.