🚽 Toilet Exhaust Fan - Time Delay - Trigger Wait Time - Time

Yeah. That’s the problem. I wanted the fan to turn on using the switch because that’s what all the rest of the family uses. It does work with turning it on via the toggle helper.

@pinkchry

The problem you have is if the automation turns ON the fan it is the same as turning ON the switch. It is the same entity. So if you use the switch for the manual fan then every time the fan is turned ON with the automation it turns ON the manual switch. Hope you can see the conflict. So the manual switch must be totally independent.

So what you can do is get a Shelly 2PM and use one contact for the fan and the other for the manual switch. Wire the manual switch to the switch on the wall not the fan.

Blacky :smiley:

Ok. So my switches are from hubitat and it added a switch to fan helper “Change device type of switch”). I can use that for the automation and it works as now there are two entities that control the fan. Haven’t figured out how to make such a helper myself but that sounds like a possible workaround

@pinkchry

Nice one, glad you are up and running.

Blacky :smiley:

@Blacky

Great automation - thank you so much. I’m seeing a weird edge case. I’ve got two switches, both wired separately to Shellys - light, fan. Also have a zigbee motion sensor.

If I just set up the motion sensor → fan, it all works fine, turns on, turns off. What I’d like to do is add the light switch as the ‘manual fan switch’. First problem - it’s a light, not a switch - so I added a template switch that is just based on the value of the light.

I add that into the ‘manual fan switch’ and it works if I don’t trigger the motion sensor. I can turn on the light, the fan turns on, I can turn off the light, the fan turns off. However, if the light is off, and I enter the bathroom, triggering the motion sensor, then I turn the light on manually, then turn it off again, the fan remain on - and never turns off.

Any tips?
Thanks,
Cemil

@cemil

I have just tested it here again and it works perfectly. I Had

  • Motion as the Trigger Sensor
  • Fan in fan
  • Light in Manual Fan Switch

Could you please provide us your YAML of the automation? This YAML code are the settings you have selected in the automation so I can help. To do this go into your automation, top right 3 dots, Edit in YAML, copy all the code, come back to the forum and in your reply at the top tool bar click on “</>” and paste code in there.

Blacky :smiley:

Hi @blacky,

alias: Downstairs Bathroom Exhaust Fan
description: ""
use_blueprint:
  path: Blackshome/toilet-exhaust-fan.yaml
  input:
    entity_trigger: binary_sensor.lumi_lumi_sensor_motion_aq2_motion
    fan_switch: switch.downstairs_bathroom_fan
    time_delay: 1
    include_manual_fan_switch: enable_manual_fan_switch
    manual_fan_switch: switch.downstairs_bathroom_light_fake_switch
    manual_fan_switch_time_delay: 0

YAML there. Also failure condition.

Thank you for helping debug! How can I help?

@cemil

The ‘switch.downstairs_bathroom_light_fake_switch’, I can’t see if this is set up correctly. Can you copy your light entity ID and replace it with your ‘switch.downstairs_bathroom_light_fake_switch’ in the YAML. Like this.

alias: Downstairs Bathroom Exhaust Fan
description: ""
use_blueprint:
  path: Blackshome/toilet-exhaust-fan.yaml
  input:
    entity_trigger: binary_sensor.lumi_lumi_sensor_motion_aq2_motion
    fan_switch: switch.downstairs_bathroom_fan
    time_delay: 1
    include_manual_fan_switch: enable_manual_fan_switch
    manual_fan_switch: your.light_entity_id_here
    manual_fan_switch_time_delay: 0

Don’t be confused with this trace line as it is the inverted trigger being stopped. When you go into your traces at the top you will see the date and a back / forward arrow. Click on the back arrow to get the correct trace.

Blacky :smiley:

Sure; will try in about an hr or so. FWIW< here’s the fake switch template:

- platform: template
  switches:
    downstairs_bathroom_light_fake_switch:
      unique_id: "downstairs_bathroom_light_fake_switch"
      value_template: "{{ is_state('light.downstairs_bathroom_light', 'on') }}"
      turn_on:
      turn_off:

@cemil

You have actions in the but no actions :-1:. Try this… it will be better to just input your light as you are not using it as the trigger.

platform: template
switches:
  downstairs_bathroom_light_fake_switch:
    unique_id: "downstairs_bathroom_light_fake_switch"
    value_template: "{{ is_state('light.downstairs_bathroom_light', 'on') }}"
alias: Downstairs Bathroom Exhaust Fan
description: ""
use_blueprint:
  path: Blackshome/toilet-exhaust-fan.yaml
  input:
    entity_trigger: binary_sensor.lumi_lumi_sensor_motion_aq2_motion
    fan_switch: switch.downstairs_bathroom_fan
    time_delay: 1
    include_manual_fan_switch: enable_manual_fan_switch
    manual_fan_switch: light.downstairs_bathroom_light
    manual_fan_switch_time_delay: 0

Blacky :smiley:

OK! Will do - I think it wouldn’t let me pick a manual_fan_switch through the UI if the domain type was == light.

I figured I didn’t need any actions in there, since we were just using it for state - is that not the case? I thought you were just monitoring for state?

