In this post, I’m sharing some code that can be used in your halloween party.
You will need a motion sensor, home assistant and a voice assistant or any speaker that is paired into home assistant. I will be using a google mini. If you have a light bulb with colour you can blink to red.
When someone walks into the room they will not expect this!
Download your mp3, I used this website: https://www.zapsplat.com/sound-effect-categories/
Upload the file under config/www
Note down the name of your mp3 file, mine is called: happy_halloween_male_creepy.mp3
alias: Trigger Halloween Prank
trigger:
platform: state
entity_id: binary_sensor.inspiration_motion_sensor
to: 'on'
action:
- service : media_player.volume_set
data:
entity_id: media_player.kitchen_speaker
volume_level: 0.7
- service: switch.turn_on
entity_id: switch.sonoff_inspiration_room
- service: lifx.effect_pulse
entity_id: light.lifx
data:
entity_id: light.lifx
mode: strobe
brightness: 120
color_name: red
period: 3
cycles: 2
- service: media_player.play_media
data:
entity_id: media_player.kitchen_speaker
media_content_id: 'http://IP_ADDRESS:PORT/local/happy_halloween_male_creepy.mp3'
media_content_type: 'audio/mp3'