Grand Father Clock Chime

I have created a simple Grand Father Clock Chime in Home Assistant.

Sound will play through the speakers connected via 3.5mm head phone jack in Raspberry Pi.

It will play the chime every hour with the hour count.

:bulb: Home Assistant Configuration yaml file entries:

shell_command:
  ttschime: '/home/homeassistant/.homeassistant/TTS_Chime.sh'

automation 9:
  - alias: 'Grand Father Clock'
    trigger:
      platform: time
      minutes: 59
      seconds: 59
    condition:
      condition: time
      after: '05:30:00'
      before: '22:30:00'
    action:
      - service: shell_command.ttschime

I have given the condition to enable the chime only between 5:30 to 22:30

:bulb: Shell Command File: TTS_Chime.sh

#!/bin/bash

# Below line is for the Kodi Hyperion Ambilight light sequence to flash police light pattern
echo '{ "command": "effect", "effect": {"name":"Police Lights Solid"}, "priority": 100 }' | nc 192.168.1.101 19444

sleep 2

if [[ `date +%H` -ge 6 && `date +%H` -lt 7 ]];then
    aplay -Dplughw:CARD=ALSA,DEV=0 /home/homeassistant/.homeassistant/GrandFatherChime06.wav
fi
if [[ `date +%H` -ge 7 && `date +%H` -lt 8 ]];then
    aplay -Dplughw:CARD=ALSA,DEV=0 /home/homeassistant/.homeassistant/GrandFatherChime07.wav
fi
if [[ `date +%H` -ge 8 && `date +%H` -lt 9 ]];then
    aplay -Dplughw:CARD=ALSA,DEV=0 /home/homeassistant/.homeassistant/GrandFatherChime08.wav
fi
if [[ `date +%H` -ge 9 && `date +%H` -lt 10 ]];then
    aplay -Dplughw:CARD=ALSA,DEV=0 /home/homeassistant/.homeassistant/GrandFatherChime09.wav
fi
if [[ `date +%H` -ge 10 && `date +%H` -lt 11 ]];then
    aplay -Dplughw:CARD=ALSA,DEV=0 /home/homeassistant/.homeassistant/GrandFatherChime10.wav
fi
if [[ `date +%H` -ge 11 && `date +%H` -lt 12 ]];then
    aplay -Dplughw:CARD=ALSA,DEV=0 /home/homeassistant/.homeassistant/GrandFatherChime11.wav
fi
if [[ `date +%H` -ge 12 && `date +%H` -lt 13 ]];then
    aplay -Dplughw:CARD=ALSA,DEV=0 /home/homeassistant/.homeassistant/GrandFatherChime12.wav
fi
if [[ `date +%H` -ge 13 && `date +%H` -lt 14 ]];then
    aplay -Dplughw:CARD=ALSA,DEV=0 /home/homeassistant/.homeassistant/GrandFatherChime01.wav
fi
if [[ `date +%H` -ge 14 && `date +%H` -lt 15 ]];then
    aplay -Dplughw:CARD=ALSA,DEV=0 /home/homeassistant/.homeassistant/GrandFatherChime02.wav
fi
if [[ `date +%H` -ge 15 && `date +%H` -lt 16 ]];then
    aplay -Dplughw:CARD=ALSA,DEV=0 /home/homeassistant/.homeassistant/GrandFatherChime03.wav
fi
if [[ `date +%H` -ge 16 && `date +%H` -lt 17 ]];then
    aplay -Dplughw:CARD=ALSA,DEV=0 /home/homeassistant/.homeassistant/GrandFatherChime04.wav
fi
if [[ `date +%H` -ge 17 && `date +%H` -lt 18 ]];then
    aplay -Dplughw:CARD=ALSA,DEV=0 /home/homeassistant/.homeassistant/GrandFatherChime05.wav
fi
if [[ `date +%H` -ge 18 && `date +%H` -lt 19 ]];then
    aplay -Dplughw:CARD=ALSA,DEV=0 /home/homeassistant/.homeassistant/GrandFatherChime06.wav
fi
if [[ `date +%H` -ge 19 && `date +%H` -lt 20 ]];then
    aplay -Dplughw:CARD=ALSA,DEV=0 /home/homeassistant/.homeassistant/GrandFatherChime07.wav
fi
if [[ `date +%H` -ge 20 && `date +%H` -lt 21 ]];then
    aplay -Dplughw:CARD=ALSA,DEV=0 /home/homeassistant/.homeassistant/GrandFatherChime08.wav
