#Bo's Code
1 messages · Page 1 of 1 (latest)
Your code:
blueprint:
name: Smart Thermostat
description: 'Based on wind direction thermostat is set to max'
domain: automation
input:
weather:
name: Weather
description: Specify your weather sensor to get the current outside wind direction from.
selector:
entity:
domain: sensor
thermostat:
name: Thermostat
description: Specify your thermostat.
selector:
entity:
domain: climate
wind1:
name: wind1
description: "The ouside wind direction needs to be between this and the next"
default: 123.75
selector:
number:
step: 1
min: 0
max: 360
unit_of_measurement: °
wind2:
name: wind2
default: 236.25
selector:
number:
step: 1
min: 0
max: 360
unit_of_measurement: °
temp_to_set:
name: Temperature
default: 23
selector:
number:
min: 5
max: 30
unit_of_measurement: °
notify_device:
name: Device
description: The device must run the official Home Assistant app to receive notifications.
default: false
selector:
device:
integration: mobile_app
trigger:
platform: numeric_state
entity_id: !input weather
above: !input wind1
below: !input wind2
action:
- service: climate.set_temperature
data_template:
entity_id: !input thermostat
temperature: !input temp_to_set
- domain: mobile_app
type: notify
device_id: !input notify_device
message: "Termostat sat til {{ temperature }}"
Try this:
blueprint:
name: Smart Thermostat
description: 'Based on wind direction thermostat is set to max'
domain: automation
input:
weather:
name: Weather
description: Specify your weather sensor to get the current outside wind direction from.
selector:
entity:
domain: sensor
thermostat:
name: Thermostat
description: Specify your thermostat.
selector:
entity:
domain: climate
wind1:
name: wind1
description: "The ouside wind direction needs to be between this and the next"
default: 123.75
selector:
number:
step: 1
min: 0
max: 360
unit_of_measurement: °
wind2:
name: wind2
default: 236.25
selector:
number:
step: 1
min: 0
max: 360
unit_of_measurement: °
temp_to_set:
name: Temperature
default: 23
selector:
number:
min: 5
max: 30
unit_of_measurement: °
notify_device:
name: Device
description: The device must run the official Home Assistant app to receive notifications.
default: false
selector:
device:
integration: mobile_app
variables:
temperature: !input temp_to_set
trigger:
platform: numeric_state
entity_id: !input weather
above: !input wind1
below: !input wind2
action:
- service: climate.set_temperature
data_template:
entity_id: !input thermostat
temperature: "{{ temperature }}"
- domain: mobile_app
type: notify
device_id: !input notify_device
message: "Termostat sat til {{ temperature }}"
I would do the same with the above and below values, but not the entity because entity_id's are different. @undone quail
will have a look tomorrow, some family emergency is in the way 😕
✅
stupid Q, but its because i have never had the need for it before, but are there a way to run the action every 6 hours even if nothing has changed?
reason is that the heat pump will jump back to the prev. preset if it has not been given any command for 6 hours
so say the wind goes south it will get one command, but if wind stays within the given range for 8 hours the heatpump will only do extra heating for 6
i do plan to publish this in the end, i cant be the only one with the same problem
ie a house that leaks heat out during a storm
The wind speed will not be exactly the same, so it will continually trigger over and over like it is as long as the wind speed is in that range. That also means you will probably get multiple notifications as well.
You would need to think thru your logic path so that you don't get notified once a minute while the wind speed is in the range and to set the termostat back to normal when the wind is down.
So trigger where wind above x for a time period turns the automation on. Then in the automation something like a while wind is above y leave it alone, but if it drops below that change the temp back.
I don't know. You might get it oscillating if the wind is just right. It's a tricky thing.
Draw out the logic on paper, think thru all the scenarios, and then get the code to do that.
Maybe you just set it to single mode, trigger if the wind is above x for a time period, set the temp and notification, and delay 2 hours, then set the temp back. If the wind is still there it will trigger it again right away, but then it's once every couple hours, not once a minute.
i only go by direction for now, but yes south wind at low speed would not be a problem
example of my Q... wind did go south at 11.32 today and have not changed since... its now 7 hours later and the heatpump have turned back to its normal daytime preset
so i got a notification 11.32,
i think the logic would be to check at interval if the condition is still the same, and if the conditions for the same automation are present after 6 hours it should just command the heatpump again, but not send a notification
but yes if the wind direction is changing a lot it would mean a lot of notifications
for now i would call that an edge case since it has to change a lot in direction to trigger
things have been running fine except that when direction does not change for 6 hours the heatpump defaults back to the normal day temp
that one suggest to use Repeat While Loop
to my eyes it looks like what i miss
@atomic cradle
does this look about right?
action:
- repeat:
while:
- condition: numeric_state
entity_id: !input weather
above: !input wind1
below: !input wind2
sequence:
- service: climate.set_temperature
data_template:
entity_id: !input thermostat
temperature: "{{ temperature }}"
- domain: mobile_app
type: notify
device_id: !input notify_device
message: "Termostat sat til {{ temperature }}"
- delay:
hours: 6
minutes: 0
seconds: 0
milliseconds: 0
so far it works fine, forecast says wind direction should stay the same at least 18 hours, goal is for the heatpump to stay in extra heat setting for more than 6 hours since first trigger
action:
- repeat:
while:
- condition: numeric_state
entity_id: !input weather
above: !input wind1
below: !input wind2
sequence:
- service: climate.set_temperature
data_template:
entity_id: !input thermostat
temperature: "{{ temperature }}"
- domain: mobile_app
type: notify
device_id: !input notify_device
message: "Termostat sat til {{ temperature }}"
- delay:
hours: 6
Should be ok. If the value on the delay list is 0, you can leave those off.
Or do
delay: 06:00:00
🙂 i plan to do it as a input too, so far it works fine, not sure if i want to move the notifications outside the while loop
having it inside is a kind of check on that the heatpump gets it command and does not fall back to default
i guess that people could change this themselves and it depends a bit on how often you need to send a command, 4 notifications every 24 hours is not bad, but if wind direction changes a lot it could be a pain in the rear
i do also plan to add wind speed at some point so that direction needs to be right but speed needs to above a certain limit too
but yeah i think i got a good starting point for more long term testing