Turn on heating when conditions are reached

so im having an issue when I tried to automate the my heating turning on in the room if the door is open and the extractor is on can anybody assist please

- id: '1627785560558'
  alias: Bedroom heating
  description: ''
  trigger:
  - type: opened
    platform: device
    device_id: f0c8adf788eb7fcc67743a4d5868b343
    entity_id: binary_sensor.tybf2e3af81e86a36a34sru4
    domain: binary_sensor
  condition:
  - condition: device
    type: is_on
    device_id: 817e86efdfd856d3464bdc8c104fe32d
    entity_id: switch.ty48324655dc4f22a690f5
    domain: switch
  action:
  - service: climate.set_aux_heat
    target:
      entity_id: climate.bedroom_wall_unit
  - wait_for_trigger:
    - type: not_opened
      platform: device
      device_id: f0c8adf788eb7fcc67743a4d5868b343
      entity_id: binary_sensor.tybf2e3af81e86a36a34sru4
      domain: binary_sensor
  - service: climate.turn_off
    target:
      entity_id: climate.bedroom_wall_unit
  mode: single

I think you need to add aux heat in the data-

  - service: climate.set_aux_heat
    target:
      entity_id: climate.bedroom_wall_unit
    data:
      aux_heat: true

It is written in here that aux_heat is not optional.

I’ve tried adding that to the coding still nothing happens (I’m using a sensibo if that changes anything at all here?)

You can test first if the service call is working-

Go to Developer Tools → Services (tab) → On the service, type climate.set_aux_heat → Choose target climate.bedroom_wall_unit → Toggle the Auxiliary heating → Call Service


Also, can you see the debug traces of the automation? See Troubleshooting Automation. Can you post the screenshot here?

I tried that service call which actually didn’t work ( so I believe there is my first problem) - I originally tried climate.turn_on which also didn’t work (however when I call service with that coding it works) - so I tried modifying my coding to be climate.turn_on however it still doesn’t actually work !

when I run the automation to create the debug trace it works (with it switched over to climate.turn_on) however following the automation doesn’t work - do you still want me to post a screenshot of the debug trace?

When you run action in the automation, it skips directly to the action part. Condition is ignored.

Using the service call, what works for your heater/cooler?

ah right - apologies i’m still extremely new to all this and thankyou for your help !

using the call service climate.turn_on it turns on the heater in the bedroom

Can you try this?

Go to Developer Tools → Services (tab) → On the service, type climate.set_hvac_mode → Choose target climate.bedroom_wall_unit → Mark the HVAC Mode → Select heat → Call Service

Yeah mate - that turns on the wall unit as well when I do as you have said.

May I ask what is switch.ty48324655dc4f22a690f5?

Using wait_for_trigger for a very long period of time is not ideal as it will fail if Home Assistant server reboot/crashes. I suggest you have two different trigger for turning on / turning off the heater.

Sure thing,

switch.ty is a door sensor on the bathroom door - so my state is for that to be open (this also turns a light on in the bathroom another automation)

I tried to set this up through the automation interface rather than the coding - maybe that’s my first problem! I only got it to wait for trigger as I could not work out if how I tried to set it up to automatically turn off after time was going to cause an issue.

Do you recommend I set up another automation for when the door closes to turn it all off rather than try and keep everything contained to the one automation?

This is totally fine. You can use Automation Interface while looking at the created YAML to familiarize yourself with YAML.

You can combine those two automations into a single one using choose action as well as trigger ID and trigger condition. This will only work if you are on Home Assistant 2021.7 +.

You can try this YAML code, go to Automation Editor → Click on 3 dots on the top right corner → Edit in YAML → Copy over everything.

I don’t know the correlation between switch.ty and climate.bedroom_wall_unit. Do you also want the heater to be turned off when binary_sensor.tybf2e3af81e86a36a34sru4 is closed with the condition of switch.ty is ON?

alias: Bedroom Heating
description: ''
mode: single
trigger:
  - platform: state
    entity_id: binary_sensor.tybf2e3af81e86a36a34sru4
    to: 'on'
    id: Open
  - platform: state
    entity_id: binary_sensor.tybf2e3af81e86a36a34sru4
    to: 'off'
    id: Close