fi
if [[ `date +%H` -ge 21 && `date +%H` -lt 22 ]];then
    aplay -Dplughw:CARD=ALSA,DEV=0 /home/homeassistant/.homeassistant/GrandFatherChime09.wav
fi
if [[ `date +%H` -ge 22 && `date +%H` -lt 23 ]];then
    aplay -Dplughw:CARD=ALSA,DEV=0 /home/homeassistant/.homeassistant/GrandFatherChime10.wav
fi

sleep 1

# Below line is for the Kodi Hyperion Ambilight light clear sequence 
echo  '{ "command": "clear", "priority": 100 }' | nc 192.168.1.101 19444

:floppy_disk: Download Grandfather Chime sound files

:floppy_disk: Download Cookoo Clock Sound files

:movie_camera: View demo video on YouTube

Hope this will be helpful.

11 Likes

Very cool! I would totally do this but I think my wife would hate it :frowning:

2 Likes

LOL… Good luck with this mod.

Thinking about it some more - I would probably re-implement this in AppDaemon, and fix it so it only goes off when my wife is out!

If I have time I’ll put something together and post my code.

2 Likes

You can also try the Presence Detection (OwnTracks/Locative) and make as a condition to play the chime.

Its just a thought :slight_smile:

1 Like

This is a really cool bit of automation. I really like this and think it’s great that you shared it. Thanks!

Before the Christchurch Earthquake we had a cuckoo clock that chimed randomly, sometimes even announcing 13 o’clock. Could you program that ?

1 Like

I was also thinking about the cuckoo clock sound effects. I will work on that and share it.

To announce the time, we can use the TTS.

I have created a TTS configuration using PicoTTS.

To see the details Click Here

Good idea to bring some vintage feel into the house. Anyway, since I am already using VLC media player and I am not good at command lines and bash file, I can simplify the automation to become this…

- alias: 'Grandfather Clock'
  initial_state: true
  trigger:
    platform: time
    minutes: 00
    seconds: 00
  condition:
    condition: time
    after: '05:30:00'
    before: '22:30:00'
  action:
    - service: media_player.play_media
      data_template:
        entity_id: media_player.vlc_living_room
        media_content_id: '/home/pi/.homeassistant/www/sounds/GFChime/GrandFatherChime{{ now().strftime("%I") }}.wav'
        media_content_type: 'music'
3 Likes

I built my AppDaemon version - works like a charm, but I had to write an APP to stream the media to my Sonos :slight_smile: It switches off when my wife gets home too!

Thanks again for a great idea!

1 Like

:floppy_disk: Download Cookoo Clock Sound files

1 Like

i have also taken the chime files and use appdaemon to play it.
@aimc change your wife :wink: mine loves it.

i use my soundfunctions, but with an audiodevice configured in HA it would be simular.
my code:

###########################################################################################
#                                                                                         #
#  Rene Tode ( [email protected] )                                                            #
#  ( with a lot off help from andrew cockburn (aimc) )                                    #
#  2017/01/07 Germany                                                                     #
#                                                                                         #
###########################################################################################

import appdaemon.appapi as appapi
import datetime


class play_hourly(appapi.AppDaemon):

  def initialize(self):
    runtime = datetime.time(12, 0, 2)
    self.run_hourly(self.playclock, runtime)

  def playclock(self, kwargs):
    runhour = datetime.datetime.now().hour
    if runhour > 12:
      runhour = runhour - 12
    sound = self.get_app("soundfunctions")
    volume = str(self.get_state("input_slider.klokvolume"))[:-2]
    self.log("klokvolume: " + volume)
    sound.playsound("/home/pi/GrandFatherChime" + str(runhour) + ".mp3","5",volume)
2 Likes

She won’t let me :frowning:

change her sdcard with system files :stuck_out_tongue:

They are encrypted!

1 Like

Finally got around to implementing this. Love it! Here is my code if anyone wants it. I went with the Cuckoo Clock and pure Yaml. Plays cuckoo on the hour and a single on the half. Just like my mom’s clock used to. :slight_smile:

https://github.com/CCOSTAN/Home-AssistantConfig/blob/master/automation/System/CucKoo_Clock.yaml

This uses my ChromeCast Audios, cheap AMPs and optional Etekcity Outlets.

1 Like

Super awesome! Good work!

The links with the sound files do not work (both cookoo and grandfather’s). Can someone forward them again?

Here are the cookoo soundfiles:
https://www.dropbox.com/sh/a3n7ki66zqdp0md/AACS9qGbhULp36lwDCuTfQb_a?dl=0

1 Like

tx a bunch

1 Like