How can I add volume control to the above?
I’m half drunk on a beach in cancun. When I get back I’m going to look at this for volume control. http://blog.scphillips.com/posts/2013/01/sound-configuration-on-raspberry-pi-with-alsa/
Hope to figure it out. Then I can lower it for night time.
This example uses volume control for a chromecast, can the same be applied to a Sonos? If so, maybe you can combine with an input_slider.
action:
- service: media_player.turn_on
entity_id: media_player.livingroomCC
- service: switch.turn_on
entity_id: switch.living_room_amp
- delay: '00:00:05'
- service: media_player.volume_set
entity_id:
- media_player.livingroomCC
data:
volume_level: 0.22
Full example:
https://github.com/CCOSTAN/Home-AssistantConfig/blob/master/automation/System/CucKoo_Clock.yaml
Got it working with the following:
- service: media_player.volume_set
data_template:
entity_id: media_player.living_room
volume_level: 0.6
It took a year but finally wrote up my implementation of this project.
I would love to do this… is there any way to push the chimes to an echo? I assume that the echo will not take pushes, but gotta ask!
Thanks Matt
How cool! My idea is to use your configuration and change the chimes to something unsusceptible to an unaware person.
I just implemented the GF tonight as a POC I"m considering instead changing to ships bells since I used to be in the Navy thought it would be slick to do the bells. I might even implement some 1MC in here like sweepers, revile and taps
So last night we added all of the quarterly toll’s to our clock automation. Here is what we came up with.
If anyone wants the full sound package let me know. This is setup to play to my sonos speaker.
###################################
## Grandfather Clock simulation.
## Plays Westminster Chimes on the hour and chimes 1 time on the half
## Script from CCOSTAN cuckoo clock but modified for the grandfather
###################################
- alias: Grandfather Clock
trigger:
- platform: time
minutes: 00
seconds: 05
- platform: time
minutes: 15
seconds: 00
- platform: time
minutes: 30
seconds: 00
- platform: time
minutes: 45
seconds: 00
condition:
condition: and
conditions:
- condition: time
after: '08:00:00'
before: '22:31:00'
- condition: state
entity_id: group.family
state: 'home'
action:
- service: media_player.volume_set
entity_id:
- media_player.living_room
data:
volume_level: 0.55
- service: media_player.play_media
data_template:
entity_id:
- media_player.living_room
media_content_id: >
{% if now().strftime("%M")|int == 15 %}
http://192.168.7.2:8123/local/sounds/gf_clock/Toll-1Quarter.mp3
{% elif now().strftime("%M")|int == 30 %}
http://192.168.7.2:8123/local/sounds/gf_clock/Toll-2Quarter.mp3
{% elif now().strftime("%M")|int == 45 %}
http://192.168.7.2:8123/local/sounds/gf_clock/Toll-3Quarter.mp3
{% else %}
http://192.168.7.2:8123/local/sounds/gf_clock/{{now().strftime("%I")}}-hour.mp3
{% endif %}
media_content_type: music
I updated to hassio… no vlc…
If you could add the MP3 package to my Repo, that would be awesome! Sometime I like ti class it up with some grandfather chimes! @TheFuzz4
Will do after we’re done with our evening shows
For those who are interested: I have made a cuckoo clock variant for my Google Home speaker using a python script. It only needs one audio file that is repeated for the amount of hours.
Automation
half_hour.yaml
id: Half_hour
alias: Cuckoo Clock every 30 minutes
trigger:
platform: time_pattern
minutes: "/30"
condition:
condition: time
after: "06:31:00"
before: "22:31:00"
action:
service: script.cuckoo_clock
Script
cuckoo_clock.yaml
cuckoo_clock:
alias: "Gimme a cuckoo every 30 minutes"
sequence:
- service: python_script.cuckoo_clock
data_template:
entity_id: media_player.living_room_speaker
hour: "{{ now().hour }}"
minute: "{{ now().minute }}"
Python script
cuckoo_clock.py
entity_id = data.get("entity_id")
hour = int(data.get("hour"))
minute = int(data.get("minute"))
amount = hour
if hour > 12:
amount = hour - 12
elif minute < 55 and minute > 5:
amount = 1
if minute > 55:
amount += 1
if entity_id is not None:
service_data = {
"entity_id": entity_id,
"media_content_id": "http://projects.kokokoding.nl/home-assistant/cuckoo.wav",
"media_content_type": "audio/wav",
}
for i in range(amount):
hass.services.call("media_player", "play_media", service_data, True)
time.sleep(1)
I am trying to install your project. I want to ask if the file: cuckoo_clock.py is to put it in the directory: custom_components / cuckoo_clock / cuckoo_clock.py?
Or where to put it? Thank you.
This is my version of the clock using an automation and Amazon echo/Alexa devices.
- id: 'Automatic Time Announcing'
alias: 'Automatic Time Announcing'
trigger:
platform: time_pattern
minutes: "/30"
condition:
condition: time
after: '08:30:00'
before: '21:30:00'
action:
- service: media_player.play_media
data:
entity_id: media_player.dot_t
media_content_type: sound
media_content_id: amzn_sfx_doorbell_chime_01 #change this
- service: notify.alexa_media
data_template:
target: media_player.dot_t
title: Announcing the time
data:
type: announce
method: speak
message: >-
It's
{% if now().hour > 12 %}
{{ (now().hour | int) - 12 }}
{% if now().minute == 0 %}
o'clock
{% else %}
{{ now().minute }} pm
{% endif %}
{% elif now().hour == 12 %}
{{ now().hour }}
{% if now().minute == 0 %}
o'clock
{% else %}
{{ now().minute }} pm
{% endif %}
{% else %}
{{ now().hour }}
{% if now().minute == 0 %}
o'clock
{% else %}
{{ now().minute }} am
{% endif %}
{% endif %}
There were some updates to the time_pattern
trigger that affected my Clock Automation. Here is how I fixed it easily.
Thank you.
My Big Ben Chime on the hour to a Fire HD8 wall Panel running Fully Kiosk with HA using DuckDns/Letsencrypt and the Fully Kiosk Integration…
Automation
alias: Big Ben Chimes
trigger:
- platform: time_pattern
minutes: "59"
seconds: "45"
condition:
- condition: time
after: "07:30:00"
before: "22:30:00"
action:
- service: rest_command.fully_kiosk_panel_playsound
data:
sound: hourlychimebeg.mp3
- delay:
hours: 0
minutes: 0
seconds: 10
- repeat:
count: >
{% set T = now().strftime("%-I") | int + 1 %} {% if T == 13 %} {{ 1 }}
{% else %} {{ T }} {% endif %}
sequence:
- delay:
hours: 0
minutes: 0
seconds: 4
milliseconds: 500
- service: rest_command.fully_kiosk_panel_playsound
data:
sound: bigben1strike.mp3
mode: single
It relies on a rest command in the configuration.yaml file…
rest_command:
fully_kiosk_panel_playsound:
url: !secret fully_kiosk_panel_playsound
and the secret.yaml file
fully_kiosk_panel_playsound: "http://Fixed IP of the Panel:2323?password=Panel Password&cmd=playSound&url=https%3A%2F%2FHA Domain Name%3A8123%2Flocal%2F{{ sound }}"
I have the Panel volume set at 8 so its not too loud/obtrusive and will probably add some actions to set that volume and reset to what it was before after the bongs.
The sound files, stored in the www directory, I just got off the internet. I’m going to do similar with a Google nest and a Cuckoo clock to amuse the grand-kids when they visit.
Where do I put my sound files? I am able to get my alexa’s to play sounds auch as “amzn_sfx_doorbell_01” so i know that part works. I want to play my own sounds. Where do i store them? Help!!