condition:
  - condition: state
    entity_id: switch.ty48324655dc4f22a690f5
    state: 'on'
action:
  - choose:
      - conditions:
          - condition: trigger
            id: Open
        sequence:
          - service: climate.set_hvac_mode
            target:
              entity_id: climate.bedroom_wall_unit
            data:
              hvac_mode: heat
      - conditions:
          - condition: trigger
            id: Close
        sequence:
          - service: climate.turn_off
            target:
              entity_id: climate.bedroom_wall_unit
    default: []

sorry mate i’ve given you wrong information here , switch.ty is a power point in my ceiling that controls the extractor.

thanks mate , I am currently on 2021.7.4 so this should work when I get this all figured out.

I have copied it over and restarted Hass and it still doesn’t appear to be switching anything on - I might have to try and start again from the beginning and figure out which trigger is giving me problems here.

yes though I do want the bedroom wall to be turned off once the door is closed because the extractor actually works on a humidity sensor - so it will stay on longer than the heater is needed.

EDIT: I know why this possibly isnt working now since I gave you the wrong information - ill edit the coding to suit the switch!

Good! Let me know how it turns out.

unfortunately it still isn’t operating as it should be.

I appreciate the help but I think I need to take this in baby steps and try one trigger at a time and figure out whats going on - possibly theres an issue with my hardware as the coding you provided definitely looks like it should work!

Thanks again for the help mate appreciate it !

alias: Bedroom Heating
description: ''
mode: single
trigger:
  - platform: state
    entity_id: binary_sensor.tybf2e3af81e86a36a34sru4
    to: 'on'
    id: Open
  - platform: state
    entity_id: binary_sensor.tybf2e3af81e86a36a34sru4
    to: 'off'
    id: Close
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: Open
        sequence:
          - service: climate.set_hvac_mode
            target:
              entity_id: climate.bedroom_wall_unit
            data:
              hvac_mode: heat
      - conditions:
          - condition: trigger
            id: Close
        sequence:
          - service: climate.turn_off
            target:
              entity_id: climate.bedroom_wall_unit
    default: []

Just use this first without any condition. Then, try to open and close binary_sensor.tybf2e3af81e86a36a34sru4.

Next, can you clarify want you want to achieve with the automation?

  1. Door Open → Check if Extractor is ON → Set Climate to HEAT
  2. Door Close → Check if Extractor is ?? → Set Climate to OFF

Please write something like the above.

thanks mate but still it isn’t turning on the wall unit - isnt even attempting it.

I’ve tried changing it to another sensor that I know is controlling other things and it still isn’t turning on - I’m wondering if there is possibly an issue with the hvac controller and my set up ?

Ideally would be

  1. Between 7am & 7 Pm → Door open → check if Extractor is On → Set climate to heat
  2. Wait 20 min turn climate OFF

I was only doing door open and closed to see if that was the problem with the automation as the sensor is an “easy” one where as time Id need to wait the 20 min to see if it turns off

Can you try this?

alias: New Automation
description: ''
mode: single
trigger:
  - platform: state
    entity_id: binary_sensor.tybf2e3af81e86a36a34sru4
    to: 'on'
condition: []
action:
  - service: climate.set_hvac_mode
    data:
      hvac_mode: heat
    target:
      entity_id: climate.bedroom_wall_unit

If this doesn’t work, I think either your setup (Sensibo) or your entity name are incorrect.

Can you also check binary_sensor state if you open it? Check it in Developer Tools —> States (tab) —> Type your binary sensor name.

that’s interesting, I’ve checked the binary sensors and they don’t appear to be changing with the door opening,

I tried it with another door sensor and same thing.

I did however change it to a light that is changing when it’s turned on and the Sensibo still did not turn on, It must be an issue with the Sensibo in this case !

as for the names of the entity’s they are all that are generated by Hass when I enter them into the automation and I select the “simple” name e.g. Bathroom door.

I’ll have a dive into Sensibo and try and figure that out for now !