diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 0000000..c17b236 --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,22 @@ +extends: default + +ignore: | + config/templates/partials/ + config/secrets.yaml + +rules: + document-start: + present: false + + line-length: + max: 120 + level: warning + + truthy: + allowed-values: + - 'true' + - 'false' + - 'yes' + - 'no' + - 'on' + - 'off' diff --git a/config/lovelace/button_card_templates/progress_button.yaml b/config/lovelace/button_card_templates/progress_button.yaml index e344c22..4463c62 100644 --- a/config/lovelace/button_card_templates/progress_button.yaml +++ b/config/lovelace/button_card_templates/progress_button.yaml @@ -47,9 +47,18 @@ progress: : temp < variables.high_value ? variables.normal_color : variables.high_color; - const percent = (temp - variables.min_value)/(variables.max_value - variables.min_value) * 100; - const gradient = 100 - percent; - const degrees = variables.degrees + "deg"; - return 'linear-gradient('+ degrees +', var(--paper-card-background-color) 0%, var(--paper-card-background-color)' + gradient + '%, ' + color + ' ' + gradient + '%)' + const min = variables.min_value; + const max = variables.max_value; + const percent = Math.round((temp - min)/(max - min) * 100); + const gradientPercent = 100 - percent; + + const gradient = [ + `${variables.degrees}deg`, + 'var(--paper-card-background-color) 0%', + `var(--paper-card-background-color) ${gradientPercent}%`, + `${color} ${gradientPercent}%` + ] + + return `linear-gradient(${gradient.join(',')})`; ]]] diff --git a/config/lovelace/button_card_templates/small_button.yaml b/config/lovelace/button_card_templates/small_button.yaml index e29bd52..6121e67 100644 --- a/config/lovelace/button_card_templates/small_button.yaml +++ b/config/lovelace/button_card_templates/small_button.yaml @@ -12,4 +12,3 @@ small: - height: 60px name: - height: 30px - diff --git a/config/lovelace/button_card_templates/with_state_indicator_button.yaml b/config/lovelace/button_card_templates/with_state_indicator_button.yaml index ca5d2bb..c46d756 100644 --- a/config/lovelace/button_card_templates/with_state_indicator_button.yaml +++ b/config/lovelace/button_card_templates/with_state_indicator_button.yaml @@ -1,9 +1,9 @@ with_state_indicator: variables: - state_indicator_id: # defaults to entity_id + state_indicator_id: # defaults to entity_id state_indicator_size: 2px - state_indicator_off_size: # If set, used when the state_indicator entity is off + state_indicator_off_size: # If set, used when the state_indicator entity is off # state indicators are used when the entity's state is not 'on' state_indicator_on_color: white @@ -13,7 +13,7 @@ with_state_indicator: state_on_indicator_on_color: white state_on_indicator_off_color: transparent - triggers_update: all # unfortunately a template doesn't seem to work here :/ + triggers_update: all # unfortunately a template doesn't seem to work here :/ double_tap_action: action: call-service service: homeassistant.toggle diff --git a/config/lovelace/button_card_templates/xs_button.yaml b/config/lovelace/button_card_templates/xs_button.yaml index b87c18a..b7ea61a 100644 --- a/config/lovelace/button_card_templates/xs_button.yaml +++ b/config/lovelace/button_card_templates/xs_button.yaml @@ -8,4 +8,3 @@ xs: - font-size: 12px name: - height: 24px - diff --git a/config/lovelace/decluttering_templates/cards/brita_water_card.yaml b/config/lovelace/decluttering_templates/cards/brita_water_card.yaml index cb35dc0..eb52b74 100644 --- a/config/lovelace/decluttering_templates/cards/brita_water_card.yaml +++ b/config/lovelace/decluttering_templates/cards/brita_water_card.yaml @@ -16,7 +16,15 @@ brita_water_card: [[[ const remaining = states['input_number.brita_remaining_liters'].state; const percent = 100 - (remaining / 150 * 100); - return 'linear-gradient(180deg, var(--paper-card-background-color) 0%, var(--paper-card-background-color)' + percent + '%, var(--primary-color) ' + percent + '%)' + + const gradient = [ + '180deg', + 'var(--paper-card-background-color) 0%', + `var(--paper-card-background-color) ${percent}%`, + `var(--primary-color) ${percent}%` + ] + + return `linear-gradient(${gradient.join(',')})`; ]]] - color: white name: diff --git a/config/lovelace/decluttering_templates/cards/bulsatcom_remote_card.yaml b/config/lovelace/decluttering_templates/cards/bulsatcom_remote_card.yaml index 57c3e45..54f6b8c 100644 --- a/config/lovelace/decluttering_templates/cards/bulsatcom_remote_card.yaml +++ b/config/lovelace/decluttering_templates/cards/bulsatcom_remote_card.yaml @@ -265,4 +265,3 @@ bulsatcom_remote_card: top: 83.5% left: 81.5% border-radius: 40% - diff --git a/config/lovelace/floorplan_dashboard/picture_elements/light_overlays.yaml b/config/lovelace/floorplan_dashboard/picture_elements/light_overlays.yaml index cf67496..864b5a0 100644 --- a/config/lovelace/floorplan_dashboard/picture_elements/light_overlays.yaml +++ b/config/lovelace/floorplan_dashboard/picture_elements/light_overlays.yaml @@ -19,7 +19,7 @@ tap_action: action: none - # Living Room +# Living Room - type: conditional conditions: - entity: binary_sensor.floorplan_night_mode diff --git a/config/lovelace/floorplan_dashboard/picture_elements/sensors.yaml b/config/lovelace/floorplan_dashboard/picture_elements/sensors.yaml index 365a19c..fa0c743 100644 --- a/config/lovelace/floorplan_dashboard/picture_elements/sensors.yaml +++ b/config/lovelace/floorplan_dashboard/picture_elements/sensors.yaml @@ -1,10 +1,11 @@ - - type: conditional conditions: - entity: input_boolean.floorplan_show_all state: 'on' elements: -# Living room ─────────────────────────────────────────────────────────────────────────── + + # Living room ─────────────────────────────────────────────────────────────────────────── + # Titanium - type: custom:decluttering-card template: floorplan_state_icon @@ -55,7 +56,7 @@ - left: 48% - icon: mdi:video -# Master Bedroom ──────────────────────────────────────────────────────────────────────── + # Master Bedroom ──────────────────────────────────────────────────────────────────────── # Puifier - type: custom:decluttering-card @@ -76,7 +77,7 @@ - tap_action: action: more-info -# Temperature + # Temperature - type: state-label entity: sensor.bedroom_weather_temperature style: @@ -90,7 +91,7 @@ font-weight: bold line-height: 8px -# Kitchen ──────────────────────────────────────────────────────────────────────── + # Kitchen ──────────────────────────────────────────────────────────────────────── # Sonos - type: custom:decluttering-card @@ -113,7 +114,7 @@ - tap_action: action: more-info -# Bathroom ──────────────────────────────────────────────────────────────────────── + # Bathroom ──────────────────────────────────────────────────────────────────────── # Sonos - type: custom:decluttering-card @@ -126,7 +127,7 @@ - tap_action: action: more-info -# Hallway ──────────────────────────────────────────────────────────────────────── + # Hallway ──────────────────────────────────────────────────────────────────────── # Motion - type: custom:decluttering-card diff --git a/config/lovelace/home_dashboard/hallway_dashboard.yaml b/config/lovelace/home_dashboard/hallway_dashboard.yaml index 8f7ccc8..b30967f 100644 --- a/config/lovelace/home_dashboard/hallway_dashboard.yaml +++ b/config/lovelace/home_dashboard/hallway_dashboard.yaml @@ -52,4 +52,3 @@ min_value: 0 max_value: 1000 normal_value: 1000 - diff --git a/config/lovelace/home_dashboard/living_room_dashboard.yaml b/config/lovelace/home_dashboard/living_room_dashboard.yaml index 246f111..6529d0b 100644 --- a/config/lovelace/home_dashboard/living_room_dashboard.yaml +++ b/config/lovelace/home_dashboard/living_room_dashboard.yaml @@ -202,4 +202,3 @@ - progress entity: sensor.multisensor_6_ultraviolet name: Multi UV - diff --git a/config/lovelace/home_dashboard/main_dashboard.yaml b/config/lovelace/home_dashboard/main_dashboard.yaml index 5298017..63982aa 100644 --- a/config/lovelace/home_dashboard/main_dashboard.yaml +++ b/config/lovelace/home_dashboard/main_dashboard.yaml @@ -146,14 +146,18 @@ - default - with_state_indicator entity: input_boolean.alarm_enabled - state_display: "[[[return states['input_datetime.alarm_time'].state.split(':').slice(0, -1).join(':'); ]]]" + state_display: >- + [[[ + const time = states['input_datetime.alarm_time'].state; + return time.split(':').slice(0, -1).join(':'); + ]]] show_state: true show_name: false styles: icon: - - transform: translateY(-8px) # adjusted for state indicator size + - transform: translateY(-8px) # adjusted for state indicator size state: - - transform: translateY(-13px) # adjusted for state indicator size + - transform: translateY(-13px) # adjusted for state indicator size variables: state_indicator_id: automation.alarm_set_time - type: custom:button-card @@ -335,4 +339,3 @@ variables: - player: media_player.bathroom - name: Bathroom - diff --git a/config/lovelace/home_dashboard/master_bedroom_dashboard.yaml b/config/lovelace/home_dashboard/master_bedroom_dashboard.yaml index d07bf54..b38bae0 100644 --- a/config/lovelace/home_dashboard/master_bedroom_dashboard.yaml +++ b/config/lovelace/home_dashboard/master_bedroom_dashboard.yaml @@ -47,14 +47,18 @@ - default - with_state_indicator entity: input_boolean.alarm_enabled - state_display: "[[[return states['input_datetime.alarm_time'].state.split(':').slice(0, -1).join(':'); ]]]" + state_display: >- + [[[ + const time = states['input_datetime.alarm_time'].state; + return time.split(':').slice(0, -1).join(':'); + ]]] show_state: true show_name: false styles: icon: - - transform: translateY(-8px) # adjusted for state indicator size + - transform: translateY(-8px) # adjusted for state indicator size state: - - transform: translateY(-13px) # adjusted for state indicator size + - transform: translateY(-13px) # adjusted for state indicator size variables: state_indicator_id: automation.alarm_set_time - type: custom:button-card @@ -160,4 +164,3 @@ name: Hallway variables: state_indicator_id: automation.lighting_hallway_day_mode_motion_turn_lights_on - diff --git a/config/packages/devices/brita_filter.yaml b/config/packages/devices/brita_filter.yaml index b73789d..d1b970b 100644 --- a/config/packages/devices/brita_filter.yaml +++ b/config/packages/devices/brita_filter.yaml @@ -20,10 +20,15 @@ binary_sensor: brita_should_change_filter: friendly_name: Should change Brita filter device_class: problem - value_template: > + value_template: >- + + {% set liters_check = states('input_number.brita_remaining_liters')|int < 3 %} {% set next_change = states('input_datetime.brita_next_change') %} - {{ states('input_number.brita_remaining_liters') | int < 3 or (as_timestamp(next_change) - as_timestamp(now())) / (3600*24) | round(0) < 3 }} + {% set time_delta = (as_timestamp(next_change) - as_timestamp(now())) %} + {% set date_check = time_delta / (3600*24) | round(0) < 3 %} + + {{ liters_check or date_check }} script: brita_pour_water: diff --git a/config/packages/devices/wallmote.yaml b/config/packages/devices/wallmote.yaml index 7233427..a611394 100644 --- a/config/packages/devices/wallmote.yaml +++ b/config/packages/devices/wallmote.yaml @@ -104,4 +104,3 @@ automation: action: - service: switch.toggle entity_id: switch.titanium - diff --git a/config/packages/modes/house_mode.yaml b/config/packages/modes/house_mode.yaml index 26fd0dd..c21d952 100644 --- a/config/packages/modes/house_mode.yaml +++ b/config/packages/modes/house_mode.yaml @@ -60,4 +60,3 @@ automation: action: - service: input_select.select_next entity_id: input_select.house_mode - diff --git a/config/packages/modules/lighting/by_rooms/kitchen.yaml b/config/packages/modules/lighting/by_rooms/kitchen.yaml index eab023e..c18c26b 100644 --- a/config/packages/modules/lighting/by_rooms/kitchen.yaml +++ b/config/packages/modules/lighting/by_rooms/kitchen.yaml @@ -65,7 +65,7 @@ automation: - light.light_le_12 - light.browser_kitchen data: - brightness_pct: 13 # this is the lowest LE will go ¯\_(ツ)_/¯ + brightness_pct: 13 # this is the lowest LE will go ¯\_(ツ)_/¯ - alias: Lighting · Kitchen · Night mode · Motion · Turn lights off trigger: diff --git a/config/packages/modules/lighting/by_rooms/master_bedroom.yaml b/config/packages/modules/lighting/by_rooms/master_bedroom.yaml index 0ac4fb7..d6dd69e 100644 --- a/config/packages/modules/lighting/by_rooms/master_bedroom.yaml +++ b/config/packages/modules/lighting/by_rooms/master_bedroom.yaml @@ -69,4 +69,3 @@ automation: {% else %} 100 {% endif %} - diff --git a/config/packages/modules/media/music.yaml b/config/packages/modules/media/music.yaml index 0065fd9..a1df501 100644 --- a/config/packages/modules/media/music.yaml +++ b/config/packages/modules/media/music.yaml @@ -20,4 +20,3 @@ script: entity_id: media_player.master_bedroom data_template: source: "{{ playlist | default('Evening Chill') }}" - diff --git a/config/packages/modules/media/youtube.yaml b/config/packages/modules/media/youtube.yaml index 2098118..56710cb 100644 --- a/config/packages/modules/media/youtube.yaml +++ b/config/packages/modules/media/youtube.yaml @@ -21,7 +21,7 @@ shell_command: script: youtube_play_file: - alias: Youtube · Play file + alias: Youtube · Play file sequence: - service: script.sonos_join_bedroom - service: media_player.play_media @@ -65,7 +65,9 @@ script: - service: media_player.play_media entity_id: media_player.master_bedroom data_template: - media_content_id: "{{ states('sensor.sarah_url') }}/local/audio/youtube/{{ states('input_text.youtube_download_name') }}.mp3" + media_content_id: >- + {% set name = states('input_text.youtube_download_name') %} + {{ states('sensor.sarah_url') }}/local/audio/youtube/{{ name }}.mp3 media_content_type: "music" - service: input_text.set_value diff --git a/config/packages/modules/speech.yaml b/config/packages/modules/speech.yaml index 96d477f..4efe0b1 100644 --- a/config/packages/modules/speech.yaml +++ b/config/packages/modules/speech.yaml @@ -64,7 +64,7 @@ script: {% endif %} {% endif %} data_template: - title: "{{ title | default('💬 *Speech Module*') }}" # For telegram only + title: "{{ title | default('💬 *Speech Module*') }}" # For telegram only message: "{{ message }}" sonos_blast: diff --git a/config/packages/modules/system.yaml b/config/packages/modules/system.yaml index 0420dc1..f91be62 100644 --- a/config/packages/modules/system.yaml +++ b/config/packages/modules/system.yaml @@ -7,7 +7,9 @@ binary_sensor: - platform: template sensors: floorplan_night_mode: - value_template: "{{ states('sun.sun') == 'below_horizon' or is_state('input_boolean.floorplan_night_mode', 'on') }}" + value_template: >- + {{ states('sun.sun') == 'below_horizon' + or is_state('input_boolean.floorplan_night_mode', 'on') }} sensor: - platform: command_line @@ -54,14 +56,14 @@ automation: - service: script.say data: message: "Hey! I was out for a bit, but I'm back online!" - # - service: notify.telegram - # data: - # title: "⚙️ *System Module*" - # message: "Ask me to do something anytime!" - # data: - # keyboard: - # - "/guest_mode_on, /guest_mode_off" - # - "/status" + # - service: notify.telegram + # data: + # title: "⚙️ *System Module*" + # message: "Ask me to do something anytime!" + # data: + # keyboard: + # - "/guest_mode_on, /guest_mode_off" + # - "/status" - alias: System · Telegram · Announce status trigger: