Halloween Automations?

I am doing a raspberry pi with motion sensor inside a pumpkin.
Currently this would trigger lights inside the pumpkin to flash in a cycle and a small speaker to play a scary sound from a list.

This year i am hoping to do the lighting and sounds on a bigger scale using HA to trigger a scene of flashing lights in various colours across entire room, then sounds to come from the Alexa speaker in the room.

Although cycling through colours is ok, i want to do a lightning flash sort of thing, however struggling to see how to pull this off in HA. (Hoping the pi could then send the on command for that script)

2 Likes

Well, let’s revive this thread!

I’m wanting to recreate the 2017 “Lets Get Spooky” effect from Google Home. Randomly dimming and flickering lights on/off, and playing some randomized sound effects on all the different speakers throughout the house.

Google brought back the command, but left out all the different smarthome devices control. So this year all it actually does is play the sound effects on the one speaker you give the command to.

Has anyone done this type of automation they’d be willing to share?

this year im going to try somthing for halloween.

i have the bruh/dr zzs leds around my facia of the house so they will be on halloween setting, and when somone activtes the line crossing on my hikvision it will turn to lightning mode, i will also have some skeleton in my car with flashing lights that activate on the line crossing too.

when they press my doorbell (amazon dash button) it will trigger a script to play spooky music on the alexa which will be behind my door, and also i have made a mqtt powered smoke machine, using a d1 mini and tasmota with a solid state relay to trigger the remote wire.

give them a blast of smoke lol

1 Like

sounds good, how are you getting sound onto the alexa device? I have a raspberry pi with sound files on i was trying to bluetooth to an echo. However so far this has been intermittent success, sometimes works great, other times i get a bluetooth connection error. (using built in bluetooth on a RPi Zero W)

I did the same thing with the LEDs (although, I do need to add a few more strings around the yard this weekend). I’m using an EcoLink PIR as a boundary line to trigger the lights.

It allows you to use your Echo as a media device in HA. I’ve been testing it for a few weeks and so far, it’s awesome and has worked pretty well.

Just going to use the alexa tts media player package to do the music

1 Like

I haven’t seen Alexa TTS within Home Assistant before, can you point me to a thread on it? I see a few but none that seem to be what i would want.

Home Assistant function to play the sound via speaker X when triggered from sensor Y or play via speaker X when Home Assistant receives remote command Y

Many thanks

I’ve got this automation.

When someone is pressing the doorbell it will turn all the lights off at the front door and inside, and then start to play some knocking and a little girl talking in the background.
Then after 30 seconds it will light up again :slight_smile:

And ofcourse it will send me some pics and the camera will record everything that night! :slight_smile:
Mohahaha.

- alias: Dorrklockan Halloween
  id: dorrklockan halloween
  initial_state: 'off'
  trigger: 
- platform: state
  entity_id: binary_sensor.dorrklockan
  to: 'off'
  action:
- service: switch.turn_off
  entity_id: switch.rest_utebelysning
- service: light.turn_off
  entity_id: 
  - group.theus_rum
  - group.hallen
  - light.vardagsrum__trapp
- service: media_player.volume_set
  entity_id:
  - media_player.entre_speaker
  data:
    volume_level: 0.8
- service: media_player.play_media
  data:
    entity_id:
      - media_player.entre_speaker
    media_content_id: https://mydomain.duckdns.org:8123/local/halloween.mp3
    media_content_type: music
- service: script.turn_on
  entity_id: script.dorrklockan_snapshot #Snapshot 1
- delay: '00:00:02'
- service: script.turn_on
  entity_id: script.dorrklockan_snapshot #Snapshot 2
- service: script.turn_on
  entity_id: script.dorrklockan_snapshot #Snapshot 3
- delay: '00:00:02'
- service: script.turn_on
  entity_id: script.dorrklockan_snapshot #Snapshot 4
- delay: '00:00:29'
- service: light.turn_on
  entity_id:
  - group.theus_rum
  - group.hallen
  - light.vardagsrum__trapp
- service: switch.turn_on
  entity_id: switch.rest_utebelysning

I was thinking of a smoke machine aswell, but my wife stopped me and said it was overkill…

3 Likes

Missed that i could tell speaker what to play by local file like that. (been using spotify previously)
Will get Echo set as a media player and start on this!
Thank you very much

No problems! :slight_smile:

you have this working?
I have the Alexa TTS @code-in-progress linked but cannot get it to play a local file.

(TTS is awesome though for other projects)

still work in progress, but this skull started its life as a £4.99 B&M bargains plastic toy, i added in the d1 mini and leds and my mqtt controlled smoke machine and sound is played through alexa media player using bluetooth to a mini speaker

