Triggering when sensor has reached wanted temperature

I have sauna in my house where I installed temperature sensor to monitor when sauna has reached wanted temperature.
I would like to have notification in to my phone when certain temperature is reached and I can go to sauna.

I’m having trouble setting automaton trigger for this. I understand that I must check for numeric state of the temperature sensor and check for when it’s above temperature I like. I don’t understand how to do it in way that trigger fires only one time (when temperature is reached) and does not trigger again when temperature drops after sauna has been turned off and when temperature keeps rising when using sauna.

If someone could nudge me to the right path I would appreciate it.

You could use an input boolean and make the state of that one of your conditions. Then when your done with the sauna you can just manually flip the boolean switch.

That’s good idea, but I would like to avoid manually doing anything. After sauna I feel so relaxed that I have no time to think about such things :slight_smile:

Does Home Assistant have any inner variables that I could switch on and off depending if sauna has reached wanted temperature?

You could use a slider and values to set a timer. Take a look at posts for alarm clocks for some insight into this.

I’d have the automation trigger a script that includes a delay (say 10 min). Then use the state of that script as a condition of the automation (test to see that the script is ‘off’). That way it’ll fire once, then can’t fire again for 10 minutes. Lengthen the delay as necessary.

And if you take those two ideas and combine them into one, you can have that delay determined from the value of a slider or drop down list. Shoot, you could even have it trigger another automation that blinks a light within view of the sauna to make sure you don’t end up like the guys in the World Sauna Championships!

(I’d link that but it’s kinda of a brutal story… people competed for how long they could stay in a sauna and some literally got cooked to death.)

Not bad ideas, but again, these involve me doing something manually and I would like to avoid it :smile: I’m not always sure how long I’m going to be in sauna beforehand: sometimes it’s like 15 minutes and sometimes World Sauna Championships!

(Just kidding, sauna is for relaxing, not for cooking yourself to death. But still I like to be there random amounts of times.)

My suggestion doesn’t involve anything manual. The automation triggers when you reach target temp. You use the delay script to “debounce” so that you don’t keep getting triggers. Set it for an hour if you want - that way you only get at most one notification per hour that the sauna is ready.

Yeah, I think he was referring to my suggestions - yours are strictly automatic.

Right, but your idea was an input option - still not a manual task…

True - you could always set a default value and then still retain the option to vary it on demand.

Yeah, you’re right that it does not involve manually work beside setting some default value. I can see it could work nicely with pretty long delay (then it would not even trigger again after sauna has cooled down again below triggering point).

ih8gates, could you be so kind to provide example how to check for state of the script? I undestand how to set up the script and delay for it, but I have no idea how how check if it is already running or not.

Not sure if this will work for you. It assumes you only use the sauna once a day.

Have an automation that triggers via numeric state from your temperature sensor when it is above your set temp. Actions would be to notify you and also to turn off the automation. (not sure you can turn off an automation from inside an automation but worth a shot, I turn off automations from another automation but not the same automation)

Then write another automation to turn the automation back on after midnight each night so it is ready for the next day.

automation:
  alias: Sauna Notification
  trigger:
    platform: numeric_state
    entity_id: sensor.temperature
    above: 115
  action:
    - service: notify.notify
      data:
        message: Sauna is Ready!
    - service: homeassistant.turn_off
      entity_id: automation.sauna_notification

This does’nt look like a bad solution. I don’t usually use sauna more than once a day max so this could work. It’s good to know that automations can be turned off in demand if necessary. Thanks!

Again, just to be clear, not sure how HA will like turning off an automation from within the same automation. I do it to control other automations this way but not within the same automation. If it doesn’t like the automation route you can always have it trigger a script or something similar which turns off the automation.

Which gives me another idea.

Instead of calling the automation off, call a script. If you know you never sit in the sauna for more than an hour or two hours just call the script and put in a delay for a set amount of time which will turn the automation back on after the delay. This would allow the automation to work after a morning session if you wanted to go in the sauna at night again.

script:
    Sauna Automation Toggle:
    sequence:
      - service: homeassistant.turn_off
        entity_id: automation.sauna_notification
      - delay:
          hours: 2
      - service: homeassistant.turn_on
        entity_id: automation.sauna_notification

Not sure if all my config and spacing is right in the above, but it give you the basic frame work.

Good idea! This might be THE way to do it.

I will try it and report if I succeeded with it. Thank you for helping me!

You just use a normal state condition or trigger. The state of a script becomes ‘on’ when it’s running. If the script contains a delay, it’ll revert to a state of ‘off’ when it’s done.

- condition: state
  entity_id: script.some_timer
  state: 'on'
1 Like

I tried silvrr’s solution and it seems to be working fine :slight_smile:

Here is final solution for future reference:

script:
  sauna_automation_toggle:
    sequence:
      - service: homeassistant.turn_off
        entity_id: automation.sauna_notification
      - delay:
          hours: 2
      - service: homeassistant.turn_on
        entity_id: automation.sauna_notification

automation:
  alias: sauna_notification
  trigger:
    platform: numeric_state
    entity_id: sensor.sauna_temperature
    above: 75
  action:
    - service: notify.notify
      data:
        message: "Sauna is ready"
        title: "Sauna is ready"
    - service: homeassistant.turn_on
      entity_id: script.sauna_automation_toggle

Thank you for your contribution too ih8gates. I’m sure I will use your solution for something else later.

This is an interesting way to do it. I hadn’t given much thought to disabling automations. That’s a handy trick to keep in mind.

It definitely is useful in the right situation and use case. I was going to use this method in my mailbox notification automation so that it would only trip the one time when the mailman opened the box to put the mail in instead of twice (when I went to open it).

But after I thought about it for awhile, I couldn’t account for times when I might be away from the house for most of the day so I ended up sticking with an input boolean toggle. While it’s working, I may end up going back to this so I can do it with a single automation instead of two.