Compare commits

...

73 Commits

Author SHA1 Message Date
a1b68f80b6 Changes for new version of Bubble Cards 2025-05-08 21:35:45 -04:00
adc4bc9b42 Update .HA_VERSION 2025-05-08 21:35:08 -04:00
1500151c12 Handle Tina's meds resetting when she wakes up #243 2025-05-07 11:48:56 -04:00
67d1d3d43e Fix #241 2025-04-29 18:11:36 -04:00
1c5ccbb926 Update time macros 2025-04-29 18:06:31 -04:00
5d4457c198 Adjust MBR climate scheduling 2025-04-29 01:54:06 -04:00
d16a0f8353 Update scheduled reset for wife's night meds 2025-04-29 01:53:40 -04:00
c8242c2fea Update .HA_VERSION 2025-04-29 01:52:52 -04:00
713ddb9f75 Fix Emma's climate scheduling using old logic 2025-04-28 21:33:49 -04:00
10d7ec5e03 Account for overtime in sports reports 2025-04-28 21:33:33 -04:00
95ffb38b7e Exclude RSSI sensors from recorder 2025-04-28 21:32:50 -04:00
b5c295a19d Add config stuff for new default theme 2025-04-24 01:51:11 -04:00
bd9dde2455 Remove eco mode sensors for aircons as they are no longer needed 2025-04-24 01:32:52 -04:00
857870e0b1 Add a few more lights to monitor for unintended switching 2025-04-19 22:50:35 -04:00
003fe6614d Update .HA_VERSION 2025-04-19 22:19:38 -04:00
364c81e8b1 Use night volumes if people are sleeping
#238
2025-04-19 14:37:47 -04:00
0d42142a07 Simplify default speaker volume settings
#238
2025-04-19 14:30:41 -04:00
7d6d72c6ef Update eco mode sensors to reflect new Midea integration in use 2025-04-19 13:58:08 -04:00
41228c1304 Gotta actually CALL an entity to run a service on it...fix #216 2025-04-18 17:49:48 -04:00
b4f4d06d6c Fix scenes using deprecated Hue effect "None" 2025-04-18 17:32:20 -04:00
002919483f Lower-case format period_str 2025-04-16 14:35:14 -04:00
ef548c2df1 Use period_str instead of "inning" 2025-04-16 14:32:28 -04:00
1d60a4df32 Update .HA_VERSION 2025-04-16 14:31:19 -04:00
57c27d4e48 Sports updates are now clock/inning aware
We know at LEAST baseball works. Will have to test hockey at the start of the playoffs in a few days, and football later this year.
2025-04-16 14:23:53 -04:00
c06bd894ae Working on adding clock updates to sports update macros 2025-04-16 13:52:12 -04:00
1b3cf79f25 Reading mode for waifu
#236
2025-04-13 01:50:06 -04:00
7cf9c13e38 Sensor for unavailable lights due to potential light switch usage
home_automation/Home-Assistant-Configs#235
2025-04-13 01:29:20 -04:00
e8c6cd8deb Remove cache parameter from AWS Polly config 2025-04-05 17:14:54 -04:00
df92fc4df6 Remove amazon auto breaths from speech engine 2025-04-05 17:05:19 -04:00
a936b22bb9 Switch AWS Polly from neural voice engine to generative 2025-04-05 16:55:41 -04:00
9aa918d335 Rearrange reboot handling automation, add reset of night modes 2025-04-05 16:55:25 -04:00
c7d6297934 Update .HA_VERSION 2025-04-05 16:54:55 -04:00
ce29e80330 Try to fix Tina Desk Switch weirdness 2025-04-02 15:53:12 -04:00
10deee4f04 Always play Emma wakeup announcement, and play it in common areas 2025-03-29 01:15:20 -04:00
6fa762a113 Adjust scheduling for ridiculously OP air conditioner 2025-03-29 01:10:58 -04:00
7b529895e5 Whole fuckload of changes for Emma's new air conditioner 2025-03-28 21:56:58 -04:00
bdb278dd28 Adjust TTS briefings for K riding the bus
#219
2025-03-24 18:38:55 -04:00
000efa7562 Adjust status macros for K riding the bus
#219
2025-03-24 18:38:54 -04:00
b6911a0f59 Rework scheduling for K riding the bus
#219
2025-03-24 18:38:53 -04:00
d49563435d Raise threshold to show computers on, ignore idle power spikes
This caused my computer to briefly register as on, and thus my Awake switch was turned on and prevented Emma's door alert from playing in the bedroom
2025-03-24 18:38:38 -04:00
1a89d088f6 Automations to deal with Emma Awake toggle 2025-03-24 03:00:13 -04:00
ee6499bec8 Add option for Adjustment request in reporting system 2025-03-22 20:50:01 -04:00
148f78aecd Update .HA_VERSION 2025-03-22 07:20:42 -04:00
49f9e99439 Add warnings for considerable destructive t-storm, confirmed tornado 2025-03-19 17:11:34 -04:00
6254fb5953 Track new weather alert sensors for long-term stats 2025-03-18 01:38:17 -04:00
334b7963e8 Add ability to show when tornado production is possible 2025-03-18 01:37:52 -04:00
4466b17df1 Update .HA_VERSION 2025-03-17 16:12:03 -04:00
f96056edda Use correct sensor for master bedroom temperature in welcome home brief 2025-03-16 04:16:44 -04:00
652b4e7dff Additional editing added for weather briefing 2025-03-16 04:16:16 -04:00
26bcf136e6 Update med scripts to use AI-generated snark 2025-03-14 02:14:46 -04:00
9e90998a21 Update Kallen morning meds script, he can now mark morning meds himself 2025-03-14 00:59:22 -04:00
30c8307272 Improve aircon fan/compressor template sensors 2025-03-14 00:19:26 -04:00
e6b0db142e Update .HA_VERSION 2025-03-14 00:18:59 -04:00
b5dd9621d1 Don't turn basement heat on if it was off 2025-03-11 02:07:15 -04:00
587ac4d203 Update .HA_VERSION 2025-03-08 15:24:32 -05:00
b459d78446 Add new dashboard format to weather report macro 2025-03-05 17:26:55 -05:00
352e4f1ada Update weather report jinja template 2025-03-05 17:08:30 -05:00
09d82abdb1 Monthly update 2025-03-05 16:25:21 -05:00
8b120ae347 Tweak temperature scales for bubble cards slightly 2025-03-04 02:17:56 -05:00
da03ea826b Add temperature coloring module for bubble cards 2025-03-04 02:09:27 -05:00
66fc0fb906 Default bubble modules file 2025-03-04 01:38:14 -05:00
4c81a8a6a5 Updated gitignore 2025-03-04 01:32:15 -05:00
35a511710e Add "do not enter" input boolean tm24fan8/Home-Assistant-Configs#218 2025-03-01 20:49:06 -05:00
4c7bf9a85c Include .HA_VERSION file 2025-02-28 00:46:44 -05:00
754e3d6095 Don't consider K's computer as occupying the basement if I am upstairs 2025-02-28 00:30:26 -05:00
8f707c71bb Make it easier to activate nightlight in master bedroom 2025-02-27 00:50:53 -05:00
08b5c7b764 Remove old scrape-based gas sensors 2025-02-26 03:37:22 -05:00
fd37fe589c Push security disarm 5 minutes earlier for K's school mornings
Close #215
2025-02-26 02:27:18 -05:00
36906d6207 Updated readme 2025-02-26 01:17:33 -05:00
29dcb654b4 Copy ibuprofen and tylenol trackers for Tina 2025-02-21 22:19:37 -05:00
ec0aed386a Begin simplification of wife's desk lighting 2025-02-18 15:40:35 -05:00
a96bc99271 Basement presence now checks if I'm using wife's PC upstairs
#188
2025-02-15 16:03:59 -05:00
a085e71c86 Remove wife's desk strip as it broke 2025-02-11 02:41:43 -05:00
33 changed files with 3050 additions and 1311 deletions

1
.HA_VERSION Normal file
View File

@ -0,0 +1 @@
2025.5.0

20
.gitignore vendored
View File

