From 8194fc273bfdf46425f21e6e48fc103503140e9c Mon Sep 17 00:00:00 2001 From: aderusha Date: Sun, 8 Aug 2021 08:23:01 -0400 Subject: [PATCH] Revert weather temp display to only support weather entities --- .../blueprints/hasp_Dim_Screen_with_Sun.yaml | 126 ++++++++++++++++++ ...p_Display_Temperature_Color_Icon_Only.yaml | 66 +++------ ...play_Temperature_with_Icon_and_Colors.yaml | 33 +---- ...sp_Display_Temperature_Color_Icon_Only.png | Bin 0 -> 787 bytes 4 files changed, 147 insertions(+), 78 deletions(-) create mode 100644 Home_Assistant/blueprints/hasp_Dim_Screen_with_Sun.yaml create mode 100644 images/hasp_Display_Temperature_Color_Icon_Only.png diff --git a/Home_Assistant/blueprints/hasp_Dim_Screen_with_Sun.yaml b/Home_Assistant/blueprints/hasp_Dim_Screen_with_Sun.yaml new file mode 100644 index 0000000..866cf3f --- /dev/null +++ b/Home_Assistant/blueprints/hasp_Dim_Screen_with_Sun.yaml @@ -0,0 +1,126 @@ +blueprint: + name: "HASP dims the backlight with the sun" + description: | + + # Description + + Dim the HASPone backlight in response to the sun going up and down. + + domain: automation + input: + haspdevice: + name: "HASP Device" + description: "Select the HASP device" + selector: + device: + integration: mqtt + manufacturer: "HASwitchPlate" + model: "HASPone v1.0.0" + brightday: + name: "Daytime brightness value" + description: "Select the brightness value to be set during full daylight." + default: 100 + selector: + number: + min: 1 + max: 100 + mode: slider + unit_of_measurement: "%" + brightnight: + name: "Nighttime brightness value" + description: "Select the brightness value to be set during the night." + default: 5 + selector: + number: + min: 0 + max: 100 + mode: slider + unit_of_measurement: "%" + elevationday: + name: "Daytime sun elevation" + description: "Sun elevation to begin transition at night and to end transition in the morning. Value must be greater than the nighttime elevation set below." + default: 6 + selector: + number: + min: -90 + max: 90 + step: 1 + mode: slider + unit_of_measurement: "°" + elevationnight: + name: "Nighttime sun elevation" + description: "Sun elevation to end transition at night and to begin transition in the morning. Value must be less than the daytime elevation set above." + default: -6 + selector: + number: + min: -90 + max: 90 + step: 1 + mode: slider + unit_of_measurement: "°" + +mode: parallel +max_exceeded: silent + +variables: + haspdevice: !input haspdevice + haspname: >- + {%- for entity in device_entities(haspdevice) -%} + {%- if entity|regex_search("^sensor\.") -%} + {{- entity|regex_replace(find="^sensor\.", replace="", ignorecase=true)|regex_replace(find="_sensor(?:_\d+|)$", replace="", ignorecase=true) -}} + {%- endif -%} + {%- endfor -%} + haspsensor: >- + {%- for entity in device_entities(haspdevice) -%} + {%- if entity|regex_search("^sensor\..+_sensor(?:_\d+|)$") -%} + {{ entity }} + {%- endif -%} + {%- endfor -%} + brightday: !input brightday + brightnight: !input brightnight + elevationday: !input elevationday + elevationnight: !input elevationnight + lightcommandtopic: "{{ 'hasp/' ~ haspname ~ '/brightness/set' }}" + +trigger: + - platform: state + entity_id: sun.sun + attribute: elevation + +condition: + - condition: template + value_template: "{{ is_state(haspsensor, 'ON') }}" + - condition: template + value_template: "{{ state_attr('sun.sun', 'elevation') | round <= elevationday }}" + - condition: template + value_template: "{{ state_attr('sun.sun', 'elevation') | round >= elevationnight }}" + +action: + - choose: + ######################################################################### + # Sun elevation is approximately equal to or greater than daytime value, send brightday + - conditions: + - condition: template + value_template: "{{ state_attr('sun.sun', 'elevation') | round >= elevationday }}" + sequence: + - service: mqtt.publish + data: + topic: "{{ lightcommandtopic }}" + payload: "{{ brightday | int }}" + ######################################################################### + # Sun elevation is approximately equal to or less than nighttime value, send brightnight + - conditions: + - condition: template + value_template: "{{ state_attr('sun.sun', 'elevation') | round <= elevationnight }}" + sequence: + - service: mqtt.publish + data: + topic: "{{ lightcommandtopic }}" + payload: "{{ brightnight | int }}" + ######################################################################### + # Sun elevation is in transition range, send calculated brightness value + default: + - service: mqtt.publish + data: + topic: "{{ lightcommandtopic }}" + payload: "{{ (brightnight + ((brightday - brightnight) / (elevationday - elevationnight)) * (state_attr('sun.sun', 'elevation') - elevationnight)) | round | int }}" diff --git a/Home_Assistant/blueprints/hasp_Display_Temperature_Color_Icon_Only.yaml b/Home_Assistant/blueprints/hasp_Display_Temperature_Color_Icon_Only.yaml index 3d34664..a1e5f0a 100644 --- a/Home_Assistant/blueprints/hasp_Display_Temperature_Color_Icon_Only.yaml +++ b/Home_Assistant/blueprints/hasp_Display_Temperature_Color_Icon_Only.yaml @@ -12,11 +12,17 @@ blueprint:
- This automation is designed to work with the full-width buttons found on pages 1-3 + | Page 0 | Pages 1-3 | Pages 4-5 | + |--------|-----------|-----------| + | ![Page 0](https://raw.githubusercontent.com/HASwitchPlate/HASPone/main/images/NextionUI_p0_Init_Screen.png) | ![Pages 1-3](https://raw.githubusercontent.com/HASwitchPlate/HASPone/main/images/NextionUI_p1-p3_4buttons.png) | ![Pages 4-5](https://raw.githubusercontent.com/HASwitchPlate/HASPone/main/images/NextionUI_p4-p5_3sliders.png) | - | Pages 1-3 | - |-----------| - | ![Pages 1-3](https://raw.githubusercontent.com/HASwitchPlate/HASPone/main/images/NextionUI_p1-p3_4buttons.png) | + | Page 6 | Page 7 | Page 8 | + |--------|--------|--------| + | ![Page 6](https://raw.githubusercontent.com/HASwitchPlate/HASPone/main/images/NextionUI_p6_8buttons.png) | ![Page 7](https://raw.githubusercontent.com/HASwitchPlate/HASPone/main/images/NextionUI_p7_12buttons.png) | ![Page 8](https://raw.githubusercontent.com/HASwitchPlate/HASPone/main/images/NextionUI_p8_5buttons+1slider.png) | + + | Page 9 | Page 10 | Page 11 | + |--------|---------|---------| + | ![Page 9](https://raw.githubusercontent.com/HASwitchPlate/HASPone/main/images/NextionUI_p9_9buttons.png) | ![Page 10](https://raw.githubusercontent.com/HASwitchPlate/HASPone/main/images/NextionUI_p10_5buttons.png) | ![Page 11](https://raw.githubusercontent.com/HASwitchPlate/HASPone/main/images/NextionUI_p11_1button+1slider.png)
@@ -53,7 +59,7 @@ blueprint: model: "HASPone v1.0.0" hasppage: name: "HASP Page" - description: "Select the HASP page (1-3) for the temperature. Refer to the HASP Page and Button reference above." + description: "Select the HASP page (1-11) for the temperature icon. Refer to the HASP Page and Button reference above." default: 1 selector: number: @@ -63,7 +69,7 @@ blueprint: unit_of_measurement: page haspbutton: name: "HASP Button" - description: "Select the HASP button (4-7) for the temperature. Refer to the HASP Page and Button reference above." + description: "Select the HASP button (4-15) for the temperature icon. Refer to the HASP Page and Button reference above." default: 4 selector: number: @@ -73,24 +79,11 @@ blueprint: unit_of_measurement: button weather_provider: name: "Weather provider" - description: "Select the weather provider to obtain the current outdoor temperature. If a temperature sensor is selected below, that will override this selection." + description: "Select the weather provider to obtain the current outdoor temperature." default: selector: entity: domain: weather - temperature_sensor: - name: "Temperature sensor" - description: "Select a temperature sensor. If selected, this state of this sensor will be displayed instead of the weather provider selected above." - default: - selector: - entity: - domain: sensor - temperature_attribute: - name: "Temperature sensor state or attribute to monitor" - description: "Enter `state` to track the state of the sensor above, or enter an attribute name if the sensor has a specific attribute you want to track. Most uses will leave this set to `state`." - default: "state" - selector: - text: thermometer_empty_color: name: "Thermometer empty color" description: 'Icon color for an empty thermometer in Nextion RGB565 format (see "Nextion color codes" above for reference). -1 = Current theme foreground color, or 2047 = Ice blue' @@ -192,8 +185,6 @@ variables: hasppage: !input hasppage haspbutton: !input haspbutton weather_provider: !input weather_provider - temperature_sensor: !input temperature_sensor - temperature_attribute: !input temperature_attribute thermometer_empty_color: !input thermometer_empty_color thermometer_quarter_threshold: !input thermometer_quarter_threshold thermometer_quarter_color: !input thermometer_quarter_color @@ -206,17 +197,9 @@ variables: haspobject: '{{ "p[" ~ hasppage ~ "].b[" ~ haspbutton ~ "]" }}' commandtopic: '{{ "hasp/" ~ haspname ~ "/command/" ~ haspobject }}' jsoncommandtopic: '{{ "hasp/" ~ haspname ~ "/command/json" }}' - jsontopic: '{{ "hasp/" ~ haspname ~ "/state/json" }}' - temperature_value: >- - {%- if temperature_sensor|lower == "none" -%} - {{- state_attr(weather_provider, "temperature") -}} - {%- elif temperature_attribute|lower == "state" -%} - {{- states(temperature_sensor) -}} - {%- else -%} - {{- state_attr(temperature_sensor, temperature_attribute) -}} - {%- endif -%} + temperature: '{{ state_attr(weather_provider, "temperature") }}' icon: >- - {%- set temp = temperature_value|int -%} + {%- set temp = temperature|int -%} {%- if temp <= thermometer_quarter_threshold|int -%}  {%- elif temp < thermometer_half_threshold|int -%} @@ -228,23 +211,9 @@ variables: {%- else -%}  {%- endif -%} - text: "{{temperature_value}}" font: 8 - ypos: "{{(haspbutton|int - 4) * 67 + 2}}" - xpos: 0 - iconwidth: 40 - iconheight: 65 - iconfont: 8 xcen: 1 ycen: 1 - activepage: >- - {%- set activepage = namespace() -%} - {%- for entity in device_entities(haspdevice) -%} - {%- if entity|regex_search("^number\..*_active_page(?:_\d+|)$") -%} - {%- set activepage.entity=entity -%} - {%- endif -%} - {%- endfor -%} - {% if states(activepage.entity)|lower == "none" %}-1{% else %}{{ states(activepage.entity) | int }}{% endif %} selectedfgtopic: '{{ "hasp/" ~ haspname ~ "/light/selectedforegroundcolor/rgb" }}' selectedbgtopic: '{{ "hasp/" ~ haspname ~ "/light/selectedbackgroundcolor/rgb" }}' unselectedfgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedforegroundcolor/rgb" }}' @@ -298,7 +267,7 @@ variables: {%- set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int -%} {{ (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) + (blue|bitwise_and(248)/8)|int }} tempcolor: >- - {%- set temp = temperature_value|int -%} + {%- set temp = temperature|int -%} {%- if temp <= thermometer_quarter_threshold|int -%} {%- set color = thermometer_empty_color -%} {%- elif temp < thermometer_half_threshold|int -%} @@ -330,7 +299,6 @@ trigger_variables: {{ entity }} {%- endif -%} {%- endfor -%} - jsontopic: '{{ "hasp/" ~ haspname ~ "/state/json" }}' selectedfgtopic: '{{ "hasp/" ~ haspname ~ "/light/selectedforegroundcolor/rgb" }}' selectedbgtopic: '{{ "hasp/" ~ haspname ~ "/light/selectedbackgroundcolor/rgb" }}' unselectedfgtopic: '{{ "hasp/" ~ haspname ~ "/light/unselectedforegroundcolor/rgb" }}' @@ -343,8 +311,6 @@ trigger: value_template: "{{ is_state(haspsensor, 'ON') }}" - platform: homeassistant event: start - - platform: mqtt - topic: "{{jsontopic}}" - platform: mqtt topic: "{{selectedfgtopic}}" - platform: mqtt diff --git a/Home_Assistant/blueprints/hasp_Display_Temperature_with_Icon_and_Colors.yaml b/Home_Assistant/blueprints/hasp_Display_Temperature_with_Icon_and_Colors.yaml index da4b692..8bccb05 100644 --- a/Home_Assistant/blueprints/hasp_Display_Temperature_with_Icon_and_Colors.yaml +++ b/Home_Assistant/blueprints/hasp_Display_Temperature_with_Icon_and_Colors.yaml @@ -1,10 +1,10 @@ blueprint: - name: "HASP p[x].b[y] displays the current temperature with icon and colors" + name: "HASP p[x].b[y] displays the current weather temperature with icon and colors" description: | # Description - A HASP button displays the current temperature on the right with a dynamic thermometer icon on the left and (optional) colors. + A HASP button displays the current weather temperature on the right with a dynamic thermometer icon on the left and (optional) colors. ![Preview](https://raw.githubusercontent.com/HASwitchPlate/HASPone/main/images/hasp_Display_Temperature_with_Icon_and_Colors.png) @@ -73,24 +73,11 @@ blueprint: unit_of_measurement: button weather_provider: name: "Weather provider" - description: "Select the weather provider to obtain the current outdoor temperature. If a temperature sensor is selected below, that will override this selection." + description: "Select the weather provider to obtain the current outdoor temperature." default: selector: entity: domain: weather - temperature_sensor: - name: "Temperature sensor" - description: "Select a temperature sensor. If selected, this state of this sensor will be displayed instead of the weather provider selected above." - default: - selector: - entity: - domain: sensor - temperature_attribute: - name: "Temperature sensor state or attribute to monitor" - description: "Enter `state` to track the state of the sensor above, or enter an attribute name if the sensor has a specific attribute you want to track. Most uses will leave this set to `state`." - default: "state" - selector: - text: suffix_select: name: "Temperature display suffix" description: "Suffix for temperature display." @@ -215,8 +202,6 @@ variables: hasppage: !input hasppage haspbutton: !input haspbutton weather_provider: !input weather_provider - temperature_sensor: !input temperature_sensor - temperature_attribute: !input temperature_attribute suffix_select: !input suffix_select thermometer_empty_color: !input thermometer_empty_color thermometer_quarter_threshold: !input thermometer_quarter_threshold @@ -233,19 +218,11 @@ variables: commandtopic: '{{ "hasp/" ~ haspname ~ "/command/" ~ haspobject }}' jsoncommandtopic: '{{ "hasp/" ~ haspname ~ "/command/json" }}' jsontopic: '{{ "hasp/" ~ haspname ~ "/state/json" }}' - temperature_value: >- - {%- if temperature_sensor|lower == "none" -%} - {{- state_attr(weather_provider, "temperature") -}} - {%- elif temperature_attribute|lower == "state" -%} - {{- states(temperature_sensor) -}} - {%- else -%} - {{- state_attr(temperature_sensor, temperature_attribute) -}} - {%- endif -%} temperature: >- {%- if roundtemp == true -%} - {{- temperature_value | round -}} + {{- state_attr(weather_provider, "temperature") | round -}} {%- else -%} - {{- temperature_value -}} + {{- state_attr(weather_provider, "temperature") -}} {%- endif -%} icon: >- {%- set temp = temperature|int -%} diff --git a/images/hasp_Display_Temperature_Color_Icon_Only.png b/images/hasp_Display_Temperature_Color_Icon_Only.png new file mode 100644 index 0000000000000000000000000000000000000000..1433711d01c2790ae53e653eb65dcc63cccfe57c GIT binary patch literal 787 zcmeAS@N?(olHy`uVBq!ia0vp^l|byu!2~29D%?8(q!^2X+?^QKos)S9a~60+7BevL9R^{>)EG+2%1Bim*Je%T*_SW$mgz5=Jbxlz|^ld zb|`4Q-dO0kWg8#=>rHizF#@L98oSqQKJ|;W(DBNe?65C2*6ogw_LAZ*XLrdtzU9`8 z+^>M4JLFn2iZ#+}b6X6qT$`~_uOn}Zo8^D+mg`b+rt`Vm95?g5=X&w}`2()?r88E2 z)9IW4b-~u%`)fH?IAzJIZH;|*Ae_IdR;--863Bn1?t?(S{Q%Qn~gdg8B-i{jR{{D9TrAM!Rv zw7*_Hw@ZD=wTFF+ejkar{;cjdUtsGMsg+lG^8Ws_$}z27^&zU=^Htebiz&G?^WQ-`2Ee-pAJU&?Q^?Ny{?e)Mk%i!ti=d#Wzp$Pz%t7&ln literal 0 HcmV?d00001