sounds are from a album on amazon called halloween haunted house - pro sound effects library.

youtube vid is uploading at the mo so might not be available yet

2 Likes

Loving this thread!
So got my lights flashing and a thunder crack sound over the alexa speaker.
My last step is a wrapper to read current state of lights, do my animation, return lights to how they were.
Any ideas on best way to do this?

Plan is to make 3 or 4 options and set them in a random loop when motion is detected. Currently I have the below;

  thunder:
    alias: Thunder
    sequence:
      - alias: lights
        service: script.turn_on
        data:
          entity_id: script.flash_loop

      - alias: sounds
        service: media_player.play_media
        data:
          entity_id:
            - media_player.living_room
          media_content_id: "Powerful Thunder Crack - Scary Halloween Sound Effects"
          media_content_type: "AMAZON_MUSIC"

      - alias: lightsOff
        service: script.turn_off
        data:
          entity_id: script.flash_loop

I’ve got two spare Yeelight wifi bulbs - will be putting them inside the front door, either side.
Then I’ve got my xiaomi/mija gateway further down the hall.

Finally, there will be a mija ‘button’ outside - “Press me”

- alias:              EVENT - Halloween doorbell
  trigger:
    platform:         event
    event_type:       click
    event_data:
      entity_id:      binary_sensor.switch_158d000241b2e9
  condition:
    condition:        time
    after:            '16:00:00'
    before:           '20:00:00'
  action:
    - service:        xiaomi_aqara.play_ringtone
      data:
        gw_mac:       "78:11:DC:E1:F8:CD"
        ringtone_id:  3
        ringtone_vol: 50
    - service:        light.turn_on
      data:
        entity_id:    light.ylstudycb1, light.spare2
        brightness:   255
        effect:       "Strobe epilepsy!"
    - service:        light.turn_on
      data:
        entity_id:    light.gateway_light_7811dce1f8cd
        brightness:   255
        color_name:   green
    - delay:
        seconds:      5
    - service:        light.turn_on
      data:
        entity_id:    light.ylstudycb1, light.spare2
        brightness:   255
        color_name:   lime
        transition:   5
    - service:        light.turn_on
      data:
        entity_id:    light.gateway_light_7811dce1f8cd
        brightness:   255
        color_name:   red
        transition:   5
    - delay:
        seconds:      30
    - service:        light.turn_off
      data:
        entity_id:    light.gateway_light_7811dce1f8cd, light.ylstudycb1, light.spare2

Just filmed a little youtube video on my Halloween lighting set up.

Enjoy!

2 Likes

here was my setup for halloween 2018

4 Likes

skeleton projector? impressive

Almost 4 years later but it is soon that time of the year again… :skull:

I wrote a small script for the python_integration which toggles any set of lights on and off in random groups, with random colors and in random intervals. The upside of writing it in a script is that I can use millisecond wait time, the downside is that the sleep function slows down homeassistant so I am not running it all night long. My idea is to let my doorbell motion toggle an input_boolean on, and when noone has been there for 5 minutes turn it off. Then another automation to run it every once and then during the night.

Python script (named disco.py):

def sleep(millis):
    end = datetime.datetime.now() + datetime.timedelta(milliseconds=millis)
    while datetime.datetime.now() < end:
        pass

def toggle(lights, brightness, color):
    hass.services.call('light', 'toggle', {'entity_id': lights, 'brightness_pct': brightness, 'rgb_color': color})
    logger.debug("Toggle lights: %s, %s, %s", lights, color, brightness)

switch = data.get("switch")
lights = data.get("lights", [])
colors = data.get("rgb_colors", [255, 255, 255])
brightness_min = max(data.get("brightness_min", 1), 1)
brightness_max = min(data.get("brightness_max", 100), 100)
sleep_min_ms = max(data.get("sleep_min_ms", 1500), 1)
sleep_max_ms = max(data.get("sleep_max_ms", 5000), 1)

input_is_ok = True

if hass.states.get(switch) is None:
    input_is_ok = False
    logger.warn("%s is not a valid homeassistant entity!", switch)

if len(lights) == 0:
    input_is_ok = False
    logger.warn("No lights defined, disco is cancelled!")

if input_is_ok:
    while hass.states.get(switch).state == 'on':
        lights_to_toggle = random.sample(lights, random.randint(1, len(lights)))
        color = random.sample(colors, 1)[0]
        brightness_value = random.randint(brightness_min, brightness_max)
        sleep_value = random.randint(sleep_min_ms, sleep_max_ms)
        
        toggle(lights_to_toggle, brightness_value, color)
        logger.debug("Now sleeping for %s", sleep_value)
        
        sleep(sleep_value)

logger.info("Exiting disco")

I use the input_boolean as source, and as long as it is set to on the script continues. Automation to start the script with halloween themed parameters:

- alias: Turn on halloween disco
  initial_state: 'on'
  trigger:
    platform: state
    entity_id: input_boolean.halloween_lights
    to: 'on'
  action:
    - service: python_script.disco
      data:
        switch: input_boolean.halloween_lights
        lights:
          - light.outside1
          - light.outside2
          - light.outside3
          - light.outside4
          - light.outside5
        rgb_colors:
          - [255, 193, 0]
          - [255, 140, 0]
          - [255, 116, 0]
          - [255, 69, 0]
          - [255, 0, 0]
        brightness_min: 15
        brightness_max: 90
        sleep_min_ms: 500
        sleep_max_ms: 3500
1 Like

To add to this 1 year later, it is the time of the year after all…:ghost:
I altered the script of @Miicroo even more to provide more compatibilty and ‘features’.

Changes include:

  • Compatibility with ‘brightness-only’ bulbs (e.g. Hue Filament)
    This also opens up the possibility to set only color or brightness (or both, ofcourse).
  • Brightness is entered as a list instead of min/max to have more control over the chosen levels (e.g. for flashing lights). This however does remove the randomness between min/max levels.
  • Some code optimalization

light_random_effect.py:

#Script input data
switch = data.get("switch")
lights = data.get("lights", [])
colors = data.get("rgb_colors", [])
brightness_pct = data.get("brightness_pct", [])
sleep_min_ms = max(data.get("sleep_min_ms", 1500), 1)
sleep_max_ms = max(data.get("sleep_max_ms", 5000), 1)

#Provided switch is valid
if hass.states.get(switch) is None:
    input_error = True
    logger.warn("Light random effect: %s is not a valid entity!", switch)
#Any light entity is specified
elif len(lights) == 0:
    input_error = True
    logger.warn("Light random effect: No lights defined")
#Any color and/or brightness is specified
elif len(colors) == 0 and len(brightness_pct) == 0:
    input_error = True
    logger.warn("Light random effect: No color or brightness defined")
#No errors
else:
    input_error = False

#Run script
if not input_error:
    while hass.states.get(switch).state == 'on':
        #Take random light from list
        random_entity_id = random.sample(lights, random.randint(1, len(lights)))
        #Take random color from list
        if len(colors) > 0:
            random_rgb_color = random.choice(colors)
        else:
            random_rgb_color = None
        #Take random brightness
        if len(brightness_pct) > 0:
            random_brightness_pct = random.choice(brightness_pct)  
        else:
            random_brightness_pct = None

        #Turn off
        if random_brightness_pct == 0:
            hass.services.call('light', 'turn_off', {'entity_id': random_entity_id})
        #Turn on: Set brightness
        elif random_brightness_pct != None and random_rgb_color == None:
            hass.services.call('light', 'turn_on', {'entity_id': random_entity_id, 'brightness_pct': random_brightness_pct})
        #Turn on: Set brightness and color
        elif random_brightness_pct != None and random_rgb_color != None:
            hass.services.call('light', 'turn_on', {'entity_id': random_entity_id, 'brightness_pct': random_brightness_pct, 'rgb_color': random_rgb_color})

        #Take random sleep value
        random_sleep_value = random.randint(sleep_min_ms, sleep_max_ms)
        #Sleep
        end = datetime.datetime.now() + datetime.timedelta(milliseconds=random_sleep_value)
        while datetime.datetime.now() < end:
            pass

Some examples on how to use this.
Please take a look at Python Scripts how to enable python scripts.

Flashing white, simulating lightning

service: python_script.light_random_effect
data:
  switch: input_boolean.your_switch_goes_here
  lights:
    - light.your_light_goes_here
  rgb_colors:
    - [255, 255, 255]
  brightness_pct:
    - 1
    - 1
    - 1
    - 100
  sleep_min_ms: 150
  sleep_max_ms: 300

Flickering light, like the light is broken.

service: python_script.light_random_effect
data:
  switch: input_boolean.your_switch_goes_here
  lights:
    - light.your_light_goes_here
  brightness_pct:
    - 40
    - 40
    - 40
    - 10
  sleep_min_ms: 150
  sleep_max_ms: 300

Hope this helps out anyone creating some more cool effects.
Do note, by setting the sleep time very short, it is possible to ‘overload’ the ZigBee network.
This is spoken from experience, whereas my lights kept doing effects long after the switch was disabled.

4 Likes