Home Assistant - Doing something every X minutes

Home Assistant - Doing something every X minutes

Hi guys,

Today let me introduce this super easy automation to do something repeatedly.

Use case

You want to set the volume on your google home at a specific value every 15 minutes if not playing.

Software configuration

  1. Home Assistant. I'm currently running version?2022.8.0
  2. Google Cast integration?configured in Home Assistant. This integration allows you to control your google devices for streaming (chromcast) as well as audio (nest audio) via Home Assistant.

Home Assistant code (yaml)

This is the piece of code -?Automation?- you have to write down:

alias: Volume - Set the volume of your google home every 15 minutes if not playing
description: Volume - Set the volume of your google home every 15 minutes if not playing
? - platform: time_pattern
? ? minutes: /15
condition:
? - condition: state
? ? entity_id: media_player.yourgooglehome
? ? state: "off"
action:
? - data:
? ? ? volume_level: XXX
? ? entity_id: media_player.yourgooglehome
? ? service: media_player.volume_set
mode: single        

Some specifics about the code above

  1. time_pattern can also be evaluated in seconds. Just replace minutes: with seconds:
  2. the condition set allows the automation to be executed only if the state of your google home is OFF. This avoid any volume changes when your google home is playing.
  3. the action set the volume on your google home at the volume_level: XXX

I do hope you have enjoyed this article.

I'm available for any feedback so, feel free to contact me or share your thoughts in the comments section below!

Have a nice sunday, thank you for reading. ??

--------------------------------------------------------------------------------------------------------

Hereafter other articles about Home Assistant :

Home Assistant - Get notified if a door/window opens when there's nobody home

Home Assistant - Displaying entities on card based on state of other entities

Home Assistant - Tracking entities on cards according to their state

Home Assistant - Tracking the sunrise every day

Home Assistant - Turning OFF a power socket when the operative state of the household connected to goes OFF

Home Assistant - Set the smartphone's ring mode if you are somewhere

Home Assistant - Stop streaming on Google Home speakers when not home

Home Assistant - Create a button to do something

Home Assistant - Know the distance between two people

Home Assistant - Get notified when ISS is above your home

Home Assistant - Getting the position?of ISS

Home Assistant - Getting the distance between people and zones

Home Assistant - Automation: Stop chromcast streaming if TV has turned OFF

Home Assistant - Sensor: Getting the operational state of a household appliance

Home Assistant - Automation: Power up your TV / DVD based on Chromcast

要查看或添加评论,请登录

Emiliano Guerzoni的更多文章

社区洞察

其他会员也浏览了