TTS Sauna temperature Automation

Hi,
I’m fairly new in HA and automation and would like ask question to my automation and here my code. My end results would be like that Google mini would say once that sauna is ready.

which trigger type would be good for me: State or Numeric State and are condition requirement / usefully?

 alias: Sauna TTS
  description: ''
  trigger:
  - platform: state
    entity_id: sensor.sauna_temperature
    attribute: temperature
    from: '50'
    to: '60'
  condition:
  - condition: numeric_state
    entity_id: sensor.sauna_temperature
    attribute: temperature
    above: '50'
  action:
  - service: tts.google_translate_say
    data_template:
      entity_id: media_player.olohuone_mini
      message: Sauna is warm. Temperature is {{ states('sensor.sauna_temperature')
        }} degrees.
  mode: single

EDIT:
Seems that my automation do not work. Sauna’s temperature is over 50 which is requirement for automation trigger but at least my google mini has not said anything. By pressing manually “Run Action” it will work and say the temperature value

image

Logbook

EDIT2: Actually got it working by changing code a bit but now it keeps triggering every few minutes because saunas temperature is over 50 (even if turned off it can stay hours above 50) and don’t want or need more than one time information about this.

alias: Sauna TTS
description: ''
trigger:
  - platform: state
    entity_id: sensor.sauna_temperature
condition:
  - condition: numeric_state
    entity_id: sensor.sauna_temperature
    above: '50'
action:
  - service: tts.google_translate_say
    data_template:
      entity_id: media_player.olohuone_mini
      message: >-
        Sauna is warm. Temperature is {{ states('sensor.sauna_temperature') }}
        degrees.
mode: single

Remove the condition and use it as a trigger

platform: numeric_state
entity_id: sensor.sauna_temperature
above: '50'
1 Like

When do you want it to trigger and how many times?
It’s not clear exactly what you want to happen.

Do you want it to speak when above 50 only once?
In that case you need to know that it has run once, and that metric is not in your automation currently.
You could have a boolean that goes on when the TTS has been said, and this is a condition in your automation.
Then when the temperature goes below 40 again another automation resets the boolean so that the TTS automation can trigger again.

1 Like

Your using the state change of the temp sensor to trigger the automation, so basically every time the temp change state the automation will trigger over and over again all the time it is above 50deg as per your condition.

As others have said you really need to have the state above 50 as the trigger, that way you don’t need to have the condition and it will only ever trigger on the transition crossing the 50 deg upwards.

So going from 49-51 would trigger but any subsequent change above 50 would not trigger it until it drops below 50 and rises again.

Hope that makes sense

1 Like

Will try this today!

I want it to trigger only once, when sauna is 50 or above.

That is pretty much how I would it want to work. I assume that i wont trigger when falling below 50, only when its reaches over 50 again?

It will only trigger when it transitions from below 50 to above 50, so unless it drops below 59 and then back up again then it should only trigger once

In that case I would use trigger above 50 and and use the input boolean to make sure it won’t trigger again because opening the door temporary cooled the sensor.

Your automation:

alias: Sauna TTS
description: ''
mode: single
trigger:
  - platform: numeric_state
    entity_id: sensor.sauna_temperature
    above: '50'
condition:
  - condition: state
    entity_id: input_boolean.sauna_tts
    state: 'off'
action:
  - service: tts.google_translate_say
    data:
      entity_id: media_player.olohuone_mini
      message: Sauna is warm. Temperature is {{ states('sensor.sauna_temperature')
        }} degrees.
  - service: input_boolean.turn_on
    target:
      entity_id: input_boolean.sauna_tts

Reset boolean:

alias: Sauna TTS - Reset boolean
description: ''
mode: single
trigger:
  - platform: numeric_state
    entity_id: sensor.sauna_temperature
    below: '40'
condition: []
action:
  - service: input_boolean.turn_off
    target:
      entity_id: input_boolean.sauna_tts

This “arms” the sauna when the temperature is below 40 degrees again.
That way it will not trigger due to a sudden dip in temperature.