-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsunscreen_template.yaml
More file actions
75 lines (73 loc) · 3.63 KB
/
Copy pathsunscreen_template.yaml
File metadata and controls
75 lines (73 loc) · 3.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
###################################################################################
# @author : WJ4IoT inspired by examples from Remb0
# @last update : 04/07/2024
# @configuration : template: !include_dir_merge_list template
# @file : config/template/sunscreen.yaml
# @refresh with : TEMPLATE ENTITIES
# https://www.home-assistant.io/integrations/template/
# @description : Template sensors for sunscreen conditions states
###################################################################################
# Sunscreen
###################################################################################
#### REMARK ####
# refreshing the template entities in developer tools might create an unwanted results
# because they all become temporarily unavailable when the template entities are refreshed
# and can result in a SAFE situation in the group sensor.
# it is therefor advised to create template sensors in the UI (create helpers)
# this will only effect the template sensor you are working on and not all template sensors textual defined
# so use the file ony for cut & paste
- binary_sensor:
# Wind strenght - in km/h
# depening on the type of the sunscreen; please check your sunscreen supplier
- name: 'Sunscreen Criteria Wind'
unique_id: sunscreen_criteria_wind
device_class: problem
state: >-
{% if states('sensor.buienradar_wind_speed')|float >= states('input_number.sunscreen_valid_wind')|float %} True
{% else %} False
{% endif %}
# Almost no rain in the next 60 minutes is predicted
# put this just on ZERO to be on the safe side
# binary_sensor.regensensor_water_leak
- name: 'Sunscreen Criteria Rain'
unique_id: sunscreen_criteria_rain
device_class: problem
state: >-
{% if states('sensor.buienradar_precipitation_forecast_total')|float >= states('input_number.sunscreen_valid_rain')|float %} True
{% else %} False
{% endif %}
# In which months may the automation of the sunscreen work
- name: 'Sunscreen Criteria Month'
unique_id: sunscreen_criteria_month
device_class: problem
state: >-
{% if (now().month >= 5) and (now().month <= 9) %} False
{% else %} True
{% endif %}
# When does the sunscreen catch direct sunlight?: based upon Azimuth
- name: 'Sunscreen Criteria Azimuth'
unique_id: sunscreen_criteria_azimuth
device_class: problem
state: >-
{% if states('sensor.sun_solar_azimuth')|float <= states('input_number.sunscreen_valid_azimuth')|float %} True
{% else %} False
{% endif %}
# When does the sunscreen catch direct sunlight?: based upon elevation
# if elevation is too low sun goes behind trees or under the sunscreen.
- name: 'Sunscreen Criteria Elevation'
unique_id: sunscreen_criteria_elevation
device_class: problem
state: >-
{% if states('sensor.sun_solar_elevation')|float(0) <= states('input_number.sunscreen_valid_elevation')|float %} True
{% else %} False
{% endif %}
# When is there enough light (now based on my own weather station lux sensor before "sensor.buienradar_irradiance")
# this binary sensor is a bit tricky because the value between low and high should remain unchanged
- name: 'Sunscreen Criteria Irradiance'
unique_id: sunscreen_criteria_irradiance
device_class: problem
state: >-
{% if states('sensor.weather_station_illuminance')|int >= states('input_number.sunscreen_valid_irradiance_high')|int %} False
{% elif states('sensor.weather_station_illuminance')|int <= states('input_number.sunscreen_valid_irradiance_low')|int %} True
{% else %} {{ this.state | default(0, true) }}
{% endif %}