@ -3,23 +3,20 @@
/.cloud
/.google.token
/.ssh
/.codegpt
# ignore some directories.
/icloud/
/www/
/www/*
/tts/
/deps/
/hadashboards/
/intents/
/themes/
/custom_components
/deps
/hacs
/image
/node-red/
/files
/appdaemon/*
/appdaemon/apps/*
/appdaemon/
/glances/
/downloads/
/lightwand/
@ -27,7 +24,6 @@
# ignore any of these files no matter where they are using double *
**.DS_Store
**._*
**.HA_VERSION
**.pyc
**.conf
**.uuid
@ -72,12 +68,4 @@
**test.jinja
# exceptions
!/appdaemon/apps/
!/appdaemon/apps/apps.yaml
!/node-red/projects/
!/node-red/projects/NerdFlows/
!/node-red/projects/NerdFlows/flows.json
!/node-red/projects/NerdFlows/flows_cred.json
!/node-red/projects/NerdFlows/package.json
!/node-red/projects/NerdFlows/README.md
.codegpt
!/www/bubble/

File diff suppressed because it is too large Load Diff

View File

@ -32,8 +32,16 @@ frontend:
extra_module_url:
- /hacsfiles/hass-hue-icons/hass-hue-icons.js
- /hacsfiles/hass-bha-icons/hass-bha-icons.js
- /hacsfiles/material-you-utilities/material-you-utilities.min.js
javascript_version: latest
panel_custom:
- name: material-you-panel
url_path: material-you-configuration
sidebar_title: Material You Utilities
sidebar_icon: mdi:material-design
module_url: /hacsfiles/material-you-utilities/material-you-utilities.min.js
http:
use_x_forwarded_for: true
trusted_proxies:
@ -107,6 +115,7 @@ recorder:
- sensor.*gpu_core_load
- sensor.portainer*
- sensor.mosquitto*
- sensor.*_rssi
entities:
- sensor.avg_ping
- sensor.max_ping
@ -321,6 +330,9 @@ influxdb:
- sensor.dimmest_room
- sensor.warmest_room_temperature
- sensor.coldest_room_temperature
- sensor.national_tornado_warnings
- sensor.national_severe_thunderstorm_warnings
- binary_sensor.severe_thunderstorm_warning
logbook:
include:
@ -498,3 +510,6 @@ prometheus:
- sensor.dimmest_room
- sensor.warmest_room_temperature
- sensor.coldest_room_temperature
- sensor.national_tornado_warnings
- sensor.national_severe_thunderstorm_warnings
- binary_sensor.severe_thunderstorm_warning

View File

@ -203,6 +203,8 @@
'today': 'vandaag',
'tomorrow': 'morgen',
'yesterday': 'gisteren',
'next': 'volgende',
'last': 'afgelopen',
},
'days':[
"maandag",
@ -226,12 +228,30 @@
'oktober',
'november',
'december',
]
],
'time_of_hour':{
0: '{hour} uur',
1: '1 over {hour}',
15: 'kwart over {hour}',
30: 'half {hour}',
45: 'kwart voor {hour}',
59: '1 voor {hour}',
'past_hour': '{minute} over {hour}',
'to_hour': '{minute} voor {hour}',
'to_half_hour': '{minute} voor half {hour}',
'past_half_hour': '{minute} over half {hour}',
'half_hour': 'half {hour}',
'use_twelve': true,
},
'time_of_day':{
'midnight': 'middernacht',
'noon': 'middag',
},
},
'sv':{
'_language': 'Svenska',
'and': 'och',
'in': 'i',
'in': 'om',
'ago': 'sedan',
'now': 'nu',
'lose': 'förlora',
@ -273,6 +293,7 @@
'today': 'idag',
'tomorrow': 'imorgon',
'yesterday': 'igår',
'next': 'nästa',
},
'days':[
"måndag",
@ -302,7 +323,7 @@
'_language': 'Deutsch',
'and': 'und',
'in': 'in',
'ago': 'vor',
'ago': 'vor %s',
'now': 'jetzt',
'lose': 'Du verlierst',
'gain': 'Du gewinnst',
@ -363,7 +384,7 @@
'Juli',
'August',
'September',
'October',
'Oktober',
'November',
'Dezember',
]
@ -623,6 +644,8 @@
'today': "aujourd'hui",
'tomorrow': 'demain',
'yesterday': 'hier',
'next': 'prochain',
'last': 'dernier',
},
'days':[
"lundi",
@ -693,6 +716,8 @@
'today': 'hoy',
'tomorrow': 'mañana',
'yesterday': 'ayer',
'next': 'el próximo',
'last': 'el pasado',
},
'days':[
'lunes',
@ -711,12 +736,26 @@
'mayo',
'junio',
'julio',
'agosto'
'agosto',
'septiembre',
'octubre',
'noviembre',
'diciembre'
]
],
'time_of_hour':{
0: '{hour} en punto',
1: '{hour} y un minuto',
15: '{hour} y quarto',
30: '{hour} y media',
45: '{hour} menos quarto',
59: '{hour} menos uno',
'past_hour': '{hour} y {minute}',
'to_hour': '{hour} menos {minute}',
},
'time_of_day':{
'midnight': 'medianoche',
'noon': 'mediodía',
},
},
'it':{
'_language': 'Italiano',
@ -865,9 +904,9 @@
'and': 'i',
'in': 'u',
'ago': 'prije',
'now': 'sad',
'now': 'sada',
'lose': 'gubiš',
'gain': 'dobijaš',
'gain': 'dobivaš',
'time':{
'format': '24-hr',
'year': [
@ -905,8 +944,8 @@
'today': 'danas',
'tomorrow': 'sutra',
'yesterday': 'jučer',
'next': 'slijedeći',
'last': 'prošli',
'next': 'sljedeći',
'last': 'protekli',
},
'days':[
"Ponedjeljak",
@ -1003,11 +1042,421 @@
'Listopad',
'Grudzień',
]
},
'ru':{
'_language': 'Русский',
'and': 'и',
'in': 'в',
'ago': 'назад',
'now': 'сейчас',
'lose': 'уменьшение',
'gain': 'увеличение',
'time':{
'format': '24-hr',
'year': [
'г',
'год',
'лет',
],
'week': [
'нед',
'неделя',
'недель',
],
'day': [
'д',
'день',
'дней',
],
'hour': [
'ч',
'час',
'часов',
],
'minute': [
'мин',
'минута',
'минут',
],
'second': [
'сек',
'секунда',
'секунд',
],
},
'delta':{
'today': 'сегодня',
'tomorrow': 'завтра',
'yesterday': 'вчера',
'next': 'следующий',
'last': 'последний',
},
'days':[
"Понедельник",
"Вторник",
"Среда",
"Четверг",
"Пятница",
"Суббота",
"Воскресенье",
],
'months':[
'Январь',
'Февраль',
'Март',
'Апрель',
'Май',
'Июнь',
'Июль',
'Август',
'Сентябрь',
'Октябрь',
'Ноябрь',
'Декабрь',
],
'time_of_hour':{
0: '{hour} часов ровно',
1: '{hour} и 1 минута',
15: '{hour} с четвертью',
30: '{hour} с половиной',
45: 'без четверти {hour}',
59: 'без минуты {hour}',
'past_hour': '{hour} и {minute} минут',
'to_hour': 'без {minute} минут {hour}',
},
'time_of_day':{
'midnight': 'полночь',
'noon': 'полдень',
},
},
'uk':{
'_language': 'Українська',
'and': 'і',
'in': 'в',
'ago': 'тому',
'now': 'зараз',
'lose': 'зменшення',
'gain': 'збільшення',
'time':{
'format': '24-hr',
'year': [
'р',
'рік',
'роки',
],
'week': [
'тиж',
'тиждень',
'тижні',
],
'day': [
'д',
'день',
'дні',
],
'hour': [
'год',
'година',
'години',
],
'minute': [
'хв',
'хвилина',
'хвилини',
],
'second': [
'сек',
'секунда',
'секунди',
],
},
'delta':{
'today': 'сьогодні',
'tomorrow': 'завтра',
'yesterday': 'вчора',
'next': 'наступний',
'last': 'останній',
},
'days':[
"Понеділок",
"Вівторок",
"Середа",
"Четвер",
"П'ятниця",
"Субота",
"Неділя",
],
'months':[
'Січень',
'Лютий',
'Березень',
'Квітень',
'Травень',
'Червень',
'Липень',
'Серпень',
'Вересень',
'Жовтень',
'Листопад',
'Грудень',
],
'time_of_hour':{
0: '{hour} годин',
1: '{hour} годин(а) одна хвилина',
15: 'чверть на {hour}',
30: 'пів на {hour}',
45: 'за чверть {hour}',
59: 'за хвилину {hour}',
'past_hour': '{hour} та {minute} хвилин',
'to_hour': 'за {minute} хвилин {hour}',
},
'time_of_day':{
'midnight': 'опівночі',
'noon': 'опівдні',
},
},
'zh-Hans':{
'_language': '简体中文',
'and': '',
'in': '',
'ago': '之前',
'now': '现在',
'lose': '失去',
'gain': '获得',
'time':{
'format': '24-hr',
'year': [
'年',
'年',
'年',
],
'week': [
'周',
'星期',
'星期',
],
'day': [
'天',
'天',
'天',
],
'hour': [
'时',
'小时',
'小时',
],
'minute': [
'分',
'分钟',
'分钟',
],
'second': [
'秒',
'秒',
'秒',
],
},
'delta':{
'today': '今天',
'tomorrow': '明天',
'yesterday': '昨天',
'next': '下一个',
'last': '上一个',
},
'days':[
"星期一",
"星期二",
"星期三",
"星期四",
"星期五",
"星期六",
"星期日",
],
'months':[
'一月',
'二月',
'三月',
'四月',
'五月',
'六月',
'七月',
'八月',
'九月',
'十月',
'十一月',
'十二月',
],
'time_of_day':{
'midnight': '午夜',
'noon': '正午',
},
},
'ko':{
'_language':'Korean',
'and':'',
'in':'후',
'ago':'전',
'now':'지금',
'lose':'감소',
'gain':'증가',
'time':{
'format':'24-hr',
'year':[
'년',
'년',
'년',
],
'week':[
'주',
'주',
'주',
],
'day':[
'일',
'일',
'일',
],
'hour':[
'시',
'시간',
'시간',
],
'minute':[
'분',
'분',
'분',
],
'second':[
'초',
'초',
'초',
],
},
'delta':{
'today':'오늘',
'tomorrow':'내일',
'yesterday':'어제',
'next':'다음',
'last':'지난',
},
'days':[
'월요일',
'화요일',
'수요일',
'목요일',
'금요일',
'토요일',
'일요일',
],
'months':[
'1월',
'2월',
'3월',
'4월',
'5월',
'6월',
'7월',
'8월',
'9월',
'10월',
'11월',
'12월',
],
'time_of_day':{
'midnight':'자정',
'noon':'정오',
},
},
'cs': {
'_language': 'Čeština',
'and': 'a',
'in': 'za',
'ago': 'před %s',
'now': 'nyní',
'lose': 'ztratit',
'gain': 'získat',
'time': {
'format': '12-hodin',
'year': [
'rok',
'rok',
'roky'
],
'week': [
'týd',
'týden',
'týdny'
],
'day': [
'd',
'den',
'dny'
],
'hour': [
'hod',
'hodina',
'hodiny'
],
'minute': [
'min',
'minuta',
'minuty'
],
'second': [
'sek',
'sekunda',
'sekundy'
]
},
'delta': {
'today': 'dnes',
'tomorrow': 'zítra',
'yesterday': 'včera',
'next': 'příští',
'last': 'poslední'
},
'days': [
'Pondělí',
'Úterý',
'Středa',
'Čtvrtek',
'Pátek',
'Sobota',
'Neděle'
],
'months': [
'Leden',
'Únor',
'Březen',
'Duben',
'Květen',
'Červen',
'Červenec',
'Srpen',
'Září',
'Říjen',
'Listopad',
'Prosinec'
],
'time_of_hour': {
0: '{hour} hodin',
1: 'minuta po {hour}',
15: 'čtvrt na {hour}',
30: 'půl {hour}',
45: 'tři čtvrtě na {hour}',
59: 'minuta do {hour}',
'past_hour': '{minute} po {hour}',
'to_hour': '{minute} do {hour}'
},
'time_of_day': {
'midnight': 'půlnoc',
'noon': 'poledne'
}
}
} %}
{# DO NOT MODIFY BELOW THIS LINE #}
{% set valid_entity_id_pattern = '^(?!.+__)(?!_)[\\da-z_]+(?<!_)\\.(?!_)[\\da-z_]+(?<!_)$' %}
{% set _bad_value = '?' %}
{% set _durations = {
'year': 31536000,
@ -1091,10 +1540,10 @@
{%- endmacro -%}
{%- macro _check_for_duration_sensor(input) %}
{%- if input is string and input | regex_search('^(?!.+__)(?!_)[\da-z_]+(?<!_)\.(?!_)[\da-z_]+(?<!_)$') and input.startswith('sensor') and states[input] is not none and states[input].attributes.device_class is defined and states[input].attributes.unit_of_measurement is defined -%}
{%- if input is string and input | regex_search(valid_entity_id_pattern) and input.startswith('sensor') and states[input] is not none and states[input].attributes.device_class is defined and states[input].attributes.unit_of_measurement is defined -%}
{%- set obj = states[input] -%}
{%- set divisor = _duration_sensor.get(obj.attributes.unit_of_measurement) -%}
{{- (obj.state | float / divisor) | string | as_timedelta -}}
{%- set multiplier = _duration_sensor.get(obj.attributes.unit_of_measurement) -%}
{{- (obj.state | float * multiplier) | string | as_timedelta -}}
{%- else %}
{{- '' -}}
{%- endif -%}
@ -1116,7 +1565,7 @@
{#- assume time as string or entity_id -#}
{%- elif input is string and input not in ['', 'None'] -%}
{#- if entity_id -#}
{%- if input | regex_search('^(?!.+__)(?!_)[\da-z_]+(?<!_)\.(?!_)[\da-z_]+(?<!_)$') -%}
{%- if input | regex_search(valid_entity_id_pattern) -%}
{%- if attribute is not none and attribute is string -%}
{{- _to_datetime(state_attr(input, attribute), None) -}}
{%- elif input.startswith('input_datetime') and is_state_attr(input, 'has_date', False) -%}
@ -1201,7 +1650,7 @@
{%- set index = values.index(values | first | default) %}
{%- for item in values[index:] %}
{%- set duration = _durations.get(item, 1) %}
{%- set period = _periods.get(item, 1) %}
{%- set period = _periods.get(item, 0) %}
{%- set value = ((seconds // duration) % (period if period else duration)) | int %}
{%- if value > 0 or raw %}
{%- if ns.ret | length == 0 %}
@ -1252,8 +1701,8 @@
{%- endmacro %}
{%- macro _time_between(func, input1, attr1, utc1, input2, attr2, utc2) -%}
{%- set t1 = _to_datetime(input1, attr1, utc1) | as_datetime -%}
{%- set t2 = _to_datetime(input2, attr2, utc2) | as_datetime -%}
{%- set t1 = _to_datetime(input1, attr1, utc1) | as_datetime | as_local -%}
{%- set t2 = _to_datetime(input2, attr2, utc2) | as_datetime | as_local -%}
{%- if t1 is not none and t2 is not none -%}
{{- func(t1, t2) -}}
{%- else -%}
@ -1320,9 +1769,12 @@
{%- if uptime %}
{%- set value = _delta_seconds(now(), uptime) | int %}
{%- set seconds = value | abs %}
{%- set future = value / seconds > 0 %}
{%- set current = value == 0 %}
{%- set future = not current and value / seconds > 0 %}
{%- set items = _just_time(seconds, language, values, biggest, short=short, floor=floor) %}
{%- if future %}
{%- if current %}
{{- items }}
{%- elif future %}
{{- translate('in', language=language) }} {{ items }}
{%- else %}
{%- set t = translate('ago', language=language) %}
@ -1411,6 +1863,16 @@
{{- _next_weekday(weekday, -7) }}
{%- endmacro %}
{%- macro nearest_day(weekday) %}
{%- set today_timestamp = as_timestamp(today_at())|int %}
{%- set this_weekday_timestamp = as_timestamp(this_weekday(weekday))|int %}
{%- if today_timestamp < this_weekday_timestamp %}
{{- _next_weekday(weekday, 0) }}
{%- else %}
{{- _next_weekday(weekday, 7) }}
{%- endif %}
{%- endmacro %}
{%- macro days_in_month(month=None) %}
{%- set today = today_at() %}
{%- set input = month if month is not none else today.month %}
@ -1527,30 +1989,36 @@
{%- endif -%}
{%- endmacro -%}
{%- macro month(month=None, language=None) %}
{%- macro month(month=None, language=None, short=False) %}
{%- if month is datetime %}
{%- set idx = month.month - 1 %}
{%- elif month is integer and month > 0 %}
{%- set idx = (month - 1) % 12 %}
{%- elif month | regex_match(valid_entity_id_pattern) %}
{%- set idx = (states(month) | as_datetime | as_local).month - 1 %}
{%- else %}
{%- set idx = now().month - 1 %}
{%- endif %}
{{- translate('months', index=idx, language=language) }}
{%- set ret = translate('months', index=idx, language=language) %}
{{- ret[:3] if short else ret }}
{%- endmacro %}
{%- macro weekday(weekday=None, language=None) %}
{%- macro weekday(weekday=None, language=None, short=False) %}
{%- if weekday is datetime %}
{%- set idx = weekday.weekday() %}
{%- elif weekday is integer and weekday > 0 %}
{%- set idx = (weekday - 1) % 7 %}
{%- elif weekday | regex_match(valid_entity_id_pattern) %}
{%- set idx = (states(weekday) | as_datetime | as_local).weekday() %}
{%- else %}
{%- set idx = now().weekday() %}
{%- endif %}
{{- translate('days', index=idx, language=language) }}
{%- set ret = translate('days', index=idx, language=language) %}
{{- ret[:3] if short else ret }}
{%- endmacro %}
{%- macro count_the_days(input, attr, utc=False) %}
{%- set input = _to_datetime(input, attr, utc) | as_datetime %}
{%- set input = _to_datetime(input, attr, utc) | as_datetime | as_local %}
{%- set midnight = today_at() %}
{{- (input - midnight).days }}
{%- endmacro %}
@ -1561,7 +2029,7 @@
{%- set ns = namespace(days=[]) %}
{%- for i in range(-7, 14) %}
{%- set prefix = translate('delta', 'last', language=language) ~ ' ' if i < -1 else translate('delta', 'next', language=language) ~ ' ' if i > 6 else '' %}
{%- set ns.days = ns.days + [ (i | string, prefix ~ _days.get(i, weekday(midnight.weekday() + i + 1, language))) ] %}
{%- set ns.days = ns.days + [ (i | string, prefix ~ _days.get(i, weekday(midnight.weekday() + (i % 7) + 1, language))) ] %}
{%- endfor %}
{%- set collection = dict.from_keys(ns.days) %}
{%- set days = count_the_days(input, attr, utc) %}
@ -1586,16 +2054,20 @@
{%- macro hour(hour, language=None) %}
{%- if hour is datetime %}
{%- set hour = hour.hour %}
{%- elif hour | regex_match(valid_entity_id_pattern) %}
{%- set hour = (states(hour) | as_datetime | as_local).hour %}
{%- endif %}
{%- set _12 = not (hour % 12) %}
{%- set _24 = not (hour % 24) %}
{%- set _12hr = translate('time','format') == '12-hr' %}
{%- if _12 and _24 and _12hr %}
{%- set use_twelve = translate('time_of_day', 'use_twelve', language=language, fallback=false) %}
{%- set _12hr = translate('time','format', language=language) == '12-hr' %}
{%- if _12 and _24 and _12hr and not use_twelve %}
{{- translate('time_of_day', 'midnight', language=language) }}
{%- elif _12 and _12hr %}
{%- elif _12 and _12hr and not use_twelve %}
{{- translate('time_of_day', 'noon', language=language) }}
{%- else %}
{{- hour % 12 if _12hr else hour }}
{%- set ret = hour % 12 if _12hr else hour %}
{{- 12 if ret == 0 and use_twelve else ret }}
{%- endif %}
{%- endmacro %}
@ -1617,7 +2089,22 @@
{%- set hour_phrase = hour(this_hour, language=language) %}
{%- set minute_phrase = _phrase('minute', 60 * this_minute, language, True, True) if this_minute % 5 else this_minute | string %}
{%- endif %}
{%- if this_minute in [0, 1, 15, 30, 45, 59] %}
{%- set this_config = translate('time_of_hour', language=language) %}
{%- if (16 <= this_minute <= 29 and 'to_half_hour' in this_config) or (31 <= this_minute <= 44 and 'past_half_hour' in this_config) or (this_minute == 30 and 'half_hour' in this_config) %}
{%- set hour_phrase = hour(this_hour + 1, language=language) %}
{%- if 16 <= this_minute <= 29 %}
{%- set minute_calc = 30 - this_minute %}
{%- set fmat = translate('time_of_hour', 'to_half_hour', language=language) %}
{%- set minute_phrase = _phrase('minute', 60 * minute_calc, language, True, True) if this_minute % 5 else minute_calc | string %}
{%- elif 31 <= this_minute <= 44 %}
{%- set minute_calc = this_minute - 30 %}
{%- set fmat = translate('time_of_hour', 'past_half_hour', language=language) %}
{%- set minute_phrase = _phrase('minute', 60 * minute_calc, language, True, True) if this_minute % 5 else minute_calc | string %}
{%- else %}
{%- set minute_calc = None %}
{%- set fmat = translate('time_of_hour', 'half_hour', language=language) %}
{%- endif %}
{%- elif this_minute in [0, 1, 15, 30, 45, 59] %}
{%- if hour_phrase in ['noon', 'midnight'] and this_minute == 0 %}
{%- set fmat = '{hour}' %}
{%- else %}

View File

@ -1,234 +1,342 @@
{#
set phrases to be used in the relative_time_period macro
one list item per language, each time fraction contains a list with the singular, plural and abbriviated phrase
one list item per language, each time fraction contains a list with the short and several long forms of time units
combine contains the text to combine the last time fraction, and error the text to display on wrong date input
Plural forms for languages: https://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms
asian: ja, vi, ko
english: en, de, nl, sv, da, no, nb, nn, fo, es, pt, it, bg, el, fi, et, he, eo, hu, tr, ca
french: pt_BR, fr
latvian: lv
irish: ga
romanian: ro
lithuanian: lv
russian: ru, uk, be, sr, hr
slovak: cs, sk
polish: pl
slovenian: sl
arabic: ar
#}
{%- set _time_period_phrases = [
{
'language': 'en',
'plural_form': 'english',
'phrases': {
'year': ['year', 'years', 'yr'],
'month': ['month', 'months', 'mth'],
'week': ['week', 'weeks', 'wk'],
'day': ['day', 'days', 'day'],
'hour': ['hour', 'hours', 'hr'],
'minute': ['minute', 'minutes', 'min'],
'second': ['second', 'seconds', 'sec'],
'millisecond': ['millisecond', 'milliseconds', 'ms'],
'year': ['yr', 'year', 'years'],
'month': ['mth', 'month', 'months'],
'week': ['wk', 'week', 'weeks'],
'day': ['day', 'day', 'days'],
'hour': ['hr', 'hour', 'hours'],
'minute': ['min', 'minute', 'minutes'],
'second': ['sec', 'second', 'seconds'],
'millisecond': ['ms', 'millisecond', 'milliseconds'],
'combine': 'and',
'error': 'Invalid date',
}
},
{
'language': 'pl',
'plural_form': 'polish',
'phrases': {
'year': ['rok', 'lat', 'r'],
'month': ['miesiąc', 'miesięcy', 'msc'],
'week': ['tydzień', 'tygodni', 'tyg'],
'day': ['dzień', 'dni', 'dzień'],
'hour': ['godzina', 'godzin', 'godz'],
'minute': ['minuta', 'minut', 'min'],
'second': ['sekunda', 'sekund', 'sek'],
'millisecond': ['milisekunda', 'milisekund', 'ms'],
'year': ['r', 'rok', 'lata', 'lat'],
'month': ['msc', 'miesiąc', 'miesiące', 'miesięcy'],
'week': ['tyg', 'tydzień', 'tygodnie', 'tygodni'],
'day': ['dzień', 'dzień', 'dni', 'dni'],
'hour': ['godz', 'godzina', 'godziny', 'godzin'],
'minute': ['min', 'minuta', 'minuty', 'minut'],
'second': ['sek', 'sekunda', 'sekundy', 'sekund'],
'millisecond': ['ms', 'milisekunda', 'milisekundy', 'milisekund'],
'combine': 'i',
'error': 'Niepoprawna data',
}
},
{
'language': 'fr',
'plural_form': 'french',
'phrases': {
'year': ['année', 'années', 'an'],
'year': ['an', 'année', 'années'],
'month': ['mois', 'mois', 'mois'],
'week': ['semaine', 'semaines', 'sem'],
'day': ['jour', 'jours', 'j'],
'hour': ['heure', 'heures', 'h'],
'minute': ['minute', 'minutes', 'min'],
'second': ['seconde', 'secondes', 'sec'],
'millisecond': ['milliseconde', 'millisecondes', 'ms'],
'week': ['sem', 'semaine', 'semaines'],
'day': ['j', 'jour', 'jours'],
'hour': ['h', 'heure', 'heures'],
'minute': ['min', 'minute', 'minutes'],
'second': ['sec', 'seconde', 'secondes'],
'millisecond': ['ms', 'milliseconde', 'millisecondes'],
'combine': 'et',
'error': 'Date non valide',
}
},
{
'language': 'it',
'plural_form': 'english',
'phrases': {
'year': ['anno', 'anni', 'aa'],
'month': ['mese', 'mesi', 'mm'],
'week': ['settimana', 'settimane', 'set'],
'day': ['giorno', 'giorni', 'gg'],
'hour': ['ora', 'ore', 'h'],
'minute': ['minuto', 'minuti', 'min'],
'second': ['secondo', 'secondi', 'sec'],
'millisecond': ['millisecondo', 'millisecondi', 'ms'],
'year': ['aa', 'anno', 'anni'],
'month': ['mm', 'mese', 'mesi'],
'week': ['set', 'settimana', 'settimane'],
'day': ['gg', 'giorno', 'giorni'],
'hour': ['h', 'ora', 'ore'],
'minute': ['min', 'minuto', 'minuti'],
'second': ['sec', 'secondo', 'secondi'],
'millisecond': ['ms', 'millisecondo', 'millisecondi'],
'combine': 'e',
'error': 'Data non valida',
}
},
{
'language': 'nb',
'plural_form': 'english',
'phrases': {
'year': ['år', 'år', 'år'],
'month': ['måned', 'måneder', 'mnd'],
'week': ['uke', 'uker', 'u'],
'day': ['dag', 'dager', 'd'],
'hour': ['time', 'timer', 't'],
'minute': ['minutt', 'minutter', 'min'],
'second': ['sekund', 'sekunder', 'sek'],
'millisecond': ['millisekund', 'millisekunder', 'ms'],
'month': ['mnd', 'måned', 'måneder'],
'week': ['u', 'uke', 'uker'],
'day': ['d', 'dag', 'dager'],
'hour': ['t', 'time', 'timer'],
'minute': ['min', 'minutt', 'minutter'],
'second': ['sek', 'sekund', 'sekunder'],
'millisecond': ['ms', 'millisekund', 'millisekunder'],
'combine': 'og',
'error': 'Ugyldig dato',
}
},
{
'language': 'nl',
'plural_form': 'english',
'phrases': {
'year': ['jaar', 'jaar', 'jr'],
'month': ['maand', 'maanden', 'mnd'],
'week': ['week', 'weken', 'wk'],
'day': ['dag', 'dagen', 'dg'],
'hour': ['uur', 'uur', 'u'],
'minute': ['minuut', 'minuten', 'min'],
'second': ['seconde', 'seconden', 'sec'],
'millisecond': ['milliseconde', 'milliseconden', 'ms'],
'year': ['jr', 'jaar', 'jaar'],
'month': ['mnd', 'maand', 'maanden'],
'week': ['wk', 'week', 'weken'],
'day': ['dg', 'dag', 'dagen'],
'hour': ['u', 'uur', 'uur'],
'minute': ['min', 'minuut', 'minuten'],
'second': ['sec', 'seconde', 'seconden'],
'millisecond': ['ms', 'milliseconde', 'milliseconden'],
'combine': 'en',
'error': 'Ongeldige datum',
}
},
{
'language': 'nn',
'plural_form': 'english',
'phrases': {
'year': ['år', 'år', 'år'],
'month': ['månad', 'månader', 'mnd'],
'week': ['veke', 'veker', 'v'],
'day': ['dag', 'dagar', 'd'],
'hour': ['time', 'timar', 't'],
'minute': ['minutt', 'minutt', 'min'],
'second': ['sekund', 'sekund', 'sek'],
'millisecond': ['millisekund', 'millisekund', 'ms'],
'month': ['mnd', 'månad', 'månader'],
'week': ['v', 'veke', 'veker'],
'day': ['d', 'dag', 'dagar'],
'hour': ['t', 'time', 'timar'],
'minute': ['min', 'minutt', 'minutt'],
'second': ['sek', 'sekund', 'sekund'],
'millisecond': ['ms', 'millisekund', 'millisekund'],
'combine': 'og',
'error': 'Ugyldig dato',
}
},
{
'language': 'de',
'plural_form': 'english',
'phrases': {
'year': ['Jahr', 'Jahre', 'J.'],
'month': ['Monat', 'Monate', 'M.'],
'week': ['Woche', 'Wochen', 'Wo.'],
'day': ['Tag', 'Tage', 'Tg.'],
'hour': ['Stunde', 'Stunden', 'Std.'],
'minute': ['Minute', 'Minuten', 'Min.'],
'second': ['Sekunde', 'Sekunden', 'Sek.'],
'millisecond': ['Millisekunde', 'Millisekunden', 'ms'],
'year': ['J.', 'Jahr', 'Jahre'],
'month': ['M.', 'Monat', 'Monate'],
'week': ['Wo.', 'Woche', 'Wochen'],
'day': ['Tg.', 'Tag', 'Tage'],
'hour': ['Std.', 'Stunde', 'Stunden'],
'minute': ['Min.', 'Minute', 'Minuten'],
'second': ['Sek.', 'Sekunde', 'Sekunden'],
'millisecond': ['ms', 'Millisekunde', 'Millisekunden'],
'combine': 'und',
'error': 'Falsches Datum',
}
},
{
'language': 'pt',
'plural_form': 'english',
'phrases': {
'year': ['ano', 'anos', 'aa'],
'month': ['mês', 'meses', 'mm'],
'week': ['semana', 'semanas', 'sem'],
'day': ['dia', 'dias', 'd'],
'hour': ['hora', 'horas', 'h'],
'minute': ['minuto', 'minutos', 'min'],
'second': ['segundo', 'segundos', 'seg'],
'millisecond': ['millissegundo', 'millissegundos', 'ms'],
'year': ['aa', 'ano', 'anos'],
'month': ['mm', 'mês', 'meses'],
'week': ['sem', 'semana', 'semanas'],
'day': ['d', 'dia', 'dias'],
'hour': ['h', 'hora', 'horas'],
'minute': ['min', 'minuto', 'minutos'],
'second': ['seg', 'segundo', 'segundos'],
'millisecond': ['ms', 'millissegundo', 'millissegundos'],
'combine': 'e',
'error': 'Data Inválida',
}
},
{
'language': 'dk',
'plural_form': 'english',
'phrases': {
'year': ['år', 'år', 'år'],
'month': ['måned', 'måneder', 'mnd'],
'week': ['uge', 'uger', 'uge'],
'day': ['dag', 'dage', 'dag'],
'hour': ['time', 'timer', 't.'],
'minute': ['minut', 'minuter', 'min.'],
'second': ['sekund', 'sekunder', 'sek.'],
'millisecond': ['millisekund', 'millisekunder', 'ms.'],
'month': ['mnd', 'måned', 'måneder'],
'week': ['uge', 'uge', 'uger'],
'day': ['dag', 'dag', 'dage'],
'hour': ['t.', 'time', 'timer'],
'minute': ['min.', 'minut', 'minuter'],
'second': ['sek.', 'sekund', 'sekunder'],
'millisecond': ['ms.', 'millisekund', 'millisekunder'],
'combine': 'og',
'error': 'Ugyldig dato',
}
},
{
'language': 'sv',
'plural_form': 'english',
'phrases': {
'year': ['år', 'år', 'år'],
'month': ['månad', 'månader', 'mån'],
'week': ['vecka', 'veckor', 'v'],
'day': ['dag', 'dagar', 'dag'],
'hour': ['timme', 'timmar', 'tim'],
'minute': ['minut', 'minuter', 'min'],
'second': ['sekund', 'sekunder', 'sek'],
'millisecond': ['millisekund', 'millisekunder', 'ms'],
'month': ['mån', 'månad', 'månader'],
'week': ['v', 'vecka', 'veckor'],
'day': ['dag', 'dag', 'dagar'],
'hour': ['tim', 'timme', 'timmar'],
'minute': ['min', 'minut', 'minuter'],
'second': ['sek', 'sekund', 'sekunder'],
'millisecond': ['ms', 'millisekund', 'millisekunder'],
'combine': 'och',
'error': 'Ogiltigt datum',
}
},
{
'language': 'cs',
'plural_form': 'slovak',
'phrases': {
'year': ['rok', 'roky', 'rok'],
'month': ['měsíc', 'měsíce', 'měs'],
'week': ['týden', 'týdny', 'týd'],
'day': ['den', 'dny', 'd'],
'hour': ['hodina', 'hodiny', 'hod'],
'minute': ['minuta', 'minuty', 'min'],
'second': ['sekunda', 'sekundy', 'sek'],
'millisecond': ['millisekunda', 'millisekundy', 'ms'],
'year': ['rok', 'rok', 'roky', 'let'],
'month': ['měs', 'měsíc', 'měsíce', 'měsíců'],
'week': ['týd', 'týden', 'týdny', 'týd'],
'day': ['d', 'den', 'dny', 'd'],
'hour': ['hod', 'hodina', 'hodiny', 'hodin'],
'minute': ['min', 'minuta', 'minuty', 'minut'],
'second': ['sek', 'sekunda', 'sekundy', 'sekund'],
'millisecond': ['ms', 'millisekunda', 'millisekundy', 'millisekund'],
'combine': 'a',
'error': 'špatný datum'
'error': 'špatné datum'
}
},
{
'language': 'fi',
'plural_form': 'english',
'phrases': {
'year': ['vuosi', 'vuotta', 'v'],
'month': ['kuukausi', 'kuukautta', 'kk'],
'week': ['viikko', 'viikkoa', 'vk'],
'day': ['päivä', 'päivää', 'pv'],
'hour': ['tunti', 'tuntia', 't'],
'minute': ['minuutti', 'minuuttia', 'min'],
'second': ['sekunti', 'sekuntia', 's'],
'millisecond': ['millisekunti', 'millisekuntia', 'ms'],
'year': ['v', 'vuosi', 'vuotta'],
'month': ['kk', 'kuukausi', 'kuukautta'],
'week': ['vk', 'viikko', 'viikkoa'],
'day': ['pv', 'päivä', 'päivää'],
'hour': ['t', 'tunti', 'tuntia'],
'minute': ['min', 'minuutti', 'minuuttia'],
'second': ['s', 'sekunti', 'sekuntia'],
'millisecond': ['ms', 'millisekunti', 'millisekuntia'],
'combine': 'ja',
'error': 'Väärä päivämäärä',
}
},
{
'language': 'ru',
'plural_form': 'russian',
'phrases': {
'year': ['год', 'года', 'г'],
'month': ['месяц', 'месяцы', 'м'],
'week': ['неделя', 'недели', 'н'],
'day': ['день', 'дни', 'д'],
'hour': ['час', 'часы', 'ч'],
'minute': ['минута', 'минут', 'м'],
'second': ['секунд', 'секунды', 'с'],
'millisecond': ['милисекунд', 'милисекунды', 'мс'],
'year': ['г', 'год', 'года', 'лет'],
'month': ['м', 'месяц', 'месяца', 'месяцев'],
'week': ['н', 'неделя', 'недели', 'недель'],
'day': ['д', 'день', 'дня', 'дней'],
'hour': ['ч', 'час', 'часа', 'часов'],
'minute': ['м', 'минута', 'минуты', 'минут'],
'second': ['с', 'секунда', 'секунды', 'секунд'],
'millisecond': ['мс', 'милисекунда', 'милисекунды', 'милисекунд'],
'combine': 'и',
'error': 'Неверная дата',
}
},
{
'language': 'uk',
'plural_form': 'russian',
'phrases': {
'year': ['рік', 'років', 'р'],
'month': ['місяць', 'місяців', 'м'],
'week': ['тиждень', 'тижнів', 'тижд'],
'day': ['день', 'днів', 'дн'],
'hour': ['годину', 'годин', 'год'],
'minute': ['хвилину', 'хвилин', 'хв'],
'second': ['секунду', 'секунд', 'сек'],
'millisecond': ['мілісекунду', 'мілісекунд', 'мсек'],
'year': ['р', 'рік', 'роки', 'років'],
'month': ['м', 'місяць', 'місяці', 'місяців'],
'week': ['тижд', 'тиждень', 'тижні', 'тижнів'],
'day': ['дн', 'день', 'дні', 'днів'],
'hour': ['год', 'година', 'години', 'годин'],
'minute': ['хв', 'хвилина', 'хвилини', 'хвилин'],
'second': ['сек', 'секунда', 'секунди', 'секунд'],
'millisecond': ['мсек', 'мілісекунда', 'мілісекунди', 'мілісекунд'],
'combine': 'та',
'error': 'Недійсна дата',
}
},
{
'language': 'bg',
'plural_form': 'english',
'phrases': {
'year': ['г', 'година', 'години'],
'month': ['м', 'месец', 'месеца'],
'week': ['седм', 'седмица', 'седмици'],
'day': ['д', 'ден', 'дни'],
'hour': ['ч', 'час', 'часа'],
'minute': ['м', 'минута', 'минути'],
'second': ['с', 'секунда', 'секунди'],
'millisecond': ['мс', 'милисекунда', 'милисекунди'],
'combine': 'и',
'error': 'Невалидна дата',
}
},
{
'language': 'vi',
'plural_form': 'asian',
'phrases': {
'year': ['y', 'năm'],
'month': ['m', 'tháng'],
'week': ['w', 'tuần'],
'day': ['d', 'ngày'],
'hour': ['h', 'giờ'],
'minute': ['m', 'phút', 'phút'],
'second': ['s', 'giây'],
'millisecond': ['ms', 'mili giây'],
'combine': 'và',
'error': 'Ngày không hợp lệ',
}
},
{
'language': 'es',
'plural_form': 'english',
'phrases': {
'year': ['a', 'año', 'años'],
'month': ['m', 'mes', 'meses'],
'week': ['sem', 'semana', 'semanas'],
'day': ['d', 'día', 'días'],
'hour': ['h', 'hora', 'horas'],
'minute': ['min', 'minuto', 'minutos'],
'second': ['s', 'segundo', 'segundos'],
'millisecond': ['ms', 'milisegundo', 'milisegundos'],
'combine': 'y',
'error': 'Fecha inválida',
}
},
{
'language': 'he',
'plural_form': 'english',
'phrases': {
'year': ['שנה', 'שנה', 'שנים'],
'month': ['חודש', 'חודש', 'חודשים'],
'week': ['שבוע', 'שבוע', 'שבועות'],
'day': ['יום', 'יום', 'ימים'],
'hour': ['שעה', 'שעה', 'שעות'],
'minute': ['דקה', 'דקה', 'דקות'],
'second': ['שניה', 'שניה', 'שניות'],
'millisecond': ['מילי', 'מילישניה', 'מילישניות'],
'combine': 'ו',
'error': 'תאריך לא חוקי',
}
},
{
'language': 'hu',
'plural_form': 'english',
'phrases': {
'year': ['é', 'év', 'év'],
'month': ['hó', 'hónap', 'hónap'],
'week': ['hét', 'hét', 'hét'],
'day': ['n', 'nap', 'nap'],
'hour': ['ó', 'óra', 'óra'],
'minute': ['p', 'perc', 'perc'],
'second': ['mp', 'másodperc', 'másodperc'],
'millisecond': ['ms', 'ezredmásodperc', 'ezredmásodperc'],
'combine': 'és',
'error': 'Érvénytelen dátum',
}
},
] -%}
{# macro to convert the abbreviated input for the not_use and always_show lists to the full time part names #}
@ -256,6 +364,8 @@
{%- set compare_date = compare_date if compare_date is datetime else compare_date | as_datetime('invalid') -%}
{%- set time = time | bool(true) -%}
{%- set parts = [parts | int(1), always_show | count] | max -%}
{# create namespace to store debug data #}
{%- set debug = namespace(debug="") -%}
{# 1: check if date input is correct #}
{%- if date is datetime and compare_date is datetime -%}
{# convert date input to local or date only #}
@ -354,7 +464,7 @@
{%- set first = keys | select('in', always_show | default([], true) + [first]) | first -%}
{%- set to_use = keys[keys.index(first):] -%}
{%- set to_output = to_use[:parts] -%}
{%- set last = to_output | last |default('millisecond') -%}
{%- set last = dur.items() | selectattr('0', 'in', to_output) | map(attribute='0') | list | last | default('millisecond') -%}
{# 3: check if there is anything left to use #}
{%- if to_use -%}
{%- set to_output = to_use[:parts] -%}
@ -365,9 +475,10 @@
{%- set to_reject = to_use | reject('in', to_output) | reject('in', always_show) | list -%}
{%- set not_use = not_use + to_output[as_check*-1:] + to_reject -%}
{%- set to_output = to_output | reject('in', not_use) | list + always_show -%}
{%- set to_output = keys | select('in', to_output) | list -%}
{%- set to_output = keys | select('in', to_output) | list + ['extra']-%}
{%- set output = time_split(date, parts, compare_date, not_use, always_show, time, round_mode) | from_json -%}
{%- endif -%}
{# apply round if needed #}
{%- if round_mode in ['common', 'ceil'] and last != 'millisecond' -%}
{# determine first and last item with data #}
@ -376,22 +487,59 @@
{%- set remain_part = remain / dur[last] -%}
{%- set to_round = 1 if remain_part >= 0.5 and round_mode == 'common' else remain_part | round(0, round_mode) -%}
{%- set sec_to_add = ((dur[last] + (dur.day if last in ['year', 'month'] else 1) - remain) | round(0, 'ceil') * to_round) / 1000 -%}
{%- set round_mode = 'floor' -%}
{%- set date_max = [compare_date, date] | max + timedelta(seconds=sec_to_add) -%}
{%- set date_min = [compare_date, date] | min -%}
{%- set output = time_split(date_max, parts, date_min, not_use, always_show, time, round_mode) | from_json -%}
{%- set output = time_split(date_max, parts, date_min, not_use, always_show, time, 'floor') | from_json -%}
{%- set output = dict(output.items() | selectattr('0', 'in', do_use)) -%}
{%- set keys = output.keys() | list -%}
{%- set with_value = output.items() | rejectattr('1', 'eq', 0) | map(attribute='0') | list -%}
{%- set first = with_value | first | default('millisecond') -%}
{%- set first = keys | select('in', always_show | default([], true) + [first]) | first -%}
{%- set to_use = keys[keys.index(first):] -%}
{%- set to_output = to_use[:parts] -%}
{%- endif -%}
{# output result #}
{%- set zero_values = output.items() | selectattr('1', 'eq', 0) | map(attribute='0') | list -%}
{%- set reject_list = zero_values | reject('in', always_show) | list -%}
{{- dict(output.items() | selectattr('0', 'in', to_output) | rejectattr('0', 'in', reject_list)) | default({always_return: 0}, true) | to_json -}}
{%- else -%} {{- dict(error='No time parts left to output') | to_json -}}
{{- dict(output.items() | selectattr('0', 'in', to_output) | rejectattr('0', 'in', reject_list), **dict(debug=debug.debug) if debug.debug else dict()) | default({always_return: 0}, true) | to_json-}}
{%- else -%} {{- dict(error='No time parts left to output') -}}
{%- endif -%} {# 3 #}
{%- endif -%} {# 2 #}
{%- else -%} {{- dict(error='Invalid date input') | to_json -}}
{%- else -%} {{- dict(error='Invalid date input')-}}
{%- endif -%} {# 1 #}
{%- endmacro -%}
{# macro for determining the time unit variant depending on the language #}
{%- macro plural(number=0, rule='english') -%}
{%- set mod100 = number % 100 -%}
{%- set mod10 = number % 10 -%}
{%- set form = 1 -%}
{%- if rule == 'english' -%}
{%- set form = 1 if number == 1 else 2 -%}
{%- elif rule == 'french' -%}
{%- set form = 1 if number <= 1 else 2 -%}
{%- elif rule == 'latvian' -%}
{%- set form = 1 if (mod10 == 1 and mod100 != 11) else 2 if number != 0 else 3 -%}
{%- elif rule == 'irish' -%}
{%- set form = 1 if number == 1 else 2 if number == 2 else 3 -%}
{%- elif rule == 'romanian' -%}
{%- set form = 1 if number == 1 else 2 if (number == 0 or (mod100 > 0 and mod100 < 20 )) else 3 -%}
{%- elif rule == 'lithuanian' -%}
{%- set form = 1 if (mod10 == 1 and mod100 != 11) else 2 if (mod10 >= 2 and (mod100 < 10 or mod100 >= 20)) else 3 -%}
{%- elif rule == 'russian' -%}
{%- set form = 1 if (mod10 == 1 and mod100 != 11) else 2 if (mod10 >= 2 and mod10 <= 4 and (mod100 < 10 or mod100 >= 20)) else 3 -%}
{%- elif rule == 'slovak' -%}
{%- set form = 1 if number == 1 else 2 if (number >= 2 and number <= 4) else 3 -%}
{%- elif rule == 'polish' -%}
{%- set form = 1 if number == 1 else 2 if (mod10 >= 2 and mod10 <= 4 and (mod100 < 10 or mod100 >= 20)) else 3 -%}
{%- elif rule == 'slovenian' -%}
{%- set form = 1 if mod100 == 1 else 2 if mod100 == 2 else 3 if (mod100 == 3 or mod100 == 4) else 4 -%}
{%- elif rule == 'arabic' -%}
{%- set form = 1 if number == 0 else 2 if number == 1 else 3 if number == 2 else 4 if (mod100 >= 3 and mod100 <= 10) else 5 if mod100 >= 11 else 6 -%}
{%- endif -%}
{{- form -}}
{%- endmacro -%}
{# macro to output a timedelta in a readable format #}
{%- macro relative_time_plus(date, parts=1, abbr=false, language='en', compare_date=now(), not_use=['millisecond'], always_show=[], time=true, round_mode='floor') -%}
{#- select correct phrases bases on language input #}
@ -399,6 +547,7 @@
{%- set languages = phrases | map(attribute='language') | list -%}
{%- set language = iif(language in languages, language, 'en') -%}
{%- set phr = phrases | selectattr('language', 'eq', language) | map(attribute='phrases') | list | first -%}
{%- set plural_form = phrases | selectattr('language', 'eq', language) | map(attribute='plural_form') | list | first -%}
{%- set abbr = abbr | bool(false) -%}
{# split timedelta #}
{%- set time_parts = time_split(date, parts, compare_date, not_use, always_show, time, round_mode) | from_json -%}
@ -409,9 +558,9 @@
{# convert to phrases #}
{%- set ns = namespace(phrases=[]) -%}
{%- for i in time_parts.keys() -%}
{%- set phr_abbr = phr[i][2] -%}
{%- set phr_verb = phr[i][1] if time_parts[i] != 1 else phr[i][0] -%}
{%- set phrase = '{} {}'.format(time_parts[i], phr_abbr if abbr else phr_verb) -%}
{%- set plural_variant = plural(time_parts[i], plural_form) | int -%}
{%- set phr_form = phr[i][0] if abbr else phr[i][plural_variant] -%}
{%- set phrase = '{} {}'.format(time_parts[i], phr_form) -%}
{%- set ns.phrases = ns.phrases + [phrase] -%}
{%- endfor -%}
{#- join phrases in a string, using phr.combine for the last item #}

View File

@ -12,12 +12,49 @@
{% endif %}
{% endmacro %}
{% macro period_str(team) %}
{% if state_attr(team,'league') in ['NFL','NCAAF'] %}
quarter
{% elif state_attr(team,'league') == 'MLB' %}
inning
{% else %}
period
{% endif %}
{% endmacro %}
{% macro sports_clock(team) %}
{% macro data() %}
{% set period_str = period_str(team) %}
{% set game_clock = state_attr(team,'clock') | lower %}
{% if state_attr(team,'league') == 'MLB' %}
{% set inning_parts = game_clock.split(' ') %}
in the {{ inning_parts[0] ~ ' of the ' ~ inning_parts[1] ~ ' ' ~ period_str }}
{% else %}
{% if ' - ' in game_clock %}
{% set clock_time, quarter = game_clock.split(' - ') %}
{% if quarter == 'ot' %}
with {{ clock_time ~ ' remaining in overtime' }}
{% else %}
with {{ clock_time ~ ' remaining in the ' ~ quarter ~ ' ' ~ period_str }}
{% endif %}
{% endif %}
{% endif %}
{% endmacro %}
{{ cleanup(data()) }}
{% endmacro %}
{% macro sports_pregame(team) %}
{% macro data() %}
{% if state_attr(team,'opponent_name') %}
{% set opponent_name = state_attr(team, 'opponent_name') %}
{% if opponent_name.endswith(' St') %}
{% set opponent_name = opponent_name | replace(' St', ' State') %}
{% endif %}
{% endif %}
{% if is_state(team,'PRE') %}
{% set date = state_attr(team,'date') | as_timestamp | timestamp_custom('%m-%d') %}
{% if date == now().strftime('%m-%d') %}
The {{ state_attr(team,'friendly_name') }} will be playing today against {% if state_attr(team,'league') != 'NCAAF'%}the{% endif %} {{ state_attr(team,'opponent_name') }} at {{ state_attr(team,'venue') }}.
The {{ state_attr(team,'friendly_name') }} will be playing today against {% if state_attr(team,'league') != 'NCAAF'%}the{% endif %} {{ opponent_name }} at {{ state_attr(team,'venue') }}.
{{ sports_str(team,'start') }} is at {{ state_attr(team,'date') | as_timestamp | timestamp_custom('%I:%M %p') }}.
{% endif %}
{% endif %}
@ -27,6 +64,12 @@
{% macro sports_main(team) %}
{% macro data() %}
{% if state_attr(team,'opponent_name') %}
{% set opponent_name = state_attr(team, 'opponent_name') %}
{% if opponent_name.endswith(' St') %}
{% set opponent_name = opponent_name | replace(' St', ' State') %}
{% endif %}
{% endif %}
{% if is_state(team,'POST') %}
{% set date = state_attr(team,'date') | as_timestamp | timestamp_custom('%m-%d') %}
{% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %}
@ -34,11 +77,11 @@
{% if state_attr(team,'clock') in ['postponed','Postponed'] %}
The {{ state_attr(team,'friendly_name') }} had their game postponed today, and it will be played at a later date.
{% elif (state_attr(team,'team_score') | int) == state_attr(team,'opponent_score') | int %}
The {{ state_attr(team,'friendly_name') }} tied in their game today against {% if state_attr(team,'league') != 'NCAAF'%}the{% endif %} {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}.
The {{ state_attr(team,'friendly_name') }} tied in their game today against {% if state_attr(team,'league') != 'NCAAF'%}the{% endif %} {{ opponent_name }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}.
{% elif state_attr(team,'team_winner') == true %}
The {{ state_attr(team,'friendly_name') }} won their game today against {% if state_attr(team,'league') != 'NCAAF'%}the{% endif %} {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}.
The {{ state_attr(team,'friendly_name') }} won their game today against {% if state_attr(team,'league') != 'NCAAF'%}the{% endif %} {{ opponent_name }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}.
{% elif state_attr(team,'opponent_winner') == true %}
The {{ state_attr(team,'friendly_name') }} lost their game today against {% if state_attr(team,'league') != 'NCAAF'%}the{% endif %} {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'opponent_score') }} to {{ state_attr(team,'team_score') }}.
The {{ state_attr(team,'friendly_name') }} lost their game today against {% if state_attr(team,'league') != 'NCAAF'%}the{% endif %} {{ opponent_name }} by a score of {{ state_attr(team,'opponent_score') }} to {{ state_attr(team,'team_score') }}.
{% endif %}
{% if state_attr(team,'clock') not in ['postponed','Postponed'] %}
This brings their record to {{ state_attr(team,'team_record') | replace("-"," and ") }} on the season.
@ -47,11 +90,11 @@
{% if state_attr(team,'clock') in ['postponed','Postponed'] %}
The {{ state_attr(team,'friendly_name') }} had their game postponed yesterday, and it will be played at a later date.
{% elif (state_attr(team,'team_score') | int) == state_attr(team,'opponent_score') | int %}
The {{ state_attr(team,'friendly_name') }} tied in their game yesterday against {% if state_attr(team,'league') != 'NCAAF'%}the{% endif %} {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}.
The {{ state_attr(team,'friendly_name') }} tied in their game yesterday against {% if state_attr(team,'league') != 'NCAAF'%}the{% endif %} {{ opponent_name }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}.
{% elif state_attr(team,'team_winner') == true %}
The {{ state_attr(team,'friendly_name') }} won their game yesterday against {% if state_attr(team,'league') != 'NCAAF'%}the{% endif %} {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}.
The {{ state_attr(team,'friendly_name') }} won their game yesterday against {% if state_attr(team,'league') != 'NCAAF'%}the{% endif %} {{ opponent_name }} by a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}.
{% elif state_attr(team,'opponent_winner') == true %}
The {{ state_attr(team,'friendly_name') }} lost their game yesterday against {% if state_attr(team,'league') != 'NCAAF'%}the{% endif %} {{ state_attr(team,'opponent_name') }} by a score of {{ state_attr(team,'opponent_score') }} to {{ state_attr(team,'team_score') }}.
The {{ state_attr(team,'friendly_name') }} lost their game yesterday against {% if state_attr(team,'league') != 'NCAAF'%}the{% endif %} {{ opponent_name }} by a score of {{ state_attr(team,'opponent_score') }} to {{ state_attr(team,'team_score') }}.
{% endif %}
{% if state_attr(team,'clock') not in ['postponed','Postponed'] %}
This brings their record to {{ state_attr(team,'team_record') | replace("-"," and ") }} on the season.
@ -59,11 +102,11 @@
{% endif %}
{% elif is_state(team,'IN') %}
{% if (state_attr(team,'team_score') | int) == (state_attr(team,'opponent_score') | int) %}
The {{ state_attr(team,'friendly_name') }} are currently tied in their game against {% if state_attr(team,'league') != 'NCAAF'%}the{% endif %} {{ state_attr(team,'opponent_name') }} with a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}.
The {{ state_attr(team,'friendly_name') }} are currently tied in their game against {% if state_attr(team,'league') != 'NCAAF'%}the{% endif %} {{ opponent_name }} with a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }} {{ sports_clock(team) }}.
{% elif (state_attr(team,'team_score') | int) > (state_attr(team,'opponent_score') | int) %}
The {{ state_attr(team,'friendly_name') }} are currently winning their game against {% if state_attr(team,'league') != 'NCAAF'%}the{% endif %} {{ state_attr(team,'opponent_name') }} with a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }}.
The {{ state_attr(team,'friendly_name') }} are currently winning their game against {% if state_attr(team,'league') != 'NCAAF'%}the{% endif %} {{ opponent_name }} with a score of {{ state_attr(team,'team_score') }} to {{ state_attr(team,'opponent_score') }} {{ sports_clock(team) }}.
{% else %}
The {{ state_attr(team,'friendly_name') }} are currently losing their game against {% if state_attr(team,'league') != 'NCAAF'%}the{% endif %} {{ state_attr(team,'opponent_name') }} with a score of {{ state_attr(team,'opponent_score') }} to {{ state_attr(team,'team_score') }}.
The {{ state_attr(team,'friendly_name') }} are currently losing their game against {% if state_attr(team,'league') != 'NCAAF'%}the{% endif %} {{ opponent_name }} with a score of {{ state_attr(team,'opponent_score') }} to {{ state_attr(team,'team_score') }} {{ sports_clock(team) }}.
{% endif %}
{% endif %}
{% endmacro %}

View File

@ -474,11 +474,10 @@
{% endif %}
{% if is_state('input_boolean.kallen_alternate_pickup','on') %}
{{ states('input_text.kallen_pickup') }} will be picking Collin up from school today.
{% else %}
Pickup today will be at {{ input_datetime_read('input_datetime.kallen_school_day_end') | trim }}.
{% if is_state('input_boolean.kallen_school_early_release','on') %}
And It is early release!
Today is an early release day!
{% endif %}
Pickup today will be at {{ input_datetime_read('input_datetime.kallen_school_day_end') | trim }}.
{% endif %}
{% if states('sensor.windows_open') | int > 0 %}
'I detect that there are windows open. Make sure you close them before you leave, or else the security system will not arm. '
@ -544,11 +543,12 @@
{% endif %}
{% if is_state('input_boolean.kallen_alternate_pickup','on') %}
{{ states('input_text.kallen_pickup') }} will be picking him up from school today.
{% elif is_state('input_boolean.kallen_school_early_release','on') %}
{% if is_state('input_boolean.kallen_school_early_release','on') %}
The school is on an early release schedule, pickup is at {{ input_datetime_read('input_datetime.kallen_school_day_end') | trim }}.
{% else %}
His pickup time is {{ input_datetime_read('input_datetime.kallen_school_day_end') | trim }}.
{% endif %}
{% endif %}
{% else %}
{{ identKallen }} has school at {{ input_datetime_read('input_datetime.kallen_school_day_start') | trim }} today.
{% endif %}

View File

@ -4,9 +4,9 @@
{% macro weatherInfo(type,method,time) %}
{% set time = time|default('day') %}
{% if method == 'text' %}
{% if method in ['text','dashboard'] %}
{% if type in ['current','full'] %}
The current weather is {{ states('weather.iron_nerd_weather_station') | lower }}. It is {{ state_attr('weather.iron_nerd_weather_station','temperature') | round }} degrees outside and feels like {{ states('sensor.stratton_ave_apparent_temperature') | round }} degrees.
The current weather is {{ states('weather.iron_nerd_weather_station') | lower }}. It is {{ state_attr('weather.iron_nerd_weather_station','temperature') | round }} degrees outside and feels like {{ states('sensor.home_temperature_feels_like') | round }} degrees.
{% endif %}
{% if type in ['forecast','full'] %}
{% if 14400 <= ct <= 61200 %}
@ -19,9 +19,21 @@
{% if type in ['alerts','full'] %}
{% if is_state('input_boolean.tornado_alarm','on') %}
We are under a tornado warning. If you are not already in shelter, you should be. Get on it!
{% elif states('sensor.weatheralerts_active_alerts') > '0' %}
{% if state_attr('binary_sensor.tornado_warning','confirmed' == true) %}
A tornado has been confirmed in the area. Please take shelter immediately!
{% endif %}
{% elif is_state('binary_sensor.severe_thunderstorm_warning','on') %}
We are under a severe thunderstorm warning.
{% if state_attr('binary_sensor.severe_thunderstorm_warning','tornado_possible' == true) %}
The incoming storm has the potential to produce a tornado, so please pay attention and prepare to take shelter!
{% endif %}
{% if state_attr('binary_sensor.severe_thunderstorm_warning','considerable_destructive' == true) %}
This storm has the potential to cause considerable damage. Please take shelter and stay safe!
{% endif %}
{% elif states('sensor.weatheralerts_active_alerts') > '0' and method != 'dashboard' %}
Current weather alerts: {{ states('sensor.weather_alert_string') }}.
{% endif %}
{% if method != 'dashboard' %}
{% if is_state('binary_sensor.lightning_warning','on') %}
{% set ltgdist = (states('sensor.blitzortung_lightning_distance') | int) / 1.609 | round %}
There is lightning in the area. Nearest strike is {{ ltgdist }} miles away.
@ -29,6 +41,7 @@
{% if is_state('binary_sensor.raining','on') %}
It is currently raining. Make sure all doors and windows are closed!
{% endif %}
{% endif %}
{% if state_attr('weather.iron_nerd_weather_station','visibility') | int < 3 %}
Caution: Current outdoor visibility is {{ state_attr('weather.iron_nerd_weather_station','visibility') }} miles.
{% endif %}
@ -47,6 +60,17 @@
{% endif %}
{% if is_state('input_boolean.tornado_alarm','on') %}
"We are under a tornado warning. If you are not already in shelter, you should be. Get on it! "
{% if state_attr('binary_sensor.tornado_warning','confirmed' == true) %}
"A tornado has been confirmed in the area. Please take shelter immediately! "
{% endif %}
{% elif is_state('binary_sensor.severe_thunderstorm_warning','on') %}
"We are under a severe thunderstorm warning. "
{% if state_attr('binary_sensor.severe_thunderstorm_warning','tornado_possible' == true) %}
"The incoming storm has the potential to produce a tornado, so please pay attention and prepare to take shelter! "
{% endif %}
{% if state_attr('binary_sensor.severe_thunderstorm_warning','considerable_destructive' == true) %}
"This storm has the potential to cause considerable damage. Please take shelter and stay safe! "
{% endif %}
{% elif is_state('input_boolean.tornado_watch','on') %}
{{ [
"There is currently a tornado watch active. Please keep an eye on the sky and your local weather reports. ",
@ -101,7 +125,11 @@
{% macro weatherReport(type,method,time) %}
{% macro data() %}
{{ weatherInfo(type,method,time) | replace('clear-night','clear') | replace('partlycloudy','partly cloudy') }}
{{ weatherInfo(type,method,time) |
replace('clear-night','clear') |
replace('partlycloudy','partly cloudy') |
replace('snowy-rainy','a mix of rain and snow') |
replace('lightning-rainy','stormy') }}
{% endmacro %}
{{ cleanup(data()) }}
{% endmacro %}

View File

@ -11,6 +11,7 @@ report_type:
options:
- Bug Report
- New Idea
- Adjustment
initial: Bug Report
icon: mdi:bug
select_testing:

View File

@ -283,7 +283,6 @@ script:
- light.living_room_color_1
- light.living_room_color_2
- light.living_room_color_3
- light.tina_desk_strip
- light.tina_lamp_side
- light.tina_lamp_top
- light.mud_room_overhead
@ -320,7 +319,6 @@ script:
entity_id:
- light.living_room_lights
- light.tina_lamp
- light.tina_desk_strip
- light.basement_studio_lights
data:
color_name: >

View File

@ -0,0 +1,4 @@
input_boolean:
do_not_enter_basement_studio:
name: Do Not Enter - Basement Studio
icon: mdi:minus-circle

View File

@ -1,20 +1,24 @@
template:
- binary_sensor:
- name: Emma Aircon - Compressor
- name: Emma Bedroom Aircon - Compressor
unique_id: 21bcbb62-823c-43ff-8c2c-26e940324ee6
state: "{{ is_state('fan.emma_air_conditioner','on') and states('sensor.emma_air_conditioner_power') | int > 150 }}"
state: "{{ states('sensor.emma_bedroom_aircon_power') | int > 150 }}"
availability: "{{ states('climate.emma_bedroom_aircon') not in ['unknown','unavailable'] }}"
device_class: running
- name: Emma Aircon - Fan
- name: Emma Bedroom Aircon - Fan
unique_id: 9e3054cf-8f7e-4fef-9da4-5b2f2bc99c9d
state: "{{ is_state('fan.emma_air_conditioner','on') and states('sensor.emma_air_conditioner_power') | int > 20 }}"
state: "{{ states('sensor.emma_bedroom_aircon_power') | int > 20 }}"
availability: "{{ states('climate.emma_bedroom_aircon') not in ['unknown','unavailable'] }}"
device_class: running
- name: Master Bedroom Aircon - Compressor
unique_id: 87051957-1dbc-4d65-b138-e8469728f58f
state: "{{ states('climate.master_bedroom_aircon') not in ['off','unknown','unavailable'] and states('sensor.master_bedroom_aircon_power') | int > 150 }}"
state: "{{ states('sensor.master_bedroom_aircon_power') | int > 150 }}"
availability: "{{ states('climate.master_bedroom_aircon') not in ['unknown','unavailable'] }}"
device_class: running
- name: Master Bedroom Aircon - Fan
unique_id: ae893dd6-129c-4886-a966-a89b958d9f08
state: "{{ states('climate.master_bedroom_aircon') not in ['off','unknown','unavailable'] and states('sensor.master_bedroom_aircon_power') | int > 20 }}"
state: "{{ states('sensor.master_bedroom_aircon_power') | int > 20 }}"
availability: "{{ states('climate.master_bedroom_aircon') not in ['unknown','unavailable'] }}"
device_class: running
- name: Kallen Fan - Separate Schedule
unique_id: 3f243861-6a1f-412f-b9e3-933b54793b08
@ -112,16 +116,6 @@ template:
unique_id: 2ce31844-b115-42b8-8213-feccf24e236c
state: "{{ state_attr('climate.master_bedroom_aircon','temperature') | float }}"
availability: "{{ states('climate.master_bedroom_aircon') not in ['unavailable','unknown'] }}"
- name: "Master Bedroom Eco Mode"
unique_id: edf36e23-adcf-4506-80eb-a14f4ea2fce0
state: "{{ is_state_attr('climate.master_bedroom_aircon','preset_mode','eco') }}"
icon: >-
{% if is_state_attr('climate.master_bedroom_aircon','preset_mode','eco') %}
mdi:home-lightning-bolt
{% else %}
mdi:home-lightning-bolt-outline
{% endif %}
availability: "{{ states('climate.master_bedroom_aircon') not in ['unavailable','unknown'] }}"
- name: "Master Bedroom Aircon Fan Mode"
unique_id: c0e4f9ba-0c6c-4673-9a75-13f253f2f2e8
state: "{{ state_attr('climate.master_bedroom_aircon','fan_mode') }}"
@ -138,6 +132,26 @@ template:
mdi:fan-off
{% endif %}
availability: "{{ states('climate.master_bedroom_aircon') not in ['unavailable','unknown'] }}"
- name: "Emma Bedroom Target Temp"
unique_id: b81152a1-d4d9-4e3e-8a78-6039de2884ad
state: "{{ state_attr('climate.emma_bedroom_aircon','temperature') | float }}"
availability: "{{ states('climate.emma_bedroom_aircon') not in ['unavailable','unknown'] }}"
- name: "Emma Bedroom Aircon Fan Mode"
unique_id: d678eb2e-be5b-4626-913d-fc1e32941ead
state: "{{ state_attr('climate.emma_bedroom_aircon','fan_mode') }}"
icon: >
{% if is_state_attr('climate.emma_bedroom_aircon','fan_mode','Auto') %}
mdi:fan-auto
{% elif is_state_attr('climate.emma_bedroom_aircon','fan_mode','Low') %}
mdi:fan-speed-1
{% elif is_state_attr('climate.emma_bedroom_aircon','fan_mode','Medium') %}
mdi:fan-speed-2
{% elif is_state_attr('climate.emma_bedroom_aircon','fan_mode','High') %}
mdi:fan-speed-3
{% else %}
mdi:fan-off
{% endif %}
availability: "{{ states('climate.emma_bedroom_aircon') not in ['unavailable','unknown'] }}"
- name: Living Room Average Temperature
unique_id: c4a901a6-87e2-4257-b60b-2944be8fdf04
state: >
@ -183,16 +197,17 @@ input_boolean:
master_bedroom_climate_protocol:
name: Master Bedroom Climate Protocol
icon: mdi:lightbulb-night
emma_bedroom_climate_protocol:
name: Emma Bedroom Climate Protocol
icon: mdi:lightbulb-night
kallen_bedtime_protocol:
name: Kallen Bedtime Protocol
icon: mdi:lightbulb-night
# Turn on when master bedroom air conditioner is installed, turn off in winter when we take it out, for smarter automations
# Turn on when air conditioners are installed, turn off in winter when we take them out
master_bedroom_aircon_installed:
name: Master Bedroom Aircon Installed
icon: mdi:tools
# Same thing, but for Emma's bedroom air conditioner
emma_bedroom_aircon_installed:
name: Emma Bedroom Aircon Installed
icon: mdi:tools
@ -201,6 +216,9 @@ input_boolean:
master_bedroom_cooling_on:
name: Master Bedroom Cooling On
icon: mdi:snowflake
emma_bedroom_cooling_on:
name: Emma Bedroom Cooling On
icon: mdi:snowflake
# Activated if the day will be excessively hot. For use with automations for daytime climate control.
hot_day:
@ -243,6 +261,7 @@ input_select:
name: Scheduled Climate Mode - Emma Bedroom
options:
- AC
- Fan
- Heat
- White Noise
- N/A
@ -305,13 +324,55 @@ input_number:
step: 1
unit_of_measurement: °F
icon: mdi:thermometer
emma_aircon_threshold:
name: Emma Aircon Threshold
emma_bedroom_daytime_temp:
name: Emma Bedroom Daytime Temp
min: 65
max: 80
step: 1
unit_of_measurement: °F
icon: mdi:thermometer
emma_bedroom_night_temp:
name: Emma Bedroom Night Temp
min: 65
max: 80
step: 1
unit_of_measurement: °F
icon: mdi:thermometer
emma_bedroom_bedtime_temp:
name: Emma Bedroom Bedtime Temp
min: 65
max: 80
step: 1
unit_of_measurement: °F
icon: mdi:thermometer
emma_bedroom_aircon_run_threshold:
name: Emma Bedroom Aircon Run Threshold
min: 40
max: 80
step: 1
unit_of_measurement: °F
icon: mdi:thermometer
emma_bedroom_aircon_mode_threshold:
name: Emma Bedroom Aircon Mode Threshold
min: 40
max: 80
step: 1
unit_of_measurement: °F
icon: mdi:thermometer
emma_bedroom_fan_threshold:
name: Emma Bedroom Fan Threshold
min: 30
max: 70
step: 1
unit_of_measurement: °F
icon: mdi:thermometer
emma_bedroom_auto_cooling_threshold:
name: Emma Bedroom Auto Cooling Threshold
min: 70
max: 90
step: 1
unit_of_measurement: °F
icon: mdi:thermometer
kallen_fan_threshold:
name: Kallen Fan Threshold
min: 40

11
packages/dashboards.yaml Normal file
View File

@ -0,0 +1,11 @@
template:
- trigger:
- trigger: event
event_type: bubble_card_update_modules
sensor:
- name: "Bubble Card Modules"
state: "saved"
icon: "mdi:puzzle"
attributes:
modules: "{{ trigger.event.data.modules }}"
last_updated: "{{ trigger.event.data.last_updated }}"

View File

@ -257,6 +257,9 @@ automation:
time: >
{% from 'time.jinja' import current_time %}
{{ current_time('time',24) }}
- service: input_boolean.turn_off
target:
entity_id: input_boolean.emma_awake
- conditions:
- condition: trigger
id: bedtime-timer-finished
@ -281,6 +284,9 @@ automation:
datetime: >
{% from 'time.jinja' import current_time %}
{{ current_time('time',24) }}
- service: input_boolean.turn_off
target:
entity_id: input_boolean.emma_awake
- id: e59f638a-519f-4619-bf7d-b13251b3a374
alias: Emma Meds Handler
@ -804,14 +810,9 @@ script:
datetime: >
{% from 'time.jinja' import set_datetime %}
{{ set_datetime(0,5) }}
- if:
- condition: state
entity_id: binary_sensor.basement_occupied
state: 'on'
then:
- service: script.speech_engine
data:
who: basement
who: common
type: normal
message: Emma has awoken, so it is time to make your way upstairs now
- service: input_datetime.set_datetime
@ -898,26 +899,3 @@ script:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.white_noise_emma_bedroom
- if:
- condition: state
entity_id: fan.emma_air_conditioner
state: 'on'
then:
- service: script.turn_on
target:
entity_id: script.emma_aircon_shutoff
emma_aircon_shutoff:
alias: 'Emma Air Conditioner Shutoff'
mode: restart
description: 'Attempt to shut off air conditioner after compressor stops running'
sequence:
- wait_template: "{{ is_state('binary_sensor.emma_aircon_compressor','off') }}"
timeout:
minutes: 15
continue_on_timeout: true
- delay:
seconds: 5
- service: fan.turn_off
target:
entity_id: fan.emma_air_conditioner

View File

@ -1,101 +1,3 @@
scrape:
- resource: https://www.gasbuddy.com/station/59010
sensor:
- name: South Side Shell
unique_id: b3385058-173c-4446-9f0f-3a45f21715d8
select: &selector "#root > div > div.Page-module__content___196kn.Page-module__padded___3hQ0U > div > div > div:nth-child(2) > div.grid__column___nhz7X.grid__desktop10___2T18R > div:nth-child(1) > div.grid__column___nhz7X.grid__desktop8___38Y4U > div:nth-child(3) > div > div.GasPriceCollection-module__collectionContainer___29Ngz > div:nth-child(2) > div:nth-child(1) > span"
device_class: monetary
value_template: '{{ value | replace("$", "") | float }}'
icon: mdi:gas-station
- resource: https://www.gasbuddy.com/station/59007
sensor:
- name: Circle K
unique_id: 63d947bc-486a-478e-9fbe-7fb2f38a1e1e
select: *selector
device_class: monetary
value_template: '{{ value | replace("$", "") | float }}'
icon: mdi:gas-station
- resource: https://www.gasbuddy.com/station/123478
sensor:
- name: Kroger
unique_id: b705d912-8ef4-4e55-9168-d7e152773ba0
select: *selector
device_class: monetary
value_template: '{{ value | replace("$", "") | float }}'
icon: mdi:gas-station
- resource: https://www.gasbuddy.com/station/59014
sensor:
- name: Kecks
unique_id: 4fa4a7bb-45b1-4d17-ab92-06ebd6a39ebb
select: *selector
device_class: monetary
value_template: '{{ value | replace("$", "") | float }}'
icon: mdi:gas-station
- resource: https://www.gasbuddy.com/station/59006
sensor:
- name: The Barn
unique_id: 51137245-9c4a-4992-aa7c-19cd38bd614d
select: *selector
device_class: monetary
value_template: '{{ value | replace("$", "") | float }}'
icon: mdi:gas-station
- resource: https://www.gasbuddy.com/station/59016
sensor:
- name: The Big Fish
unique_id: d5e057d5-3f7b-4c6b-ad0c-5e6ffa10b861
select: *selector
device_class: monetary
value_template: '{{ value | replace("$", "") | float }}'
icon: mdi:gas-station
- resource: https://www.gasbuddy.com/station/107803
sensor:
- name: Marathon Cleveland Avenue
unique_id: 3ef9c1d0-46b0-4850-8df2-d478c833aa4d
select: *selector
device_class: monetary
value_template: '{{ value | replace("$", "") | float }}'
icon: mdi:gas-station
- resource: https://www.gasbuddy.com/station/59013
sensor:
- name: Speedway
unique_id: 44484541-1a71-4e36-9e81-486eea3882cc
select: *selector
device_class: monetary
value_template: '{{ value | replace("$", "") | float }}'
icon: mdi:gas-station
- resource: https://www.gasbuddy.com/station/59009
sensor:
- name: Meijer
unique_id: dc687fd2-ed4d-4fae-a2b8-38ae7a944a68
select: *selector
device_class: monetary
value_template: '{{ value | replace("$", "") | float }}'
icon: mdi:gas-station
- resource: https://www.gasbuddy.com/station/59012
sensor:
- name: East Side Shell
unique_id: db36f6b4-6f87-48af-a339-1f8e8bbc95e3
select: *selector
device_class: monetary
value_template: '{{ value | replace("$", "") | float }}'
icon: mdi:gas-station
- resource: https://www.gasbuddy.com/station/59011
sensor:
- name: Shell Ottawa Avenue
unique_id: d9508ad6-4298-4262-bac9-931a3bc510df
select: *selector
device_class: monetary
value_template: '{{ value | replace("$", "") | float }}'
icon: mdi:gas-station
- resource: https://www.gasbuddy.com/station/71535
sensor:
- name: Ridis
unique_id: 9db2cbc3-39ea-4471-9541-64aa7aa8de71
select: *selector
device_class: monetary
value_template: '{{ value | replace("$", "") | float }}'
icon: mdi:gas-station
sensor:
- platform: statistics
unique_id: fcf4e80e-8459-4e23-a94f-5f127b628c20

View File

@ -31,8 +31,7 @@ tts:
region_name: 'us-east-1'
text_type: ssml
voice: Joanna
cache: true
engine: neural
engine: generative
conversation:

View File

@ -32,9 +32,6 @@ input_boolean:
give_me_darkness:
name: Give Me Darkness
icon: mdi:weather-night
tina_desk_lights:
name: Tina Desk Lights
icon: mdi:desk
holiday_mode_hold:
name: Holiday Mode Hold
icon: mdi:party-popper
@ -492,6 +489,7 @@ input_select:
- Evening Mode
- Night Mode
- Bright Mode
- Reading Mode
- Reset
initial: Select
icon: mdi:desk
@ -656,6 +654,25 @@ template:
{% endif %}
device_class: problem
delay_on: "00:00:10"
- name: Light Switch Issue
unique_id: 381e8038-ea96-474c-92ec-d1296dc1369e
state: >
{% set lights = states.light.upstairs_bathroom_lights,
states.light.hallway_overhead,
states.light.downstairs_bathroom_lights,
states.light.living_room_lights,
states.light.front_porch_light %}
{% set issues = lights | selectattr('state','eq','unavailable') | list | count %}
{{ issues > 0 }}
attributes:
issues: >
{% set lights = states.light.upstairs_bathroom_lights,
states.light.hallway_overhead,
states.light.downstairs_bathroom_lights,
states.light.living_room_lights,
states.light.front_porch_light %}
{% set ids = lights | selectattr('state','eq','unavailable') | map(attribute='attributes.friendly_name') | list %}
{{ ids | join(', ') }}
- sensor:
- name: "Basement Studio Lights - Brightness Actual"
unique_id: dee4dc84-a6a0-4150-903e-5b8bd436d962
@ -819,7 +836,6 @@ switch:
- light.living_room_color_3
- light.tina_lamp_top
- light.tina_lamp_side
- light.tina_desk_strip
colors:
- color_type: rgb_color
color: [255,0,0]

View File

@ -198,6 +198,57 @@ input_number:
step: 0.05
icon: mdi:knob
template:
- sensor:
- name: "Basement Echo Dot Volume"
state: >
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ states('input_number.basement_echo_dot_night_volume') }}
{% else %}
{{ states('input_number.basement_echo_dot_day_volume') }}
{% endif %}
icon: mdi:volume-high
- name: "Basement Google Speaker Volume"
state: >
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ states('input_number.basement_google_speaker_night_volume') }}
{% else %}
{{ states('input_number.basement_google_speaker_day_volume') }}
{% endif %}
icon: mdi:volume-high
- name: "Living Room Echo Dot Volume"
state: >
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ states('input_number.living_room_echo_dot_night_volume') }}
{% else %}
{{ states('input_number.living_room_echo_dot_day_volume') }}
{% endif %}
icon: mdi:volume-high
- name: "Master Bedroom Echo Dot Volume"
state: >
{% if is_state('input_boolean.give_me_darkness','on') or is_state('binary_sensor.people_sleeping','on') %}
{{ states('input_number.master_bedroom_echo_dot_night_volume') }}
{% else %}
{{ states('input_number.master_bedroom_echo_dot_day_volume') }}
{% endif %}
icon: mdi:volume-high
- name: "Kallen Bedroom Google Speaker Volume"
state: >
{% if is_state('input_boolean.give_me_darkness','on') or is_state('input_boolean.kallen_sleeping','on') %}
{{ states('input_number.kallen_bedroom_google_speaker_night_volume') }}
{% else %}
{{ states('input_number.kallen_bedroom_google_speaker_day_volume') }}
{% endif %}
icon: mdi:volume-high
- name: "Emma Bedroom Google Speaker Volume"
state: >
{% if is_state('input_boolean.give_me_darkness','on') or is_state('input_boolean.emma_sleeping','on') %}
{{ states('input_number.emma_bedroom_google_speaker_night_volume') }}
{% else %}
{{ states('input_number.emma_bedroom_google_speaker_day_volume') }}
{% endif %}
icon: mdi:volume-high
# Amazon Polly Sensors to see last message and location of audible notification
mqtt:
sensor:
@ -325,24 +376,14 @@ script:
- condition: template
value_template: >
{% set current = state_attr('media_player.basement_echo_dot','volume_level') | float %}
{% set night = states('input_number.basement_echo_dot_night_volume') | float %}
{% set day = states('input_number.basement_echo_dot_day_volume') | float %}
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ current != night }}
{% else %}
{{ current != day }}
{% endif %}
{% set expected = states('sensor.basement_echo_dot_volume') | float %}
{{ current != expected }}
then:
- service: media_player.volume_set
target:
entity_id: media_player.basement_echo_dot
data:
volume_level: >
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ states('input_number.basement_echo_dot_night_volume') }}
{% else %}
{{ states('input_number.basement_echo_dot_day_volume') }}
{% endif %}
volume_level: "{{ states('sensor.basement_echo_dot_volume') }}"
# Basement Google Speaker
- if:
- condition: and
@ -373,24 +414,14 @@ script:
- condition: template
value_template: >
{% set current = state_attr('media_player.basement_google_speaker','volume_level') | float %}
{% set night = states('input_number.basement_google_speaker_night_volume') | float %}
{% set day = states('input_number.basement_google_speaker_day_volume') | float %}
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ current != night }}
{% else %}
{{ current != day }}
{% endif %}
{% set expected = states('sensor.basement_google_speaker_volume') | float %}
{{ current != expected }}
then:
- service: media_player.volume_set
target:
entity_id: media_player.basement_google_speaker
data:
volume_level: >
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ states('input_number.basement_google_speaker_night_volume') }}
{% else %}
{{ states('input_number.basement_google_speaker_day_volume') }}
{% endif %}
volume_level: "{{ states('sensor.basement_google_speaker_volume') }}"
- service: media_player.volume_mute
target:
entity_id: media_player.basement_google_speaker
@ -405,24 +436,14 @@ script:
- condition: template
value_template: >
{% set current = state_attr('media_player.living_room_echo_dot','volume_level') | float %}
{% set night = states('input_number.living_room_echo_dot_night_volume') | float %}
{% set day = states('input_number.living_room_echo_dot_day_volume') | float %}
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ current != night }}
{% else %}
{{ current != day }}
{% endif %}
{% set expected = states('sensor.living_room_echo_dot_volume') | float %}
{{ current != expected }}
then:
- service: media_player.volume_set
target:
entity_id: media_player.living_room_echo_dot
data:
volume_level: >
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ states('input_number.living_room_echo_dot_night_volume') }}
{% else %}
{{ states('input_number.living_room_echo_dot_day_volume') }}
{% endif %}
volume_level: "{{ states('sensor.living_room_echo_dot_volume') }}"
# Master Bedroom Echo Dot
- if:
- condition: state
@ -435,24 +456,14 @@ script:
- condition: template
value_template: >
{% set current = state_attr('media_player.master_bedroom_echo_dot','volume_level') | float %}
{% set night = states('input_number.master_bedroom_echo_dot_night_volume') | float %}
{% set day = states('input_number.master_bedroom_echo_dot_day_volume') | float %}
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ current != night }}
{% else %}
{{ current != day }}
{% endif %}
{% set expected = states('sensor.master_bedroom_echo_dot_volume') | float %}
{{ current != expected }}
then:
- service: media_player.volume_set
target:
entity_id: media_player.master_bedroom_echo_dot
data:
volume_level: >
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ states('input_number.master_bedroom_echo_dot_night_volume') }}
{% else %}
{{ states('input_number.master_bedroom_echo_dot_day_volume') }}
{% endif %}
volume_level: "{{ states('sensor.master_bedroom_echo_dot_volume') }}"
# Kallen Bedroom Speaker
- if:
- condition: and
@ -483,24 +494,14 @@ script:
- condition: template
value_template: >
{% set current = state_attr('media_player.kallen_bedroom_google_speaker','volume_level') | float %}
{% set night = states('input_number.kallen_bedroom_google_speaker_night_volume') | float %}
{% set day = states('input_number.kallen_bedroom_google_speaker_day_volume') | float %}
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ current != night }}
{% else %}
{{ current != day }}
{% endif %}
{% set expected = states('sensor.kallen_bedroom_google_speaker_volume') | float %}
{{ current != expected }}
then:
- service: media_player.volume_set
target:
entity_id: media_player.kallen_bedroom_google_speaker
data:
volume_level: >
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ states('input_number.kallen_bedroom_google_speaker_night_volume') }}
{% else %}
{{ states('input_number.kallen_bedroom_google_speaker_day_volume') }}
{% endif %}
volume_level: "{{ states('sensor.kallen_bedroom_google_speaker_volume') }}"
- service: media_player.volume_mute
target:
entity_id: media_player.kallen_bedroom_google_speaker
@ -536,24 +537,14 @@ script:
- condition: template
value_template: >
{% set current = state_attr('media_player.emma_bedroom_google_speaker','volume_level') | float %}
{% set night = states('input_number.emma_bedroom_google_speaker_night_volume') | float %}
{% set day = states('input_number.emma_bedroom_google_speaker_day_volume') | float %}
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ current != night }}
{% else %}
{{ current != day }}
{% endif %}
{% set expected = states('sensor.emma_bedroom_google_speaker_volume') | float %}
{{ current != expected }}
then:
- service: media_player.volume_set
target:
entity_id: media_player.emma_bedroom_google_speaker
data:
volume_level: >
{% if is_state('input_boolean.give_me_darkness','on') %}
{{ states('input_number.emma_bedroom_google_speaker_night_volume') }}
{% else %}
{{ states('input_number.emma_bedroom_google_speaker_day_volume') }}
{% endif %}
volume_level: "{{ states('sensor.kallen_bedroom_google_speaker_volume') }}"
- service: media_player.volume_mute
target:
entity_id: media_player.emma_bedroom_google_speaker
@ -1237,11 +1228,9 @@ script:
data:
message: >
<voice name="{{ voice }}">
<amazon:auto-breaths>
<prosody rate="fast">
{{ message }}
</prosody>
</amazon:auto-breaths>
</voice>
target: >
{% if who in ['living_room_echo_dot', 'media_player.living_room_echo_dot','living_room'] %}
@ -1328,55 +1317,36 @@ script:
media_player.basement_google_speaker
{% endif %}
volume_level: >-
{% set numbers_night = [
states.input_number.emma_bedroom_google_speaker_night_volume.state,
states.input_number.kallen_bedroom_google_speaker_night_volume.state
{% set numbers = [
states.sensor.emma_bedroom_google_speaker_volume.state,
states.sensor.kallen_bedroom_google_speaker_volume.state
] %}
{% set numbers_day = [
states.input_number.emma_bedroom_google_speaker_day_volume.state,
states.input_number.kallen_bedroom_google_speaker_day_volume.state
] %}
{% set kidsgroup_night = numbers_night | list | min | float %}
{% set kidsgroup_day = numbers_day | list | max | float %}
{% set kidsgroup = numbers | list | min | float %}
{% if type in ['critical'] %}
1.0
{% elif is_state('input_boolean.give_me_darkness','on') %}
{% else %}
{% if who in ['Everywhere','everywhere','kids_bedrooms','all_bedrooms'] %}
{% if is_state('input_boolean.emma_sleeping','on') and is_state('input_boolean.kallen_sleeping','off') %}
{{ states('input_number.kallen_bedroom_google_speaker_night_volume') }}
{{ states('sensor.kallen_bedroom_google_speaker_volume') }}
{% elif is_state('input_boolean.kallen_sleeping','on') and is_state('input_boolean.emma_sleeping','off') %}
{{ states('input_number.emma_bedroom_google_speaker_night_volume') }}
{{ states('sensor.emma_bedroom_google_speaker_volume') }}
{% else %}
{{ kidsgroup_night }}
{{ kidsgroup }}
{% endif %}
{% elif who in ['kallen_bedroom','media_player.kallen_bedroom_google_speaker'] %}
{{ states('input_number.kallen_bedroom_google_speaker_night_volume') }}
{{ states('sensor.kallen_bedroom_google_speaker_volume') }}
{% elif who in ['emma_bedroom','media_player.emma_bedroom_google_speaker'] %}
{{ states('input_number.emma_bedroom_google_speaker_night_volume') }}
{{ states('sensor.emma_bedroom_google_speaker_volume') }}
{% elif who in ['Basement Google','basement_google'] %}
{{ states('input_number.basement_google_speaker_night_volume') }}
{{ states('sensor.basement_google_speaker_volume') }}
{% else %}
{% if is_state('input_boolean.give_me_darkness','on') %}
0.3
{% endif %}
{% else %}
{% if who in ['Everywhere','everywhere','kids_bedrooms','all_bedrooms'] %}
{% if is_state('input_boolean.emma_sleeping','on') and is_state('input_boolean.kallen_sleeping','off') %}
{{ states('input_number.kallen_bedroom_google_speaker_day_volume') }}
{% elif is_state('input_boolean.kallen_sleeping','on') and is_state('input_boolean.emma_sleeping','off') %}
{{ states('input_number.emma_bedroom_google_speaker_day_volume') }}
{% else %}
{{ kidsgroup_day }}
{% endif %}
{% elif who in ['kallen_bedroom','media_player.kallen_bedroom_google_speaker'] %}
{{ states('input_number.kallen_bedroom_google_speaker_day_volume') }}
{% elif who in ['emma_bedroom','media_player.emma_bedroom_google_speaker'] %}
{{ states('input_number.emma_bedroom_google_speaker_day_volume') }}
{% elif who in ['Basement Google','basement_google'] %}
{{ states('input_number.basement_google_speaker_day_volume') }}
{% else %}
0.6
{% endif %}
{% endif %}
{% endif %}
- service: tts.amazon_polly_say
data:
entity_id: >-

View File

@ -17,8 +17,8 @@ sensor:
entity_id: switch.tina_desktop
power_sensor_id: sensor.tina_desktop_power
- platform: powercalc
entity_id: fan.emma_air_conditioner
power_sensor_id: sensor.emma_air_conditioner_power
entity_id: switch.emma_bedroom_aircon
power_sensor_id: sensor.emma_bedroom_aircon_power
- platform: powercalc
entity_id: switch.master_bedroom_aircon
power_sensor_id: sensor.master_bedroom_aircon_power

View File

@ -124,6 +124,8 @@ template:
state: >
{% if is_state('binary_sensor.basement_studio_motion','on') %}
true
{% elif is_state('sensor.xia_desktop_current_username','tm24f') %}
false
{% elif is_state('binary_sensor.tony_desktop_on','off') and
is_state('binary_sensor.kallen_desktop_on','off') %}
false
@ -405,7 +407,6 @@ automation:
# - light.living_room_led_strip
# - light.tina_lamp_top
# - light.tina_lamp_side
# - light.tina_desk_strip
# - alias: "Save Current Adaptive State"
# service: scene.create
# data:
@ -425,7 +426,6 @@ automation:
# entity_id:
# - light.living_room_lights
# - light.tina_lamp
# - light.tina_desk_strip
# - light.living_room_led_strip
# data:
# color_name: green
@ -613,7 +613,6 @@ automation:
target:
entity_id:
- fan.kallen_bedroom_fan
- fan.emma_air_conditioner
- service: button.press
target:
entity_id: button.master_bedroom_climate_reset
@ -865,9 +864,7 @@ script:
- front_porch
- living_room
- mud_room
- service: input_boolean.turn_on
target:
entity_id: input_boolean.tina_desk_lights
- tina_desk
- delay:
hours: 0
minutes: 0
@ -925,9 +922,7 @@ script:
area_id:
- living_room
- mud_room
- service: input_boolean.turn_on
target:
entity_id: input_boolean.tina_desk_lights
- tina_desk
- delay:
hours: 0
minutes: 0

View File

@ -418,21 +418,14 @@ script:
entity_id: input_datetime.daily_briefing
data:
time: >
{% from 'time.jinja' import time_from_calendar %}
{% if is_state('input_boolean.kallen_school_today','on') %}
{% if is_state('input_boolean.kallen_alternate_pickup','on') or is_state('input_boolean.kallen_btb','on') %}
15:30
{% else %}
{{ time_from_calendar('calendar.kallen_school_days','end_time','set','subtract',1) }}
{% endif %}
{% elif is_state('input_boolean.kallen_school_today','off') and is_state('input_boolean.work_today','off') %}
15:30
{% else %}
{% if is_state('input_boolean.kallen_school_today','off') and is_state('input_boolean.work_today','on') %}
{% if (state_attr('input_datetime.tina_workday_end','timestamp')) > 61200 %}
16:00
{% else %}
{{ (state_attr('input_datetime.tina_workday_end', 'timestamp') + 3600) | timestamp_custom('%H:%M', false) }}
{% endif %}
{% else %}
15:30
{% endif %}
- if:
- condition: state
@ -561,18 +554,7 @@ script:
- service: input_datetime.set_datetime
entity_id: input_datetime.master_bedroom_wakeup
data:
time: >
{% if is_state('input_boolean.kallen_school_today','on') %}
{% if is_state('input_boolean.kallen_alternate_pickup','on') or is_state('input_boolean.kallen_btb','on') %}
16:30
{% elif is_state('input_boolean.kallen_school_early_release','on') %}
12:30
{% else %}
13:00
{% endif %}
{% else %}
16:30
{% endif %}
time: "16:30"
- delay:
milliseconds: 500
- service: input_datetime.set_datetime
@ -618,20 +600,25 @@ script:
data:
time: >
{% set low = states('sensor.overnight_lowest_temperature') | int %}
{% set high = states('sensor.todays_high_temp') | int %}
{% set kallen_bedtime = state_attr('input_datetime.kallen_bedtime','timestamp') | int %}
{% set cutoff = 81000 %}
{% if is_state('input_boolean.hot_day','on') and is_state('binary_sensor.kallen_school_tomorrow','on') %}
{% set cutoff = 81000 %} {# Cutoff time is 22:30 #}
{% if is_state('binary_sensor.kallen_school_tomorrow','on') %}
{% if is_state('input_boolean.hot_day','on') %}
{{ (kallen_bedtime - 3600) | timestamp_custom('%H:%M',false) }}
{% elif is_state('input_boolean.hot_day','on') and is_state('binary_sensor.kallen_school_tomorrow','off') %}
{% elif low >= 56 or high >= 75 %}
{{ (kallen_bedtime - 1800) | timestamp_custom('%H:%M',false) }}
{% else %}
{{ kallen_bedtime | timestamp_custom('%H:%M',false) }}
{% elif 56 <= low <= 60 %}
22:30
{% elif low > 60 %}
{% endif %}
{% elif low > 60 or high > 74 %}
{% if kallen_bedtime < cutoff %}
{{ kallen_bedtime | timestamp_custom('%H:%M',false) }}
{% else %}
21:30
22:00
{% endif %}
{% elif 56 <= low <= 60 %}
22:30
{% else %}
00:00
{% endif %}
@ -642,11 +629,11 @@ script:
{% set low = states('sensor.overnight_lowest_temperature') | int %}
{% set high = states('sensor.todays_high_temp') | int %}
{% if low > 60 or is_state('input_boolean.hot_day','on') %}
00:00
{% elif 50 <= low <= 60 %}
01:00
{% elif low >= states('input_number.master_bedroom_fan_threshold') | int and high > 60 %}
{% elif 50 <= low <= 60 %}
02:00
{% elif low >= states('input_number.master_bedroom_fan_threshold') | int and high > 60 %}
03:00
{% else %}
06:00
{% endif %}
@ -732,11 +719,16 @@ script:
entity_id: input_select.scheduled_climate_mode_emma_bedroom
data:
option: >
{% if is_state('input_boolean.emma_bedroom_aircon_installed','on') %}
{% if (states('sensor.overnight_lowest_temperature') | int) >= (states('input_number.emma_aircon_threshold') | int) %}
{% set low = states('sensor.overnight_lowest_temperature') | int %}
{% set run_threshold = states('input_number.emma_bedroom_aircon_run_threshold') | int %}
{% set mode_threshold = states('input_number.emma_bedroom_aircon_mode_threshold') | int %}
{% if is_state('input_boolean.emma_bedroom_aircon_installed','off') %}
White Noise
{% elif low >= run_threshold %}
{% if low >= mode_threshold %}
AC
{% else %}
White Noise
Fan
{% endif %}
{% else %}
White Noise
@ -750,11 +742,11 @@ script:
{% set low = states('sensor.overnight_lowest_temperature') | int %}
{% set bedtime = state_attr('input_datetime.emma_bedtime','timestamp') | int %}
{% if is_state('input_boolean.hot_day','on') %}
{{ (bedtime - 7200) | timestamp_custom('%H:%M',false) }}
{% elif high >= 80 or low >= 60 %}
{{ (bedtime - 5400) | timestamp_custom('%H:%M',false) }}
{% else %}
{% elif high >= 80 or low >= 60 %}
{{ (bedtime - 3600) | timestamp_custom('%H:%M',false) }}
{% else %}
{{ (bedtime - 1800) | timestamp_custom('%H:%M',false) }}
{% endif %}
- service: input_boolean.turn_on
target:
@ -773,16 +765,16 @@ script:
{% if ct > state_attr('input_datetime.kallen_school_day_start','timestamp') %}
{{ (state_attr('input_datetime.tina_workday_start','timestamp') - 1800) | timestamp_custom('%H:%M', false) }}
{% elif ct > state_attr('input_datetime.tina_workday_start','timestamp') and ct < state_attr('input_datetime.kallen_school_day_start','timestamp') %}
{{ (state_attr('input_datetime.kallen_school_day_start','timestamp') - 3600) | timestamp_custom('%H:%M', false) }}
{{ (state_attr('input_datetime.kallen_school_day_start','timestamp') - 3900) | timestamp_custom('%H:%M', false) }}
{% elif state_attr('input_datetime.tina_workday_start','timestamp') < (state_attr('input_datetime.kallen_school_day_start','timestamp')) %}
{{ (state_attr('input_datetime.tina_workday_start','timestamp') - 1800) | timestamp_custom('%H:%M', false) }}
{% else %}
{{ (state_attr('input_datetime.kallen_school_day_start','timestamp') - 3600) | timestamp_custom('%H:%M', false) }}
{{ (state_attr('input_datetime.kallen_school_day_start','timestamp') - 3900) | timestamp_custom('%H:%M', false) }}
{% endif %}
{% elif is_state('input_boolean.work_today','on') and is_state('input_boolean.kallen_school_today','off') %}
{{ (state_attr('input_datetime.tina_workday_start', 'timestamp') - 1800) | timestamp_custom('%H:%M', false) }}
{% elif is_state('input_boolean.kallen_school_today','on') %}
{{ (state_attr('input_datetime.kallen_school_day_start','timestamp') - 3600) | timestamp_custom('%H:%M', false) }}
{{ (state_attr('input_datetime.kallen_school_day_start','timestamp') - 3900) | timestamp_custom('%H:%M', false) }}
{% else %}
11:00
{% endif %}

View File

@ -63,25 +63,25 @@ template:
- binary_sensor:
- name: Tony Desktop On
unique_id: 82ce673a-96ad-4af5-a8d1-be9ca9fa9c36
state: "{{ states('sensor.tony_desktop_power') | int > 10 }}"
state: "{{ states('sensor.tony_desktop_power') | int > 25 }}"
device_class: running
attributes:
power_usage: "{{ states('sensor.tony_desktop_power') | int }}W"
- name: Tina Desktop On
unique_id: 8484dbd4-2fae-4368-a4bc-d1bdc09e003f
state: "{{ states('sensor.tina_desktop_power') | int > 10 }}"
state: "{{ states('sensor.tina_desktop_power') | int > 25 }}"
device_class: running
attributes:
power_usage: "{{ states('sensor.tina_desktop_power') | int }}W"
- name: Kallen Desktop On
unique_id: ccc25d75-4915-449d-9b2e-09ad14ffac29
state: "{{ states('sensor.kallen_desktop_power') | int > 10 }}"
state: "{{ states('sensor.kallen_desktop_power') | int > 25 }}"
device_class: running
attributes:
power_usage: "{{ states('sensor.kallen_desktop_power') | int }}W"
- name: Basement Server On
unique_id: e6df7d98-d3ba-4e01-bae2-2ebafc8d78d6
state: "{{ states('sensor.basement_server_power') | int > 10 }}"
state: "{{ states('sensor.basement_server_power') | int > 25 }}"
device_class: running
attributes:
power_usage: "{{ states('sensor.basement_server_power') | int }}W"

View File

@ -19,6 +19,18 @@ input_boolean:
tina_night_meds_taken:
name: Tina Night Meds Taken
icon: mdi:medication
tina_ibuprofen_active:
name: Tina Ibuprofen Active
icon: mdi:medication
tina_ibuprofen_taken:
name: Tina Ibuprofen Taken
icon: mdi:medication
tina_tylenol_active:
name: Tina Tylenol Active
icon: mdi:medication
tina_tylenol_taken:
name: Tina Tylenol Taken
icon: mdi:medication
tina_awake:
name: Tina Awake
icon: mdi:eye-check
@ -54,6 +66,26 @@ input_datetime:
has_date: true
has_time: true
icon: mdi:medication
tina_ibuprofen_taken:
name: Tina Ibuprofen Taken
has_date: true
has_time: true
icon: mdi:medication
tina_ibuprofen_notify:
name: Tina Ibuprofen Notify
has_date: true
has_time: true
icon: mdi:medication
tina_tylenol_taken:
name: Tina Tylenol Taken
has_date: true
has_time: true
icon: mdi:medication
tina_tylenol_notify:
name: Tina Tylenol Notify
has_date: true
has_time: true
icon: mdi:medication
automation:
- id: cd9f921f-71c7-4e29-9aee-7421ef19bdd3

View File

@ -1617,7 +1617,6 @@ script:
# snapshot_entities:
# - light.tina_lamp_side
# - light.tina_lamp_top
# - light.tina_desk_strip
# - switch.adaptive_lighting_living_room
# - switch.adaptive_lighting_tina_lamp
# - service: switch.turn_off
@ -1631,7 +1630,6 @@ script:
# entity_id:
# - light.tina_lamp_side
# - light.tina_lamp_top
# - light.tina_desk_strip
# data:
# color_name: red
# - service: script.living_room_lights_alert

View File

@ -57,6 +57,7 @@ ## HACS Components
- [Powercalc](https://github.com/bramstroker/homeassistant-powercalc)
- [Govee LAN Control](https://github.com/wez/govee-lan-hass)
- [Discord Game](https://github.com/LordBoos/discord_game)
- [Versatile Thermostat](https://github.com/jmcollin78/versatile_thermostat)
</details>
@ -67,7 +68,7 @@ ## HACS Lovelace Cards
<details>
<summary>Click here</summary>
- [Bubble Card](https://github.com/Clooos/Bubble-Card)
- [Bubble Card](https://github.com/Clooos/Bubble-Card) Backbone of the new mobile dashboard
- [Config Template Card](https://github.com/iantrich/config-template-card)
- [Decluttering Card](https://github.com/custom-cards/decluttering-card)
- [Card Tools](https://github.com/thomasloven/lovelace-card-tools) (required for various other cards)
@ -86,7 +87,6 @@ ## HACS Lovelace Cards
- [Auto Entities Card](https://github.com/thomasloven/lovelace-auto-entities)
- [Slider Button Card](https://github.com/custom-cards/slider-button-card)
- [Weather Radar Card](https://github.com/Makin-Things/weather-radar-card)
- [Platinum Weather Card](https://github.com/Makin-Things/platinum-weather-card) (Not currently in use, but VERY nicely done)
- [Stack In Card](https://github.com/custom-cards/stack-in-card)
- [Paper Buttons Row](https://github.com/jcwillox/lovelace-paper-buttons-row)
- [State Switch](https://github.com/thomasloven/lovelace-state-switch)
@ -122,6 +122,7 @@ ## HACS Lovelace Cards
- [Meteoalarm Card](https://github.com/MrBartusek/MeteoalarmCard)
- [Weather Chart Card](https://github.com/mlamberts78/weather-chart-card)
- [Comfortable Environment Card](https://github.com/argaar/comfortable-environment-card)
- [Versatile Thermostat UI Card](https://github.com/jmcollin78/versatile-thermostat-ui-card)
</details>

View File

@ -1210,14 +1210,23 @@
min_mireds: 153
max_mireds: 500
effect_list:
- None
- 'off'
- candle
- fire
- prism
- sparkle
- opal
- glisten
- underwater
- cosmos
- sunbeam
- enchant
- sunrise
- sunset
supported_color_modes:
- color_temp
- xy
effect: None
effect: 'off'
color_mode: xy
brightness: 179
color_temp_kelvin:
@ -1244,14 +1253,23 @@
min_mireds: 153
max_mireds: 500
effect_list:
- None
- 'off'
- candle
- fire
- prism
- sparkle
- opal
- glisten
- underwater
- cosmos
- sunbeam
- enchant
- sunrise
- sunset
supported_color_modes:
- color_temp
- xy
effect: None
effect: 'off'
color_mode: xy
brightness: 255
color_temp_kelvin:
@ -1278,10 +1296,13 @@
min_mireds: 153
max_mireds: 500
effect_list:
- None
- 'off'
- candle
- fire
- prism
- sparkle
- opal
- glisten
supported_color_modes:
- color_temp
- xy
@ -1342,14 +1363,23 @@
min_mireds: 153
max_mireds: 500
effect_list:
- None
- 'off'
- candle
- fire
- prism
- sparkle
- opal
- glisten
- underwater
- cosmos
- sunbeam
- enchant
- sunrise
- sunset
supported_color_modes:
- color_temp
- xy
effect: None
effect: 'off'
color_mode: xy
brightness: 255
color_temp_kelvin:
@ -1376,14 +1406,23 @@
min_mireds: 153
max_mireds: 500
effect_list:
- None
- 'off'
- candle
- fire
- prism
- sparkle
- opal
- glisten
- underwater
- cosmos
- sunbeam
- enchant
- sunrise
- sunset
supported_color_modes:
- color_temp
- xy
effect: None
effect: 'off'
color_mode: xy
brightness: 255
color_temp_kelvin:
@ -1441,14 +1480,17 @@
min_mireds: 153
max_mireds: 500
effect_list:
- None
- 'off'
- candle
- fire
- prism
- sparkle
- opal
- glisten
supported_color_modes:
- color_temp
- xy
effect: None
effect: 'off'
color_mode: xy
brightness: 204
color_temp_kelvin:

File diff suppressed because it is too large Load Diff

View File

@ -68,7 +68,6 @@
states.light.downstairs_bathroom_right,
states.light.tina_lamp_top,
states.light.tina_lamp_side,
states.light.tina_desk_strip,
states.light.basement_tall_lamp,
states.light.basement_short_lamp,
states.light.basement_stairwell,
@ -103,7 +102,6 @@
states.light.downstairs_bathroom_right,
states.light.tina_lamp_top,
states.light.tina_lamp_side,
states.light.tina_desk_strip
] %}
{{ lights | selectattr('state','eq','on') | list | count | int }}
- name: Second Floor Lights On
@ -170,7 +168,7 @@
unit_of_measurement: ''
state: >-
{% set compressors = [
states.binary_sensor.emma_aircon_compressor,
states.binary_sensor.emma_bedroom_aircon_compressor,
states.binary_sensor.master_bedroom_aircon_compressor
] %}
{{ compressors | selectattr('state','eq','on') | list | count | int }}
@ -179,7 +177,7 @@
unit_of_measurement: ''
state: >-
{% set fans = [
states.binary_sensor.emma_aircon_fan,
states.binary_sensor.emma_bedroom_aircon_fan,
states.binary_sensor.master_bedroom_aircon_fan
] %}
{{ fans | selectattr('state','eq','on') | list | count | int }}
@ -198,11 +196,7 @@
unit_of_measurement: ''
state: >-
{% set climate = states.climate | selectattr('state','ne','off') | rejectattr('state','eq','unavailable') | rejectattr('state','eq','unknown') | list | count | int %}
{% set fans = [
states.fan.emma_air_conditioner
] %}
{% set fans_on = fans | selectattr('state','eq','on') | list | count | int %}
{{ climate + fans_on | int }}
{{ climate | int }}
- name: Climate Devices Running
unique_id: 3c61c756-2934-4294-8085-7d3855b692dd
unit_of_measurement: ''

View File

@ -98,12 +98,7 @@
{% endif %}
{% if is_state('input_boolean.kallen_alternate_pickup','on') %}
Today, you will be picked up from school by {{ states('input_text.kallen_pickup') }}.
{% elif is_state('input_boolean.work_today','off') %}
Today, you will be picked up from school by your parents.
{% else %}
Today, you will be picked up from school by your dad.
{% endif %}
<s>Pickup today will be at {{ input_datetime_read('input_datetime.kallen_school_day_end') }}</s>
{% if count_the_days('input_datetime.school_last_day') | int == 0 -%}
But today is the last day of School!
{%- endif %}

View File

@ -71,9 +71,13 @@
{% else %}
"Collin's room will be left alone, as he is spending the night elsewhere tonight. "
{% endif %}
{% if states('input_select.scheduled_climate_mode_emma_bedroom') != 'N/A' %}
{% if is_state('input_select.scheduled_climate_mode_emma_bedroom','AC') and is_state('fan.emma_air_conditioner','off') %}
"Emma's air conditioner will be activated at {{ input_datetime_read('input_datetime.emma_bedroom_cooling') }}. "
{% if states('input_select.scheduled_climate_mode_emma_bedroom_aircon') != 'N/A' %}
{% if is_state('input_select.scheduled_climate_mode_emma_bedroom_aircon','AC') and is_state('input_boolean.hot_day','on') %}
"Today was a hot day, so Emma's bedroom air conditioner will start cooling a bit earlier tonight at {{ input_datetime_read('input_datetime.emma_bedroom_cooling') }}. "
{% elif is_state('input_select.scheduled_climate_mode_emma_bedroom_aircon','AC') %}
"Emma's bedroom air conditioner will start cooling at {{ input_datetime_read('input_datetime.emma_bedroom_cooling') }}. "
{% elif is_state('input_select.scheduled_climate_mode_emma_bedroom_aircon','Fan') %}
"Emma's bedroom air conditioner will activate fan only mode at {{ input_datetime_read('input_datetime.emma_bedroom_cooling') }}. "
{% elif is_state('input_select.scheduled_climate_mode_emma_bedroom','White Noise') and is_state('input_boolean.white_noise_emma_bedroom','off') %}
"Emma's white noise generator will activate at {{ input_datetime_read('input_datetime.emma_bedtime') }}. "
{% endif %}

View File

@ -76,7 +76,7 @@
<p>
{% if (states('sensor.climate_devices_installed') | int) > 0 %}
{% if is_state('input_boolean.master_bedroom_aircon_installed','on') %}
"the master bedroom temperature is {{ states('sensor.master_bedroom_aircon_indoor_temperature') | int }} degrees. "
"the master bedroom temperature is {{ states('sensor.master_bedroom_temperature') | int }} degrees. "
{% if not is_state('climate.master_bedroom_aircon','off') %}
{% if is_state('climate.master_bedroom_aircon','cool') %}
"and the master bedroom air conditioner is set for cooling to {{ state_attr('climate.master_bedroom_aircon','temperature') }} degrees. "
@ -90,11 +90,22 @@
"and the master bedroom air conditioner is currently not speaking to me. Was it something I said? "
{% endif %}
{% endif %}
{% elif is_state('input_boolean.master_bedroom_aircon_installed','off') %}
"There is no air conditioner or temperature sensor installed in the master bedroom. "
{% endif %}
{% if is_state('input_boolean.emma_bedroom_aircon_installed','on') and is_state('fan.emma_air_conditioner','on') %}
"Emma's air conditioner is {{ states('fan.emma_air_conditioner') }}. "
{% if is_state('input_boolean.emma_bedroom_aircon_installed','on') %}
"the temperature in Emma's bedroom is {{ states('sensor.emma_bedroom_temperature') | int }} degrees. "
{% if not is_state('climate.emma_bedroom_aircon','off') %}
{% if is_state('climate.emma_bedroom_aircon','cool') %}
"and Emma's bedroom air conditioner is set for cooling to {{ state_attr('climate.emma_bedroom_aircon','temperature') }} degrees. "
{% elif is_state('climate.emma_bedroom_aircon','fan_only') %}
"and Emma's bedroom air conditioner is in fan only mode. "
{% elif is_state('climate.emma_bedroom_aircon','dry') %}
"and Emma's bedroom air conditioner is moonlighting as a dehumidifier. "
{% elif is_state('climate.emma_bedroom_aircon','auto') %}
"and Emma's bedroom air conditioner is making its own decisions. Be afraid, be very afraid. "
{% else %}
"and Emma's bedroom air conditioner is currently not speaking to me. Was it something I said? "
{% endif %}
{% endif %}
{% endif %}
{% endif %}
</p>
@ -117,7 +128,7 @@
"Tina has work today. "
{% endif %}
{% if is_state('input_boolean.kallen_at_school','on') %}
"Collin is at school right now. His pickup time will be at {{ input_datetime_read('input_datetime.kallen_school_day_end') }}. "
"Collin is at school right now. His school day ends at {{ input_datetime_read('input_datetime.kallen_school_day_end') }}. "
{% elif is_state('input_boolean.kallen_school_today','on') %}
"Collin has school today. "
{% endif %}

View File

@ -0,0 +1,429 @@
# Bubble Modules
#
# How to use:
#
# - To edit or add modules (global styles and templates), first copy the
# "bubble-modules.yaml" file from "/www/community/Bubble-Card/" (if installed via HACS)
# to "/www/bubble/" (you'll need to create this folder).
#
# Then add these lines in your "configuration.yaml" under "homeassistant:":
#
# homeassistant:
# allowlist_external_dirs:
# - /config/www/bubble
# # This step is not needed if you already have this line:
# - /config/www
#
# Then save and restart Home Assistant.
#
# - After making changes, you need to refresh your page to apply the modifications.
#
# - Styles and templates defined under "default:" are applied globally to all cards by default.
#
# - See the final example in this file for further details on how to create a module.
#
# - You can share/find modules here:
# github.com/Clooos/Bubble-Card/discussions/categories/share-your-modules
default:
name: Default
description: Empty and enabled by default. Move your styles/templates here in the <code>bubble-modules.yaml</code> file to apply them to all cards.
code: |
/* CSS or JS templates (see examples below) */
home-assistant-default:
name: Home Assistant default styling
version: "v1.1"
creator: "Clooos"
link: "https://github.com/Clooos/Bubble-Card/discussions/1230"
description: This module applies Home Assistants default styling to Bubble Card. To set it as the default, move it under <code>default:</code> in the <code>bubble-modules.yaml</code> file.
code: |
:host {
--bubble-button-accent-color: rgba(0,140,255,0.3); /* Edit this color if needed */
--bubble-main-background-color: var(--ha-card-background, var(--card-background-color, #fff));
--bubble-border-radius: var(--ha-card-border-radius, 12px);
--bubble-icon-border-radius: 32px;
--bubble-button-border-radius: var(--bubble-border-radius);
--bubble-climate-button-background-color: var(--bubble-icon-background-color);
--bubble-border: var(--ha-card-border-width, 1px) solid var(--ha-card-border-color, var(--divider-color, #e0e0e0));
--bubble-secondary-background-color: transparent;
}
.bubble-container {
-webkit-backdrop-filter: var(--ha-card-backdrop-filter, none);
backdrop-filter: var(--ha-card-backdrop-filter, none);
box-shadow: var(--ha-card-box-shadow, none);
box-sizing: border-box;
}
.bubble-icon-container,
.large .bubble-icon-container {
--mdc-icon-size: 22px;
min-width: 36px !important;
min-height: 36px !important;
}
.large .bubble-cover-card-container > .bubble-buttons {
--bubble-cover-main-background-color: none;
}
.bubble-range-fill {
--bubble-accent-color: var(--bubble-button-accent-color);
}
.bubble-sub-button.background-on::before,
.bubble-sub-button.background-off::before,
.bubble-temperature-container::before,
.bubble-icon-container::before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: var(--control-number-buttons-background-opacity, .2);
border-radius: var(--bubble-border-radius);
background: var(--control-number-buttons-background-color, var(--disabled-color));
}
.is-on {
--bubble-icon-background-color: var(--view-background,var(--lovelace-background,var(--primary-background-color)));
transition: all ease-in 0.3s !important;
}
.bubble-icon-container::before {
background: var(--state-inactive-color);
border-radius: var(--bubble-icon-border-radius);
}
.bubble-sub-button {
border: 0px solid transparent !important;
}
.no-icon-select-arrow {
right: 4px !important;
}
.large .bubble-icon-container {
margin-left: 9px;
}
.bubble-state {
opacity: 1;
font-weight: 400;
font-size: 12px;
letter-spacing: .4px;
}
:not(.bubble-separator) > .bubble-name {
font-weight: 500;
font-size: 14px;
letter-spacing: 0.1px;
}
.bubble-pop-up-background {
filter: brightness(0.96); /* Improve pop-up background contrast */
--bubble-pop-up-border-radius: calc(var(--ha-card-border-radius, 12px) * 1.4);
}
.bubble-header-container {
--bubble-secondary-background-color: var(--background-color-2);
}
ha-select {
--bubble-list-item-accent-color: none !important;
--mdc-theme-surface: var(--card-background-color);
}
mwc-list-item[selected] {
color: inherit !important;
--mdc-ripple-press-opacity: 0 !important;
}
mwc-list-item[selected]::before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: var(--primary-color);
opacity: 0.24;
}
icon_container_color:
name: "Example: Customize the icon container color"
version: "v1.1"
creator: "Clooos"
link: "https://github.com/Clooos/Bubble-Card/discussions/1231"
unsupported:
- horizontal-buttons-stack
- separator
description: |
A list of predefined colors to customize the icon container color.
Configure this module via the editor or in YAML, for example:
<br><br>
<code-block><pre>
icon_container_color:
color: light-blue
</pre></code-block>
code: |
.bubble-icon-container {
opacity: 1 !important;
background: var(--${this.config.icon_container_color?.color}-color) !important;
}
editor:
- name: color
label: "Color"
selector:
ui_color:
include_none: true
get_state_attribute:
# Some informations about your module (this is shown in the editor)
name: "Advanced example: Get state/attribute from other entities"
version: "v1.1"
creator: "Clooos"
link: "https://github.com/Clooos/Bubble-Card"
# Disable this module for unsupported "card_type"
unsupported:
- horizontal-buttons-stack
- separator
# The description have HTML support like in this example. This model is my favorite.
description: |
Get state/attribute from other entities and replace the default state/attribute field.
<img class="example" src="https://github.com/Clooos/Bubble-Card/blob/main/img/get_state_template_example.png?raw=true" />
Configure this module via the editor or in YAML, for example:
<br><br>
<code-block><pre>
get_state_attribute:
- entity: weather.home
- entity: sensor.weather_station
attribute: humidity
- entity: sensor.weather_station
attribute: temperature
</pre></code-block>
<br>
<b>If it doesn't work, make sure at least one of "Show state" or "Show attribute" is turned on in your card configuration.</b>
# Code blocks must always start with ${(() => { and end with })()}
# Inline codes must always start with ${ and end with }
#
# This section only supports JavaScript and/or CSS
code: |
${(() => {
// Retrieve the configuration or use an empty array by default
const config = this.config.get_state_attribute || [];
// Format the retrieved value from the entity for each entry
const values = config
.map(cfg => {
const entity = hass.states[cfg.entity];
if (entity) {
return cfg.attribute
? hass.formatEntityAttributeValue(entity, cfg.attribute)
: hass.formatEntityState(entity);
}
return null;
})
.filter(value => value !== null); // Remove null values
// Update the DOM element with the class 'bubble-state'
// displaying values separated by ' • '
card.querySelector('.bubble-state').innerText = values.join(' • ');
})()}
# The editor part can be tricky, but improves modules a lot!
#
# In this example, it will create your configuration to this variable:
# this.config.get_state_attribute
#
# To understand what you can do here, take a look at the "ha-form" sources here:
# https://github.com/home-assistant/frontend/tree/03a415beff6e6f9c87a95287804f6c03c8fef3d5/src/components/ha-form
#
# And here for the selectors:
# https://github.com/home-assistant/frontend/blob/03a415beff6e6f9c87a95287804f6c03c8fef3d5/src/data/selector.ts
#
# I will try to document that for clarity!
editor:
- type: expandable
title: "Select entities and attributes"
icon: "mdi:list-box-outline"
schema:
- name: '0'
type: expandable
title: "Entity 1"
schema:
- name: entity
label: "Entity"
selector:
entity: {}
- name: attribute
label: "Attribute"
selector:
attribute: {}
- name: '1'
type: expandable
title: "Entity 2"
schema:
- name: entity
label: "Entity"
selector:
entity: {}
- name: attribute
label: "Attribute"
selector:
attribute: {}
- name: '2'
type: expandable
title: "Entity 3"
schema:
- name: entity
label: "Entity"
selector:
entity: {}
- name: attribute
label: "Attribute"
selector:
attribute: {}
- name: '3'
type: expandable
title: "Entity 4"
schema:
- name: entity
label: "Entity"
selector:
entity: {}
- name: attribute
label: "Attribute"
selector:
attribute: {}
# Temperature
temperature_colouring:
name: "Temperature colouring"
version: "v1.0"
creator: "Timmy"
unsupported:
- horizontal-buttons-stack
- media-player
description: |
This module provides dynamic colouring based on temperature sensor values.
Colour adjustments are applied to selected sub-buttons and/or state display elements.
Required entities:
- A temperature sensor
You can configure which elements should receive dynamic colouring:
- Sub-buttons (1-6)
- State display
Example YAML configuration:
temperature_colouring:
temperature_sensor: sensor.kitchen_temperature
elements:
sub_buttons: [1, 3, 5] # Apply to sub-buttons 1, 3, and 5
state_display: true # Apply to state display element
code: |
${(() => {
const temperature = parseFloat(hass?.states[this.config?.temperature_colouring?.temperature_sensor]?.state || 0);
const elements = this.config?.temperature_colouring?.elements || {};
let color;
if (temperature <= 32) {
color = 'rgba(0,0,139,0.8)';
} else if (temperature <= 41) {
color = 'rgba(0,71,171,0.8)';
} else if (temperature <= 50) {
color = 'rgba(30,144,255,0.8)';
} else if (temperature <= 61) {
color = 'rgba(100,149,237,0.8)';
} else if (temperature <= 68) {
color = 'rgba(60,179,113,0.8)';
} else if (temperature <= 73) {
color = 'rgba(152,251,152,0.8)';
} else if (temperature <= 78) {
color = 'rgba(255,223,186,0.8)';
} else if (temperature <= 80) {
color = 'rgba(255,215,0,0.8)';
} else if (temperature <= 95) {
color = 'rgba(178,34,34,0.8)';
} else {
color = 'rgba(139,0,0,0.8)';
}
// Apply colour to selected sub-buttons
if (elements.sub_buttons) {
const subButtons = Array.isArray(elements.sub_buttons) ? elements.sub_buttons : [];
subButtons.forEach(num => {
if (num >= 1 && num <= 6) {
const subButton = card?.querySelector(`.bubble-sub-button-${num} ha-icon`);
if (subButton) {
subButton.style.color = color;
}
}
});
}
// Apply colour to state display if enabled
if (elements.state_display) {
const stateElement = card?.querySelector('.bubble-state.state.display-state');
if (stateElement) {
stateElement.style.color = color;
}
}
return ''; // No CSS needed as we're applying styles directly to elements
})()}
editor:
- type: expandable
title: "Entity Configuration"
icon: "mdi:thermometer"
schema:
- name: temperature_sensor
label: "Temperature Sensor (Required)"
selector:
entity:
device_class: temperature
required: true
- name: elements
type: grid
schema:
- name: sub_buttons
label: "Sub-buttons to Style"
selector:
select:
multiple: true
options:
- label: "Sub-button 1"
value: 1
- label: "Sub-button 2"
value: 2
- label: "Sub-button 3"
value: 3
- label: "Sub-button 4"
value: 4
- label: "Sub-button 5"
value: 5
- label: "Sub-button 6"
value: 6
- name: state_display
label: "State Display"
selector:
boolean: {}