@cemil

It will not allow you to pick a light domain through the UI but you can edit the YAML and add your light in this blueprint… for that input it will still work. I run filters sometimes so it is easier to pick your entity and I though most people wouldn’t use a light there but it is okay to do so.

Normally when you add these turn on or off actions you have actions. What you can do when developing templates like this is to add your light and you template to the UI then turn the light ON and see what happens to the template. Then if needed you can edit them and see what happens remembering you will have to reload templates every time you edit them. To do this go into developer tools . YAML tab > then select ‘Template Entities’. A HA restart will also do the same thing.

Hope this helps you, let us know how you go.

Blacky :smiley:

@blacky - sorry it took me a little while to get back to playing with this!

I’m still having the same issue. YAML below.

When I walk into the bathroom, sensor trips, fan comes on. If I then decide I want the light, and turn ON the light, fan stays on. If I then walk out, turn the light off, fan stays on - and never turns off again.

Ideas greatly appreciated!

description: ""
use_blueprint:
  path: Blackshome/toilet-exhaust-fan.yaml
  input:
    entity_trigger: binary_sensor.lumi_lumi_sensor_motion_aq2_motion
    fan_switch: switch.downstairs_bathroom_fan
    time_delay: 1
    include_manual_fan_switch: enable_manual_fan_switch
    manual_fan_switch: light.downstairs_bathroom_light
    manual_fan_switch_time_delay: 0

@cemil

I have tested it here again trying every option and the fan always turns OFF. Can you check to make sure nothing else it keeping it ON (anther automation).

Blacky :smiley:

Hi @Blacky ; again, finally got back to testing this, and not seeing ‘expected’ behaviour. I’ve got my master fan down the bottom.

For clarity, there are 2 Shelly relays - a 1pm and a dimmer in there; 1pm runs the fan, dimmer runs the lights. They’re on separate switches. It may be important to note that the presence sensor and switch are both inside the bathroom, so it’s hard to press the light switch without triggering the presence sensor.

Based on the config below, I am definitely seeing unexpected behaviour:

  1. If I trip the sensor, fan works - every time. If I don’t touch the light, the fan will go off with the time delay. So far, so good.
  2. If I trip the sensor, then turn the light on manually, the fan will eventually go off when the presence sensor stops detecting motion, but so will the light. Example log entry - I’m not sure how the automation is turning off the light, given that I haven’t selected any option.
Master Bathroom Light turned off triggered by automation Master Bathroom Exhaust Fan triggered by state of Master Bathroom Motion Sensor Presence
19:28:09 - 19 hours ago
  1. Lastly, if I trip the sensor, then turn the light on manually, then turn the light off manually, the fan will not turn off by itself - requires manual intervention.

What other information can I provide to help troubleshoot?

alias: Master Bathroom Exhaust Fan
description: ""
use_blueprint:
  path: Blackshome/toilet-exhaust-fan.yaml
  input:
    entity_trigger: binary_sensor.master_bathroom_motion_presence
    fan_switch: switch.master_bathroom_fan
    time_delay: 2
    include_manual_fan_switch: enable_manual_fan_switch
    manual_fan_switch: light.master_bathroom_light

@cemil

Thanks for providing this detail of what is happening including your YAML. It really helps me.

Correct :+1:

Correct :+1:

Not correct :thinking:

All is good in the design of the blueprint but it look like you would like a different option / way in how it should work. Please look at removing / disabling the manual light control and use option 1 in the bypass. Then in ‘By-pass Switch - Turn Fan ON’ enter in your ‘light.master_bathroom_light’. The only thing that may happen is when you turn your light OFF the fan may turn OFF instantly if the presence sensor is not detecting motion. I could add a extra input to fix this but let us know if this works for you. Note you could also use the ‘Enable the by-pass auto off - Turn fan ON option’ and set a ‘By-pass Auto OFF - Time Delay’ if the light was left ON accidentally.

Please let us know how you go as I do value feedback.

Blacky :smiley:

Hi @Blacky ; Thanks for the rapid response mate. What you’ve written makes sense, let me try it.

I may come back with some small wording modifications to documentation / tooltips in that case. Thanks a lot for the help!

1 Like

Hi,
I would really like to use the inverted mode in combination with the “trigger wait option”, which is exclusive for the “normal Mode”.
Means that the fan should only be switched on if the trigger wait time has passed and the light is switched off (after leaving).
I haven’t found a solution for this. Does anyone has an idea?

Thanks a lot.

@Gartenfreund

Firstly welcome to the community :wave:

I can see your point. I have updated the blueprint, just doing the final checks and I will release the update. Stay tuned.

Blacky

New update 2.5

New Features :new:

  • Invert Mode - Trigger wait option can now be used in inverted mode.

Maintenance :toolbox:

  • Changed to my new layout.

Bugs Fixes :bug:

  • Fixed bugs in inverted trigger by-pass.

If you like this blueprint? Consider hitting the :heart: button in the top post :+1:

If you like my blueprints, and would like to show your support or just say thank you? Click Here :smiling_face_with_three_hearts:

Enjoy

Blacky :grinning: