Hey All:
So I’ve been straining over this for a while, partially because I’m such a neophyte at this and partially because my coding skills suck.
I have a colour Hue bulb by the front door of my house. It turns on every morning for me before I go to work (and as long as the sun hasn’t risen). I’m up before that anyways. I wanted that bulb to tell me what today would be like as compared to yesterday - bluer if it’s colder, oranger if it’s warmer. I never bother checking the forecast and can never remember what the actual numeric temperature was the next day - I just want to know if I should grab a coat on my way out the door or not.
Here’s my various pieces to make this happen. If you guys spot a refinement, please let me know, but if it’s the kind of “Hey, cool automation” trick that you’d like to show off your toys, please feel free
configuration.yaml:
input_number:
var_weather_difference:
name: Weather Difference
min: -10
max: 10
mode: box
sensor:
- platform: yweather
forecast: 0
name: weather_today
monitored_conditions:
- temp_max
- platform: yweather
forecast: 1
name: weather_tomorrow
monitored_conditions:
- temp_max
automation.yaml
- id: storehightemp
alias: Store difference between today and tomorrow
trigger:
- platform: time
at: '23:00:00'
action:
- service: input_number.set_value
data_template:
entity_id: input_number.var_weather_difference
value: >
{% if ((states('sensor.weather_tomorrow_temperature_max')|int) - (states('sensor.weather_today_temperature_max')|int)) > 10 %}
10
{% elif ((states('sensor.weather_tomorrow_temperature_max')|int) - (states('sensor.weather_today_temperature_max')|int)) < -10 %}
-10
{% else %}
{{(states('sensor.weather_tomorrow_temperature_max')|int) - (states('sensor.weather_today_temperature_max')|int)}}
{% endif %}
- id: ruleFrontLightsOninMorning
alias: Turn on Front Lights in Morning
trigger:
- platform: time
at: '06:30:00'
condition:
- condition: sun
before: sunrise
action:
- service: light.turn_on
data_template:
entity_id: light.front_entrance
brightness_pct: 25
color_temp: >
{{(((states('input_number.var_weather_difference')|int) * 17.35) + 326.5)|int}}
Enjoy!