Openai/69220c71-1b68-800c-9d67-d90d67ec7eb1
This conversation was exported from ChatGPT[1]
gpt-5-1-thinking edit
User: I have setup home assistant on my RasberryPi server, I have built a Sauna and using Sonos Amp, AC Infinity Fan with the… edit
I have setup home assistant on my RasberryPi server, I have built a Sauna and using Sonos Amp, AC Infinity Fan with their AI Controller, and Saunum 15 L fan.
I have setup Sonos, ÀC Infinity Fan and Saunum (ModBus) and can see all in Home Assistant.
Can you create a script for me for HomeAssiatnt that runs for 4 hours:
1) start Sauna and use 1st Profile I have, run for 4 hours (warm up, use Sauna for 2 hours if we like, 1 hour warm down)
2) Start fan at level 3 for 1st hour. During hour 2&3 if Co2 level goes above 400, fan speed 4, above 500 fan speed 5, above 600 fan speed 6 above 700 fan speed 7, above 900 fan speed 9. last hour of 4 hour run, run fan speed at 3
3) During hours 2&3, play Spotify playlist "Sauna Vibes", on Sonos Amp called "Sauna". Play the playlist in random mode. Set Volume at 25. Stop playing music during last hour
Want this to run what I say "hey Google, start sauna"
Assistant: Nice, this is exactly the kind of automation Home Assistant is great at. edit
Nice, this is exactly the kind of automation Home Assistant is great at. Below is a single script you can drop into configuration.yaml (under script:) or paste into the Scripts UI → Edit in YAML.
You’ll just need to adjust the entity IDs and the Spotify playlist ID to match your setup.
1. Home Assistant script (4-hour sauna session) edit
script:
sauna_4_hour_session:
alias: "Start Sauna (4-hour session)"
mode: restart
sequence:
# --- Start Saunum heater on Profile 1 and run fan at 3 for first hour ---
* alias: "Start Saunum heater on Profile 1"
# CHANGE THIS to whatever actually starts your Saunum profile 1.
# Example if you have a select for profiles:
service: select.select_option
target:
entity_id: select.saunum_profile
data:
option: "Profile 1"
# If you also need to explicitly turn the heater on, add something like:
# - service: switch.turn_on
# target:
# entity_id: switch.sauna_heater
* alias: "Set fan speed to 3 for warm-up hour"
# CHANGE this entity_id to your AC Infinity fan speed control
service: number.set_value
target:
entity_id: number.sauna_fan_speed
data:
value: 3
* alias: "Warm-up hour (1 hour delay)"
delay: "01:00:00"
# --- Hours 2 & 3: music on + dynamic fan control by CO₂ ---
* alias: "Start Sauna Vibes playlist on Sonos"
# Shuffle ON first
service: media_player.shuffle_set
target:
entity_id: media_player.sauna # CHANGE to your Sonos Amp entity
data:
shuffle: true
* alias: "Set Sonos volume to 25%"
service: media_player.volume_set
target:
entity_id: media_player.sauna
data:
volume_level: 0.25 # 0.0–1.0
* alias: "Play Sauna Vibes playlist"
# CHANGE media_content_id to your actual Spotify playlist URI or name
service: media_player.play_media
target:
entity_id: media_player.sauna
data:
media_content_id: "spotify:playlist:YOUR_SAUNA_VIBES_PLAYLIST_ID"
media_content_type: "playlist"
* alias: "Dynamic fan control for 2 hours based on CO₂"
repeat:
sequence:
* alias: "Read CO₂ level"
variables:
co2: "{{ states('sensor.sauna_co2') | int(0) }}" # CHANGE entity if needed
* alias: "Set fan speed based on CO₂"
choose:
* conditions: "{{ co2 > 900 }}"
sequence:
* service: number.set_value
target:
entity_id: number.sauna_fan_speed
data:
value: 9
* conditions: "{{ co2 > 700 }}"
sequence:
* service: number.set_value
target:
entity_id: number.sauna_fan_speed
data:
value: 7
* conditions: "{{ co2 > 600 }}"
sequence:
* service: number.set_value
target:
entity_id: number.sauna_fan_speed
data:
value: 6
* conditions: "{{ co2 > 500 }}"
sequence:
* service: number.set_value
target:
entity_id: number.sauna_fan_speed
data:
value: 5
* conditions: "{{ co2 > 400 }}"
sequence:
* service: number.set_value
target:
entity_id: number.sauna_fan_speed
data:
value: 4
default:
* service: number.set_value
target:
entity_id: number.sauna_fan_speed
data:
value: 3
* alias: "Wait 1 minute before checking CO₂ again"
delay: "00:01:00"
# 2 hours ≈ 120 minutes → 120 loops of 1 minute
until:
* condition: template
value_template: "{{ repeat.index >= 120 }}"
# --- Hour 4: cool-down, fan at 3, no music ---
* alias: "Stop music for cool-down hour"
service: media_player.media_stop
target:
entity_id: media_player.sauna
* alias: "Set fan to 3 for final cool-down hour"
service: number.set_value
target:
entity_id: number.sauna_fan_speed
data:
value: 3
* alias: "Cool-down hour (final hour)"
delay: "01:00:00"
# --- End of 4 hours: stop everything ---
* alias: "Turn off Saunum heater"
# CHANGE to your actual off service (switch, climate, etc.)
service: switch.turn_off
target:
entity_id: switch.sauna_heater
* alias: "Turn off fan at end of session"
# If fan can be turned off (0), do that; otherwise you can leave at 3.
service: number.set_value
target:
entity_id: number.sauna_fan_speed
data:
value: 0
Things you’ll need to customize edit
- select.saunum_profile → your actual Saunum entity (or the service that starts Profile 1).
- switch.sauna_heater → your heater on/off entity (if needed).
- number.sauna_fan_speed → your AC Infinity fan speed entity (could be number.xxx, select.xxx, or a custom service).
- sensor.sauna_co2 → the actual CO₂ sensor entity in Home Assistant.
- media_player.sauna → your Sonos Amp entity.
- spotify:playlist:YOUR_SAUNA_VIBES_PLAYLIST_ID → real Spotify playlist URI for “Sauna Vibes”.
If the fan uses a select instead of number, the service lines become:
service: select.select_option
data:
option: "3"
instead of number.set_value.
2. Triggering this with “Hey Google, start sauna” edit
Once the script is in HA and reloaded:
- In Home Assistant, go to Settings → Automations & Scenes → Scripts and confirm you see “Start Sauna (4-hour session)” (script.sauna_4_hour_session).
- Make sure it’s exposed to Google: - If you’re using Nabu Casa / Home Assistant Cloud: Settings → Voice Assistants → Google Assistant → Exposed Entities and enable the script. - If you’re using your own Google Assistant integration, expose the script the same way you do for lights/switches.
- In the Google Home app, create a Routine: - Trigger phrase: start sauna - Action: “Run script sauna_4_hour_session” (it should show up as a Home Assistant script once exposed).
After that, saying:
- “Hey Google, start sauna”
will kick off the whole 4-hour sequence: Saunum profile 1, fan logic by CO₂, music in hour 2–3, then cool-down with fan only.
If you send me your actual entity IDs (or a screenshot of the Saunum, fan, and Sonos entities), I can tweak this to be copy-paste perfect for your exact setup.
References edit
- ↑ "Home Assistant sauna script". ChatGPT. Retrieved 2025-12-08.