From 3ddd1568fb7e2762dc5879f702aa8fbf20058ac1 Mon Sep 17 00:00:00 2001 From: darthsandmann Date: Mon, 1 Aug 2022 02:00:02 +0200 Subject: [PATCH] Updates --- lovelace/climate/recommendation.yaml | 50 +++++ lovelace/climate/setup.yaml | 58 +++++ lovelace/overview/climate.yaml | 12 +- lovelace/overview/welcome.yaml | 2 +- ...puts.yaml.disabled => climate_inputs.yaml} | 44 ++-- packages/climate/climate_sensors.yaml | 205 ++++++++++++++++++ .../climate/climate_sensors.yaml.disabled | 136 ------------ ui-lovelace.yaml | 13 +- .../custom_card_input_datetime.yaml | 172 +++++++++++++++ .../custom_card_input_number.yaml | 107 +++++++++ 10 files changed, 629 insertions(+), 170 deletions(-) create mode 100644 lovelace/climate/recommendation.yaml create mode 100644 lovelace/climate/setup.yaml rename packages/climate/{climate_inputs.yaml.disabled => climate_inputs.yaml} (66%) create mode 100644 packages/climate/climate_sensors.yaml delete mode 100644 packages/climate/climate_sensors.yaml.disabled create mode 100644 ui_lovelace_minimalist/custom_cards/custom_card_input_datetime.yaml create mode 100644 ui_lovelace_minimalist/custom_cards/custom_card_input_number.yaml diff --git a/lovelace/climate/recommendation.yaml b/lovelace/climate/recommendation.yaml new file mode 100644 index 0000000..6eecafc --- /dev/null +++ b/lovelace/climate/recommendation.yaml @@ -0,0 +1,50 @@ +- type: 'custom:button-card' + template: card_title + name: Recommendation +- type: 'custom:button-card' + template: card_generic + entity: sensor.climate_temp_recommendation + +- type: "horizontal-stack" + cards: + - type: 'custom:button-card' + template: card_generic_swap + entity: sensor.temperature_kai_temperature + variables: + ulm_card_generic_swap_name: inside + - type: 'custom:button-card' + template: card_generic_swap + entity: sensor.temperature_outside_pirateweather + variables: + ulm_card_generic_swap_name: outside + - type: 'custom:button-card' + template: card_generic_swap + entity: sensor.climate_temp_difference + variables: + ulm_card_generic_swap_name: difference + +- type: 'custom:button-card' + template: card_graph + entity: sensor.temperature_kai_temperature + variables: + ulm_card_graph_color: "var(--google-blue)" + ulm_card_graph_name: Temperature + ulm_card_graph_entity: sensor.temperature_kai_temperature + ulm_card_graph_color2: "var(--google-green)" + ulm_card_graph_entity2: sensor.climate_temp + ulm_card_graph_type: fill + ulm_card_graph_hours: 6 + +- type: "horizontal-stack" + cards: + - type: 'custom:button-card' + template: card_generic_swap + entity: sensor.climate_temp + variables: + ulm_card_generic_swap_name: target + - type: 'custom:button-card' + template: card_generic_swap + entity: sensor.climate_temp_min + - type: 'custom:button-card' + template: card_generic_swap + entity: sensor.climate_temp_max \ No newline at end of file diff --git a/lovelace/climate/setup.yaml b/lovelace/climate/setup.yaml new file mode 100644 index 0000000..8e6d9b5 --- /dev/null +++ b/lovelace/climate/setup.yaml @@ -0,0 +1,58 @@ +- type: "vertical-stack" + cards: + - type: 'custom:button-card' + template: card_title + name: Day/Night + - type: "horizontal-stack" + cards: + - type: "custom:button-card" + template: + - card_input_datetime + entity: input_datetime.climate_morning + variables: + ulm_card_input_datetime_name: Day begins at + - type: "custom:button-card" + template: + - card_input_datetime + entity: input_datetime.climate_night + variables: + ulm_card_input_datetime_name: Day ends at + + +- type: "vertical-stack" + cards: + - type: 'custom:button-card' + template: card_title + name: Target Temperature + - type: "horizontal-stack" + cards: + - type: "custom:button-card" + template: card_input_number + entity: input_number.climate_temp_day + variables: + ulm_card_input_number_name: Day + - type: "custom:button-card" + template: card_input_number + entity: input_number.climate_temp_night + variables: + ulm_card_input_number_name: Night + - type: "horizontal-stack" + cards: + - type: "custom:button-card" + template: card_input_number + entity: input_number.climate_temp + variables: + ulm_card_input_number_name: Manual + - type: "custom:button-card" + template: card_input_number + entity: input_number.climate_temp_accuracy + variables: + ulm_card_input_number_name: Accuracy + +- type: "vertical-stack" + cards: + - type: 'custom:button-card' + template: card_input_boolean + entity: input_boolean.climate_auto + variables: + ulm_card_input_boolean_name: Automatic \ No newline at end of file diff --git a/lovelace/overview/climate.yaml b/lovelace/overview/climate.yaml index fe37586..4f4ed00 100644 --- a/lovelace/overview/climate.yaml +++ b/lovelace/overview/climate.yaml @@ -7,16 +7,8 @@ template: custom_card_httpedo13_sun -- type: "custom:button-card" - template: card_weather - entity: weather.dark_sky - variables: - ulm_card_weather_name: " " - ulm_card_weather_primary_info: - - wind_speed - - precipitation_probability - ulm_card_weather_backdrop: - fade: true +- type: custom:simple-weather-card + entity: weather.pirateweather - type: 'custom:button-card' diff --git a/lovelace/overview/welcome.yaml b/lovelace/overview/welcome.yaml index 84b71a5..7606d81 100644 --- a/lovelace/overview/welcome.yaml +++ b/lovelace/overview/welcome.yaml @@ -7,7 +7,7 @@ entity: input_boolean.welcome_collapse variables: ulm_card_welcome_scenes_collapse: input_boolean.welcome_collapse - ulm_weather: "weather.dark_sky" + ulm_weather: weather.pirateweather entity_1: entity_id: scene.light_flux icon: "mdi:theme-light-dark" diff --git a/packages/climate/climate_inputs.yaml.disabled b/packages/climate/climate_inputs.yaml similarity index 66% rename from packages/climate/climate_inputs.yaml.disabled rename to packages/climate/climate_inputs.yaml index b0d7703..9fbf1e8 100644 --- a/packages/climate/climate_inputs.yaml.disabled +++ b/packages/climate/climate_inputs.yaml @@ -3,37 +3,37 @@ ## -------------------------------------------------------------------------------------------------## input_number: climate_temp: - name: Ziel Manuell + name: Target Manual #initial: 21.5 min: 15 max: 29 step: 0.5 - climate_temp_morning: - name: Ziel Morgen + climate_temp_day: + name: Target Day #initial: 20.5 min: 15 max: 29 step: 0.5 climate_temp_night: - name: Ziel Nacht + name: Target Night #initial: 17.0 min: 15 max: 29 step: 0.5 climate_temp_accuracy: - name: Genauigkeit + name: Accuracy #initial: 1 min: 0 max: 5 step: 0.5 climate_temp_offset: - name: Offset Heizung->Temp + name: Offset Climate<->Temp #initial: 1 min: -2 max: 2 step: 0.5 climate_temp_last: - name: Letzte Temp + name: Last Temp min: 0 max: 29 step: 0.01 @@ -41,33 +41,33 @@ input_number: input_datetime: climate_morning: - name: "Morgen" + name: "Day begins" has_time: true has_date: false #initial: "10:00" - climate_morning_weekend: - name: "Morgen Sa" - has_time: true - has_date: false - #initial: "15:30" +# climate_morning_weekend: +# name: "Day begins Sat." +# has_time: true +# has_date: false +# #initial: "15:30" climate_night: - name: "Nacht" + name: "Day ends" has_time: true has_date: false #initial: "23:59" input_boolean: climate_auto: - name: 'Automatisch' + name: 'Automatic' icon: mdi:power #initial: off - climate_power: - name: 'Power' - icon: mdi:power - #initial: off - climate_weekday: - name: 'Wochentag' - #initial: on +# climate_power: +# name: 'Power' +# icon: mdi:power +# #initial: off +# climate_weekday: +# name: 'Weekday' +# #initial: on climate_away: name: 'Away' #initial: off \ No newline at end of file diff --git a/packages/climate/climate_sensors.yaml b/packages/climate/climate_sensors.yaml new file mode 100644 index 0000000..600d13a --- /dev/null +++ b/packages/climate/climate_sensors.yaml @@ -0,0 +1,205 @@ +## -------------------------------------------------------------------------------------------------## +## Sensoren +## -------------------------------------------------------------------------------------------------## +sensor: + ## -----------------------------------------------------------------------------------------------## + ## Berechnung der Temperaturveränderung + ## -----------------------------------------------------------------------------------------------## + - platform: template + sensors: + climate_temp_change: + friendly_name: change in temperature + value_template: > + {% set now = states("sensor.aqara_temperature_kai_temperature")|float %} + {% set last = states("input_number.climate_temp_last")|float %} + {% set change = (now | float - last) | float %} + {% if now == ("0.0"|float) %} {% set change = ("0.0"|float) %} {% endif %} + {{ change | round(2) }} + ## -----------------------------------------------------------------------------------------------## + ## Berechnung der aktuellen Zieltemperatur bzgl Morgen/Nacht, Automatik/Manuell + ## -----------------------------------------------------------------------------------------------## + - platform: template + sensors: + climate_temp: + friendly_name: target temperature + unit_of_measurement: '°C' + value_template: > + {% set auto = states("input_boolean.climate_auto") %} + {% set manual_temp = states("input_number.climate_temp") %} + {% if auto == "off" %} {{ manual_temp }} + {% else %} + {% set time = states("sensor.time") %} + {% set morning = states("input_datetime.climate_morning") %} + {% set night = states("input_datetime.climate_night") %} + {% set morning_temp = states("input_number.climate_temp_day")|float %} + {% set night_temp = states("input_number.climate_temp_night")|float %} + {% if night > morning %} + {% if time > morning and time <= night %} {{ morning_temp|float }} + {% else %} {{ night_temp|float }} {% endif %} + {% else %} + {% if time <= morning and time > night %} {{ morning_temp|float }} + {% else %} {{ night_temp|float }} {% endif %} + {% endif %} + {% endif %} + # Mit Weekday + # - platform: template + # sensors: + # climate_temp: + # friendly_name: target temperature + # unit_of_measurement: '°C' + # value_template: > + # {% set auto = states("input_boolean.climate_auto") %} + # {% set manual_temp = states("input_number.climate_temp") %} + # {% if auto == "off" %} {{ manual_temp }} + # {% else %} + # {% set time = states("sensor.time") %} + # {% set morning = states("sensor.climate_morning") %} + # {% set weekday = states("input_boolean.climate_weekday") %} + # {% if weekday == "on" %} {% set morning = states("input_datetime.climate_morning") %} + # {% else %} {% set morning = states("input_datetime.climate_morning_weekend") %} {% endif %} + # {% set night = states("input_datetime.climate_night") %} + # {% set morning_temp = states("input_number.climate_temp_morning")|float %} + # {% set night_temp = states("input_number.climate_temp_night")|float %} + # {% if night > morning %} + # {% if time > morning and time <= night %} {{ morning_temp|float }} + # {% else %} {{ night_temp|float }} {% endif %} + # {% else %} + # {% if time <= morning and time > night %} {{ morning_temp|float }} + # {% else %} {{ night_temp|float }} {% endif %} + # {% endif %} + # {% endif %} + + + ## -----------------------------------------------------------------------------------------------## + ## Unterer + Oberer Schwellwert + ## -----------------------------------------------------------------------------------------------## + - platform: template + sensors: + climate_temp_min: + friendly_name: target min + unit_of_measurement: '°C' + value_template: > + {% set target = states("sensor.climate_temp")|float %} + {% set accuracy = states("input_number.climate_temp_accuracy")|float %} + {{ target-accuracy|float }} + - platform: template + sensors: + climate_temp_max: + friendly_name: target max + unit_of_measurement: '°C' + value_template: > + {% set target = states("sensor.climate_temp")|float %} + {% set accuracy = states("input_number.climate_temp_accuracy")|float %} + {{ target+accuracy|float }} + ## -----------------------------------------------------------------------------------------------## + ## Recommendation + ## -----------------------------------------------------------------------------------------------## + - platform: template + sensors: + climate_temp_recommendation: + friendly_name: temperature recommendation + value_template: > + {% set min = states("sensor.climate_temp_min")|float %} + {% set max = states("sensor.climate_temp_max")|float %} + {% set target = states("sensor.climate_temp")|float %} + {% set temp_inside = states("sensor.temperature_kai_temperature")|float %} + {% set temp_outside = states("sensor.temperature_outside_pirateweather")|float %} + {% if temp_inside > max %} + {% if temp_inside > temp_outside %} {{ "open window" }} + {% else %} {{ "close window" }} {% endif %} + {% endif %} + {% if temp_inside < min %} {{ "turn the heater on" }} {% endif %} + + + ## -----------------------------------------------------------------------------------------------## + ## Differenz zu Ziel + ## -----------------------------------------------------------------------------------------------## + - platform: template + sensors: + climate_temp_difference: + friendly_name: difference to target + value_template: > + {% if states("sensor.temperature_kai_temperature") == "unknown" %} + {{ 0 | float }} + {% else %} + {{ (states("sensor.temperature_kai_temperature") | float - (states.sensor.climate_temp.state | float) ) | round(2) }} + {% endif %} + unit_of_measurement: '°C' + + + ## -----------------------------------------------------------------------------------------------## + ## Schrittgröße, mit der die Heizung verstellt werden soll, abhängig vom Unterschied zur realen + ## Temperatur + ## Variable Schrittgröße, bei positiv (zu warm) größer, bei negativ (zu kalt) geringer + ## -----------------------------------------------------------------------------------------------## + # - platform: template + # sensors: + # climate_temp_steps: + # friendly_name: increment + # value_template: > + # {% set difference = (states("sensor.climate_temp_difference" ) | float) %} + # {% set zero = ("0.0" | float ) %} + # {% if difference > zero %} + # {% if difference >= ("2.00"|float) %} {% set steps = ( "3.00" | float ) %} + # {% elif difference >= ("1.50"|float) %} {% set steps = ( "1.50" | float ) %} + # {% elif difference >= ("1.00"|float) %} {% set steps = ( "1.00" | float ) %} + # {% elif difference >= ("0.50"|float) %} {% set steps = ( "0.50" | float ) %} + # {% elif difference >= ("0.00"|float) %} {% set steps = ( "0.00" | float ) %} + # {% endif %} + # {% else %} + # {% if difference <= ("-2.00"|float) %} {% set steps = ( "3.00" | float ) %} + # {% elif difference <= ("-1.50"|float) %} {% set steps = ( "1.50" | float ) %} + # {% elif difference <= ("-1.00"|float) %} {% set steps = ( "0.50" | float ) %} + # {% elif difference <= ("-0.50"|float) %} {% set steps = ( "0.50" | float ) %} + # {% elif difference <= ("-0.00"|float) %} {% set steps = ( "0.00" | float ) %} + # {% endif %} + # {% endif %} + # {{ steps }} + ## -----------------------------------------------------------------------------------------------## + ## Berechnung der Temperatur, auf die die Heizung gestellt werden soll, um Zieltemperatur zu + ## erreichen. Berücksichtigung für Genauigkeit, variable Temperaturanpassung und Temperatur- + ## anpassung aufgrund von Offset. Berechnung ob Anpassung Positiv oder Negativ + ## -----------------------------------------------------------------------------------------------## + # - platform: template + # sensors: + # climate_temp_set: + # friendly_name: '-> climate' + # value_template: > + # {% set difference = (states("sensor.climate_temp_difference" ) | float) %} + # {% set change = (states("sensor.climate_temp_change" ) | float) %} + # {% set goal = (states("sensor.climate_temp" ) | float) %} + # {% set temp = (states("sensor.aqara_temperature_kai_temperature") | float ) %} + # {% set climate = (state_attr("climate.kai", "temperature") | float ) %} + # {% if climate < ("15.0" | float ) %} {% set climate = ("15.0" | float) %} {% endif %} + # {% set max = states("sensor.climate_temp") | float %} + # {% set min = states("sensor.climate_temp") | float - (states.input_number.climate_temp_accuracy.state | float) %} + # {% set zero = ("0.0" | float ) %} + # {% set difference_max = ("1.5" | float ) %} + # {% set difference_min = ("-2.0" | float ) %} + # {% set change_max = ("1.0" | float ) %} + # {% set offset = (states("input_number.climate_temp_offset") | float ) %} + # {% set climate_goal = (goal | float + ("2.0" | float) | float - offset) | float %} + # {% set steps = (states("sensor.climate_temp_steps") | float) %} + # {% if difference == zero %} {% set result = climate %} + # {% elif (difference > difference_max) %} {% set result = ("15.0"|float) %} + # {% elif (difference < difference_min) %} {% set result = goal - offset %} + # {% elif difference > zero %} + # {% if (climate_goal <= climate) or (change >= change_max) %} {% set result = goal - offset %} + # {% elif temp > max %} {% set result = (climate | float - steps) | float %} + # {% else %} {% set result = climate %} {% endif %} + # {% elif difference < zero %} + # {% if temp < min %} + # {% set result = (climate | float + steps) | float %} + # {% else %} + # {% if change >= change_max %} + # {% set result = goal - offset %} + # {% else %} + # {% set result = climate %} + # {% endif %} + # {% endif %} + # {% endif %} + # {% if result < ("15.0"|float) %} {{ ("15.0"|float) }} + # {% elif result > ("29.5"|float) %} {{ ("29.5"|float) }} + # {% else %} {{ result }} + # {% endif %} + # unit_of_measurement: '°C' \ No newline at end of file diff --git a/packages/climate/climate_sensors.yaml.disabled b/packages/climate/climate_sensors.yaml.disabled deleted file mode 100644 index bebc158..0000000 --- a/packages/climate/climate_sensors.yaml.disabled +++ /dev/null @@ -1,136 +0,0 @@ -## -------------------------------------------------------------------------------------------------## -## Sensoren -## -------------------------------------------------------------------------------------------------## -sensor: - ## -----------------------------------------------------------------------------------------------## - ## Berechnung der Temperaturveränderung - ## -----------------------------------------------------------------------------------------------## - - platform: template - sensors: - climate_temp_change: - friendly_name: Veränderung - value_template: > - {% set now = states("sensor.aqara_temperature_kai_temperature")|float %} - {% set last = states("input_number.climate_temp_last")|float %} - {% set change = (now | float - last) | float %} - {% if now == ("0.0"|float) %} {% set change = ("0.0"|float) %} {% endif %} - {{ change | round(2) }} - ## -----------------------------------------------------------------------------------------------## - ## Berechnung der aktuellen Zieltemperatur bzgl Morgen/Nacht, Automatik/Manuell - ## -----------------------------------------------------------------------------------------------## - - platform: template - sensors: - climate_temp: - friendly_name: akt. Ziel - unit_of_measurement: '°C' - value_template: > - {% set auto = states("input_boolean.climate_auto") %} - {% set manual_temp = states("input_number.climate_temp") %} - {% if auto == "off" %} {{ manual_temp }} - {% else %} - {% set time = states("sensor.time") %} - {% set morning = states("sensor.climate_morning") %} - {% set weekday = states("input_boolean.climate_weekday") %} - {% if weekday == "on" %} {% set morning = states("input_datetime.climate_morning") %} - {% else %} {% set morning = states("input_datetime.climate_morning_weekend") %} {% endif %} - {% set night = states("input_datetime.climate_night") %} - {% set morning_temp = states("input_number.climate_temp_morning")|float %} - {% set night_temp = states("input_number.climate_temp_night")|float %} - {% if night > morning %} - {% if time > morning and time <= night %} {{ morning_temp|float }} - {% else %} {{ night_temp|float }} {% endif %} - {% else %} - {% if time <= morning and time > night %} {{ morning_temp|float }} - {% else %} {{ night_temp|float }} {% endif %} - {% endif %} - {% endif %} - ## -----------------------------------------------------------------------------------------------## - ## Berechnung von Unterschied zwischen Heizungstemperatur und realer Temperatur - ## -----------------------------------------------------------------------------------------------## - - platform: template - sensors: - climate_temp_difference: - friendly_name: 'akt. Unterschied' - value_template: > - {% if states("sensor.aqara_temperature_kai_temperature") == "unknown" %} - {{ 0 | float }} - {% else %} - {{ ( states("sensor.aqara_temperature_kai_temperature") | float - (states.sensor.climate_temp.state | float) ) | round(2) }} - {% endif %} - unit_of_measurement: '°C' - ## -----------------------------------------------------------------------------------------------## - ## Schrittgröße, mit der die Heizung verstellt werden soll, abhängig vom Unterschied zur realen - ## Temperatur - ## Variable Schrittgröße, bei positiv (zu warm) größer, bei negativ (zu kalt) geringer - ## -----------------------------------------------------------------------------------------------## - - platform: template - sensors: - climate_temp_steps: - friendly_name: 'Schrittgröße' - value_template: > - {% set difference = (states("sensor.climate_temp_difference" ) | float) %} - {% set zero = ("0.0" | float ) %} - {% if difference > zero %} - {% if difference >= ("2.00"|float) %} {% set steps = ( "3.00" | float ) %} - {% elif difference >= ("1.50"|float) %} {% set steps = ( "1.50" | float ) %} - {% elif difference >= ("1.00"|float) %} {% set steps = ( "1.00" | float ) %} - {% elif difference >= ("0.50"|float) %} {% set steps = ( "0.50" | float ) %} - {% elif difference >= ("0.00"|float) %} {% set steps = ( "0.00" | float ) %} - {% endif %} - {% else %} - {% if difference <= ("-2.00"|float) %} {% set steps = ( "3.00" | float ) %} - {% elif difference <= ("-1.50"|float) %} {% set steps = ( "1.50" | float ) %} - {% elif difference <= ("-1.00"|float) %} {% set steps = ( "0.50" | float ) %} - {% elif difference <= ("-0.50"|float) %} {% set steps = ( "0.50" | float ) %} - {% elif difference <= ("-0.00"|float) %} {% set steps = ( "0.00" | float ) %} - {% endif %} - {% endif %} - {{ steps }} - ## -----------------------------------------------------------------------------------------------## - ## Berechnung der Temperatur, auf die die Heizung gestellt werden soll, um Zieltemperatur zu - ## erreichen. Berücksichtigung für Genauigkeit, variable Temperaturanpassung und Temperatur- - ## anpassung aufgrund von Offset. Berechnung ob Anpassung Positiv oder Negativ - ## -----------------------------------------------------------------------------------------------## - - platform: template - sensors: - climate_temp_set: - friendly_name: '-> Heizung' - value_template: > - {% set difference = (states("sensor.climate_temp_difference" ) | float) %} - {% set change = (states("sensor.climate_temp_change" ) | float) %} - {% set goal = (states("sensor.climate_temp" ) | float) %} - {% set temp = (states("sensor.aqara_temperature_kai_temperature") | float ) %} - {% set climate = (state_attr("climate.kai", "temperature") | float ) %} - {% if climate < ("15.0" | float ) %} {% set climate = ("15.0" | float) %} {% endif %} - {% set max = states("sensor.climate_temp") | float %} - {% set min = states("sensor.climate_temp") | float - (states.input_number.climate_temp_accuracy.state | float) %} - {% set zero = ("0.0" | float ) %} - {% set difference_max = ("1.5" | float ) %} - {% set difference_min = ("-2.0" | float ) %} - {% set change_max = ("1.0" | float ) %} - {% set offset = (states("input_number.climate_temp_offset") | float ) %} - {% set climate_goal = (goal | float + ("2.0" | float) | float - offset) | float %} - {% set steps = (states("sensor.climate_temp_steps") | float) %} - {% if difference == zero %} {% set result = climate %} - {% elif (difference > difference_max) %} {% set result = ("15.0"|float) %} - {% elif (difference < difference_min) %} {% set result = goal - offset %} - {% elif difference > zero %} - {% if (climate_goal <= climate) or (change >= change_max) %} {% set result = goal - offset %} - {% elif temp > max %} {% set result = (climate | float - steps) | float %} - {% else %} {% set result = climate %} {% endif %} - {% elif difference < zero %} - {% if temp < min %} - {% set result = (climate | float + steps) | float %} - {% else %} - {% if change >= change_max %} - {% set result = goal - offset %} - {% else %} - {% set result = climate %} - {% endif %} - {% endif %} - {% endif %} - {% if result < ("15.0"|float) %} {{ ("15.0"|float) }} - {% elif result > ("29.5"|float) %} {{ ("29.5"|float) }} - {% else %} {{ result }} - {% endif %} - unit_of_measurement: '°C' \ No newline at end of file diff --git a/ui-lovelace.yaml b/ui-lovelace.yaml index 7673936..54b5dfd 100644 --- a/ui-lovelace.yaml +++ b/ui-lovelace.yaml @@ -65,4 +65,15 @@ views: !include lovelace/pfsense/traffic.yaml - type: "vertical-stack" cards: - !include lovelace/pfsense/rules.yaml \ No newline at end of file + !include lovelace/pfsense/rules.yaml + + + - title: "Climate" + path: 3 + cards: + - type: "vertical-stack" + cards: + !include lovelace/climate/setup.yaml + - type: "vertical-stack" + cards: + !include lovelace/climate/recommendation.yaml \ No newline at end of file diff --git a/ui_lovelace_minimalist/custom_cards/custom_card_input_datetime.yaml b/ui_lovelace_minimalist/custom_cards/custom_card_input_datetime.yaml new file mode 100644 index 0000000..c7cdce2 --- /dev/null +++ b/ui_lovelace_minimalist/custom_cards/custom_card_input_datetime.yaml @@ -0,0 +1,172 @@ +--- +card_input_datetime: + show_name: false + show_icon: false + variables: + ulm_card_input_datetime_name: "n/a" + triggers_update: "all" + styles: + grid: + - grid-template-areas: "'item1' 'item2'" + - grid-template-columns: "1fr" + - grid-template-rows: "min-content min-content" + - row-gap: "12px" + card: + - border-radius: "var(--border-radius)" + - box-shadow: "var(--box-shadow)" + - padding: "12px" + custom_fields: + item1: + card: + type: "custom:button-card" + template: + - "icon_info" + - "ulm_translation_engine" + - "input_datetime" + tap_action: + action: "more-info" + entity: "[[[ return entity.entity_id ]]]" + name: "[[[ return variables.ulm_card_input_datetime_name ]]]" + item2: + card: + type: "custom:button-card" + template: "list_3_items" + custom_fields: + item1: + card: + type: "custom:button-card" + template: "widget_icon" + tap_action: + action: "call-service" + service: "input_datetime.set_datetime" + service_data: + entity_id: "[[[ return entity.entity_id ]]]" + time: > + [[[ + var timestamp = entity.attributes.timestamp + + let unix_timestamp = timestamp - 4500; + // Create a new JavaScript Date object based on the timestamp + // multiplied by 1000 so that the argument is in milliseconds, not seconds. + var date = new Date(unix_timestamp * 1000); + // Hours part from the timestamp + var hours = date.getHours(); + // Minutes part from the timestamp + var minutes = "0" + date.getMinutes(); + // Seconds part from the timestamp + var seconds = "0" + date.getSeconds(); + + // Will display time in 10:30:23 format + var formattedTime = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2); + + return formattedTime; + ]]] + icon: "mdi:arrow-down" + item2: + card: + type: "custom:button-card" + template: "widget_text" + entity: "[[[ return entity.entity_id ]]]" + tap_action: + action: "call-service" + service: "input_datetime.set_datetime" + service_data: + entity_id: "[[[ return entity.entity_id ]]]" + time: > + [[[ + var timestamp = entity.attributes.timestamp + + let unix_timestamp = timestamp - 3540; + // Create a new JavaScript Date object based on the timestamp + // multiplied by 1000 so that the argument is in milliseconds, not seconds. + var date = new Date(unix_timestamp * 1000); + // Hours part from the timestamp + var hours = date.getHours(); + // Minutes part from the timestamp + var minutes = "0" + date.getMinutes(); + // Seconds part from the timestamp + var seconds = "0" + date.getSeconds(); + + // Will display time in 10:30:23 format + var formattedTime = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2); + + return formattedTime; + ]]] + hold_action: + action: "call-service" + service: "input_datetime.set_datetime" + service_data: + entity_id: "[[[ return entity.entity_id ]]]" + time: > + [[[ + var timestamp = entity.attributes.timestamp + + let unix_timestamp = timestamp - 3660; + // Create a new JavaScript Date object based on the timestamp + // multiplied by 1000 so that the argument is in milliseconds, not seconds. + var date = new Date(unix_timestamp * 1000); + // Hours part from the timestamp + var hours = date.getHours(); + // Minutes part from the timestamp + var minutes = "0" + date.getMinutes(); + // Seconds part from the timestamp + var seconds = "0" + date.getSeconds(); + + // Will display time in 10:30:23 format + var formattedTime = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2); + + return formattedTime; + ]]] + + item3: + card: + type: "custom:button-card" + template: "widget_icon" + tap_action: + action: "call-service" + service: "input_datetime.set_datetime" + service_data: + entity_id: "[[[ return entity.entity_id ]]]" + time: > + [[[ + var timestamp = entity.attributes.timestamp + + let unix_timestamp = timestamp - 2700; + var date = new Date(unix_timestamp * 1000); + var hours = date.getHours(); + var minutes = "0" + date.getMinutes(); + var seconds = "0" + date.getSeconds(); + var formattedTime = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2); + + return formattedTime; + ]]] + icon: "mdi:arrow-up" + +input_datetime: + tap_action: + action: "more-info" + show_last_changed: true + +widget_text: + tap_action: + action: "toggle" + template: + - "ulm_translation_engine" + show_icon: false + show_label: true + show_name: false + label: "[[[ return variables.ulm_translation_state_unit ]]]" + styles: + grid: + - grid-template-areas: "'l'" + card: + - box-shadow: "none" + - padding: "0px" + - background-color: "rgba(var(--color-theme),0.05)" + - border-radius: "14px" + - place-self: "center" + - height: "42px" + state: + - color: "rgba(var(--color-theme),0.9)" + size: "20px" + color: "var(--google-grey)" \ No newline at end of file diff --git a/ui_lovelace_minimalist/custom_cards/custom_card_input_number.yaml b/ui_lovelace_minimalist/custom_cards/custom_card_input_number.yaml new file mode 100644 index 0000000..215f17a --- /dev/null +++ b/ui_lovelace_minimalist/custom_cards/custom_card_input_number.yaml @@ -0,0 +1,107 @@ +--- +card_input_number: + variables: + ulm_card_input_number_name: "[[[ return entity.attributes.friendly_name ]]]" + triggers_update: "all" + show_icon: false + show_label: false + show_name: false + styles: + grid: + - grid-template-areas: "'item1' 'item2'" + - grid-template-columns: "1fr" + - grid-template-rows: "min-content min-content" + - row-gap: "12px" + card: + - border-radius: "var(--border-radius)" + - box-shadow: "var(--box-shadow)" + - padding: "12px" + custom_fields: + item1: + card: + type: "custom:button-card" + template: + - "icon_info" + - "ulm_translation_engine" + - "input_number" + tap_action: + action: "more-info" + entity: "[[[ return entity.entity_id ]]]" + name: "[[[ return variables.ulm_card_input_number_name ]]]" + item2: + card: + type: "custom:button-card" + template: "list_3_items" + custom_fields: + item1: + card: + type: "custom:button-card" + template: "widget_icon" + tap_action: + action: "call-service" + service: | + [[[ + if( entity.entity_id.startsWith("input_number.") ) + return "input_number.decrement"; + if( entity.entity_id.startsWith("counter.") ) + return "counter.decrement"; + return ""; + ]]] + service_data: + entity_id: "[[[ return entity.entity_id ]]]" + icon: "mdi:arrow-down" + item2: + card: + type: "custom:button-card" + template: "widget_text" + entity: "[[[ return entity.entity_id ]]]" + tap_action: + action: "call-service" + service: "cover.stop_cover" + service_data: + entity_id: "[[[ return entity.entity_id ]]]" + item3: + card: + type: "custom:button-card" + template: "widget_icon" + tap_action: + action: "call-service" + service: | + [[[ + if( entity.entity_id.startsWith("input_number.") ) + return "input_number.increment"; + if( entity.entity_id.startsWith("counter.") ) + return "counter.increment"; + return ""; + ]]] + service_data: + entity_id: "[[[ return entity.entity_id ]]]" + icon: "mdi:arrow-up" + +input_number: + tap_action: + action: "more-info" + show_last_changed: true + +widget_text: + tap_action: + action: "toggle" + template: + - "ulm_translation_engine" + show_icon: false + show_label: true + show_name: false + label: "[[[ return variables.ulm_translation_state_unit ]]]" + styles: + grid: + - grid-template-areas: "'l'" + card: + - box-shadow: "none" + - padding: "0px" + - border-radius: "14px" + - place-self: "center" + - height: "42px" + state: + - color: "rgba(var(--color-theme),0.9)" + size: "20px" + color: "var(--google-grey)" \ No newline at end of file