mirror of
https://github.com/HASwitchPlate/HASPone.git
synced 2025-07-24 03:36:38 +00:00
Revert weather temp display to only support weather entities
This commit is contained in:
parent
75f970f1f4
commit
8194fc273b
126
Home_Assistant/blueprints/hasp_Dim_Screen_with_Sun.yaml
Normal file
126
Home_Assistant/blueprints/hasp_Dim_Screen_with_Sun.yaml
Normal file
@ -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 }}"
|
@ -12,11 +12,17 @@ blueprint:
|
||||
|
||||
<details>
|
||||
|
||||
This automation is designed to work with the full-width buttons found on pages 1-3
|
||||
| Page 0 | Pages 1-3 | Pages 4-5 |
|
||||
|--------|-----------|-----------|
|
||||
|  |  |  |
|
||||
|
||||
| Pages 1-3 |
|
||||
|-----------|
|
||||
|  |
|
||||
| Page 6 | Page 7 | Page 8 |
|
||||
|--------|--------|--------|
|
||||
|  |  |  |
|
||||
|
||||
| Page 9 | Page 10 | Page 11 |
|
||||
|--------|---------|---------|
|
||||
|  |  | 
|
||||
|
||||
</details>
|
||||
|
||||
@ -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
|
||||
|
@ -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.
|
||||
|
||||

|
||||
|
||||
@ -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 -%}
|
||||
|
BIN
images/hasp_Display_Temperature_Color_Icon_Only.png
Normal file
BIN
images/hasp_Display_Temperature_Color_Icon_Only.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 787 B |
Loading…
x
Reference in New Issue
Block a user