Can sameone help me with this blueprint - for water heating control?
Won’t trigger when water temperature is under min_temp
blueprint:
name: Water Heating Control
description: Control your hot water with options for person home, if temp is below a specific value, set temp, and heating between specific times.
domain: automation
input:
heating:
name: Water Heater Device
description: The water heater device to use.
selector:
entity:
domain: switch
temp_sensor:
name: Temperature Sensor
description: Temperature Sensor to check.
selector:
entity:
domain: sensor
device_class: temperature
person1:
name: Person 1
description: The first person that has to be home.
default: []
selector:
entity:
domain: person
person2:
name: Person 2
description: The second person that has to be home.
default: []
selector:
entity:
domain: person
person3:
name: Person 3
description: The third person that has to be home.
default: []
selector:
entity:
domain: person
person4:
name: Person 4
description: The forth person that has to be home.
default: []
selector:
entity:
domain: person
person5:
name: Person 5
description: The fifth person that has to be home.
default: []
selector:
entity:
domain: person
person6:
name: Person 6
description: The sixth person that has to be home.
default: []
selector:
entity:
domain: person
min_temp:
name: Minimum Temp
description: If temperature is below this value and someone is home, It turns heating on.
default: []
selector:
entity:
domain: input_number
set_temp:
name: Temperature Target
description: If the heating turns on, It heats to this target temperature.
default: []
selector:
entity:
domain: input_number
time_after:
name: Time After
description: After this time the water heating turns on, so water is warm in the morning
default: []
selector:
entity:
domain: input_datetime
time_before:
name: Time Before
description: After this time the water heating turns off, This to prevent the water heating is on in the middle of the night
default: []
selector:
entity:
domain: input_datetime
variables:
set_temp: !input set_temp
trigger:
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
- platform: time_pattern
minutes: /10
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: !input 'temp_sensor'
below: !input min_temp
- condition: time
before: !input 'time_before'
after: !input 'time_after'
- condition: or
conditions:
- condition: state
entity_id: !input 'person1'
state: home
- condition: state
entity_id: !input 'person2'
state: home
- condition: state
entity_id: !input 'person3'
state: home
- condition: state
entity_id: !input 'person4'
state: home
- condition: state
entity_id: !input 'person5'
state: home
- condition: state
entity_id: !input 'person6'
state: home
sequence:
- service: switch.turn_on
data:
entity_id: !input 'heating'
default:
- service: switch.turn_off
data:
entity_id: !input 'heating'
mode: single
Ah, okay. But that’s how the blueprint is designed, it only has a time trigger. If you don’t like that, don’t use it. I think polling (aka, have a periodic time trigger) is bad practice as well. You can just remake this blueprint (or just as a plan automation for that matter), that uses the persons and the temperature as trigger as well.
Somewhere in blueprint I must put when set_temp is reached turn off water heater, and do not turn on water heater until water temperature is beow min_temp.
But why use a blueprint? Do you have more water heaters?
And yeah, you can make a better automation or blueprint. Just remove the time-patern as a trigger and replace it with all the things that will actually effect when you want to switch. Aka, the state of the persons, the actual temperature and the set temperature.
Here is my latest version of blueprint, I am testing it now:
I have another question, it is possible to add in blueprint add person option, so if anyone have different number of persons can use this blueprint?
blueprint:
name: Water Heating Control
description: Control your hot water with options for person home, if temp is below a specific value, set temp, and heating between specific times.
domain: automation
input:
heating:
name: Water Heater Device
description: The water heater device to use.
selector:
entity:
domain: switch
temp_sensor:
name: Temperature Sensor
description: Temperature Sensor to check.
selector:
entity:
domain: sensor
device_class: temperature
person1:
name: Person 1
description: The first person that has to be home.
default: []
selector:
entity:
domain: person
person2:
name: Person 2
description: The second person that has to be home.
default: []
selector:
entity:
domain: person
person3:
name: Person 3
description: The third person that has to be home.
default: []
selector:
entity:
domain: person
person4:
name: Person 4
description: The forth person that has to be home.
default: []
selector:
entity:
domain: person
person5:
name: Person 5
description: The fifth person that has to be home.
default: []
selector:
entity:
domain: person
person6:
name: Person 6
description: The sixth person that has to be home.
default: []
selector:
entity:
domain: person
min_temp:
name: Minimum Temp
description: If temperature is below this value and someone is home, It turns heating on.
default: []
selector:
entity:
domain: input_number
set_temp:
name: Temperature Target
description: If the heating turns on, It heats to this target temperature.
default: []
selector:
entity:
domain: input_number
time_after:
name: Time After
description: After this time the water heating turns on, so water is warm in the morning
default: []
selector:
entity:
domain: input_datetime
time_before:
name: Time Before
description: After this time the water heating turns off, This to prevent the water heating is on in the middle of the night
default: []
selector:
entity:
domain: input_datetime
variables:
set_temp: !input set_temp
min_temp: !input min_temp
trigger:
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
- platform: numeric_state
entity_id: !input 'temp_sensor'
below: !input min_temp
- platform: numeric_state
entity_id: !input 'temp_sensor'
above: !input set_temp
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: !input 'temp_sensor'
below: !input min_temp
- condition: time
before: !input 'time_before'
after: !input 'time_after'
- condition: or
conditions:
- condition: state
entity_id: !input 'person1'
state: home
- condition: state
entity_id: !input 'person2'
state: home
- condition: state
entity_id: !input 'person3'
state: home
- condition: state
entity_id: !input 'person4'
state: home
- condition: state
entity_id: !input 'person5'
state: home
- condition: state
entity_id: !input 'person6'
state: home
sequence:
- service: switch.turn_on
data:
entity_id: !input 'heating'
- conditions:
- condition: numeric_state
entity_id: !input 'temp_sensor'
above: !input set_temp
sequence:
- service: switch.turn_off
data:
entity_id: !input 'heating'
mode: single
But again, why the blueprint? Especially because in the application of the Blueprint you have it set to run almost all day making the time restriction inputs useless.
As for the function, you also want to add the state of all persons to the mix. Otherwise it will not heat the water when you return home or stop the heating the moment you leave (but only stop once the temperature is reached).
I want that, because of that I didn’t add persons in off choice.
Why? If wather temp is below minimum It will start heat when first person come home.
It is possible to replace this with add person? How?
person1:
name: Person 1
description: The first person that has to be home.
default: []
selector:
entity:
domain: person
person2:
name: Person 2
description: The second person that has to be home.
default: []
selector:
entity:
domain: person
person3:
name: Person 3
description: The third person that has to be home.
default: []
selector:
entity:
domain: person
person4:
name: Person 4
description: The forth person that has to be home.
default: []
selector:
entity:
domain: person
person5:
name: Person 5
description: The fifth person that has to be home.
default: []
selector:
entity:
domain: person
person6:
name: Person 6
description: The sixth person that has to be home.
default: []
selector:
entity:
domain: person
Okay, thank you for clearing that up. Now I know I’m not wasting my time on Blueprints when a simple automation would do
No, because persons are not a trigger now. So it will only trigger the moment the temperature goes to low. But if nobody was home at that very moment it will not turn on the heater. Because the persons are not a trigger nothing will retrigger the automation to turn on the heater again
So same goes for off, a person leaving will not trigger the automation. Only when the set point is reached the automation will trigger and stop the heating.
But in this case, I would say it’s easier to put all people in a group and use that in the blueprint. That way it does not matter if you want to use it on 2 or on 200 persons. See Group - Home Assistant
Think it would look like:
blueprint:
name: Water Heating Control
description: Control your hot water with options for person home, if temp is below a specific value, set temp, and heating between specific times.
domain: automation
input:
heating:
name: Water Heater Device
description: The water heater device to use.
selector:
entity:
domain: switch
temp_sensor:
name: Temperature Sensor
description: Temperature Sensor to check.
selector:
entity:
domain: sensor
device_class: temperature
persons:
name: All persons
description: Group of all persons who need to controll this BP. (Set 'all: false' for the group.)
default: []
selector:
entity:
domain: group
min_temp:
name: Minimum Temp
description: If temperature is below this value and someone is home, It turns heating on.
default: []
selector:
entity:
domain: input_number
set_temp:
name: Temperature Target
description: If the heating turns on, It heats to this target temperature.
default: []
selector:
entity:
domain: input_number
time_after:
name: Time After
description: After this time the water heating turns on, so water is warm in the morning
default: []
selector:
entity:
domain: input_datetime
time_before:
name: Time Before
description: After this time the water heating turns off, This to prevent the water heating is on in the middle of the night
default: []
selector:
entity:
domain: input_datetime
variables:
set_temp: !input set_temp
min_temp: !input min_temp
trigger:
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
- platform: numeric_state
entity_id: !input 'temp_sensor'
below: !input min_temp
- platform: numeric_state
entity_id: !input 'temp_sensor'
above: !input set_temp
- platform: state
entity_id: !input 'persons'
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: !input 'temp_sensor'
below: !input min_temp
- condition: time
before: !input 'time_before'
after: !input 'time_after'
- condition: state
entity_id: !input 'persons'
state: home
sequence:
- service: switch.turn_on
data:
entity_id: !input 'heating'
- conditions:
- condition: numeric_state
entity_id: !input 'temp_sensor'
above: !input set_temp
sequence:
- service: switch.turn_off
data:
entity_id: !input 'heating'
mode: single
Couple of notes on that:
I think you should add hysteresis to the temperature. Otherwise it will turn on and off quite often.
You should also add time as a trigger (both time_before and time_after). Because otherwise you have the same as with the persons aka it will not start heating in the morning nor will it stop right away in the night.
If you want to be able to use the BP for situations you want it 24h a day, OR the current time-condition with a template condition checking that both input times are the same. That way if you set them both the same it will render true all day.