Turning off valves if temp of one room is less than another

Hello everyone I’m not sure if this is the right place for this but here i go. I have a heating system that was’t set up properly and now I’m having to fiddle with it as much as i can without spending an arm and leg. I am getting 2 valve controls “https://www.amazon.com/gp/product/B08Q364CCZ/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&th=1” to shut off one of the loops for my main floor.

But i want these valves to be controlled by temp sensors in 2 different rooms.
Basically I want these valves to be closed unless the temp in Room 2 is more than or equal to Room 1.
and to have Valve 1 open 5 seconds before Valve 2 once Room 2 reaches the temp of Room 1.

Then i also need it to close Valve 2 then Valve 1 if Room 2 is less than the temp of Room 1.

I’m using Ecobee room sensors which has helped a little but trying to balance room temps by just cracking open valves has become a pain.
From what I’ve read about these vlaves they work like light switches (on/off), and i should be able to attach them using local tuya or i can flash them to tasmota or something else to directly attach them to home assistant.
I haven’t played with YAML much so I’m not sure how that programming works. So I’m not sure if this is possible.

This is easily possible in HA automations. Define what triggers something to happen (change of temp in Room 2)

In actions, use if-then to add your conditions as to when the valves should open/close and add a wait for time delay between the action to open/close valve 1 and valve 2.

You should be able to do all this in the Automation UI and not have to worry too much about the yaml code.

The problem I’m having is that im getting lost at that when i set it to that sensor it gives me above and below.


I want it to read the current temp.
Do i have to set it as a numeric state?
If i do how do i set that up?
basically if i can figure out how to do this i can figure out how to set up the inverse.

IF kats_room_temperature <= living_room_temp
close valve2
close valve1
delay 00:00:05
ENDIF

No set your trigger as you have done without an above or below value and then use a template condition to check if kats room temp < living room temp. This way it will check everytime the temp changes and only run the actions if the condition is met.

Template condition would be something like…

{{ state(sensor.kats_room_temperature) <= state(sensor.living_room_temperature) }}

@msp1974 If i use the trigger Device or Numeric value i get this error.
“Message malformed: must contain at least one of below, above.”

How do i set it so it checks it like ever 30 seconds or every time the temp in the room changes

I decided to use a time pattern to be the Triger to check for the conditions and i was able to get it to work finally after digging for hours to find a post that i needed to write it like this.

{{ states('sensor.kats_room_temperature') | float <= states('sensor.living_room_temperature') | float }}

now it reades as.

alias: 25 Balance Heat Valve Off
description: ""
trigger:
  - platform: time_pattern
    seconds: "30"
condition:
  - condition: template
    value_template: >-
      {{ states('sensor.kats_room_temperature') | float <=
      states('sensor.living_room_temperature') | float }}
action:
  - type: toggle
    device_id: 3f8c33e0959e6cbed3740711a2c9a08e
    entity_id: switch.office_lights
    domain: switch