Today I was thinking about a cool project to do with my smart home running home assistant, and I was thinking to recreate a game from the popular Netflix show Squid Games, in particular the green light red-light.
To do this project you will need, a coloured led light-strip or bulb, a few vibration sensors, a button and a google mini.
Table of Contents
Kit Required for this project
- Led Light Bulbs (coloured) or some led light-strips
- Zigbee Button (I’m using an Ikea shortcut button)
- Google mini
- Vibration sensors (I’m using an Aqara Vibration sensor)
- Smart home platform.
My smart home platform of choice is home assistant, I’m assuming you already have this up and running, if you don’t follow my free course: https://courses.leonardosmarthomemakers.com/courses/home-assistant-foundations
Automations
I’m using 2 automations, the first turns on our lights either green or red depending on if you do a single tap or long tap. Feel free to configure this in your own way depending on which button you are using. The great thing about home assistant is that you can use so many devices!
Turning Lights ON (Green & Red)
My Ikea shortcut button works only thanks to a blueprint which you can find here. After you have installed it feel free to copy and paste the code below in your automation.yaml
Now if you are not using an Ikea button you can skip the blueprint step.
- id: "squid_game_ikea_button"
alias: Squid Game Ikea Button
description: "YouTube Video"
use_blueprint:
path: ikea/shortcut-button.yaml
input:
shortcut_button: 05d0e725a2deb98d3677292810630bc1
button_short:
- service: light.turn_on
target:
entity_id: light.imac_lamp
data:
brightness: 255
color_name: green
button_double:
- service: light.turn_on
target:
entity_id: light.imac_lamp
data:
brightness: 255
color_name: red
button_long:
- service: light.turn_on
target:
entity_id: light.imac_lamp
data:
brightness: 255
color_name: green
Example with Philips Hue button
Replace device ID with your own, you can find that by trying to create an automation with the UI first (devices). Then looking at the code snipped generated in automations.yaml
- id: squid_game_turn_light_green
alias: Squid Game (Turn Light Green)
description: ""
trigger:
- device_id: 9fac8f20fb36c15de8b5ca8b5c071fbe
domain: hue
platform: device
type: remote_button_short_release
subtype: turn_on
condition: []
action:
- service: light.turn_on
data:
brightness: 255
color_name: green
target:
entity_id:
- light.inspiration_light
- light.imac_lamp
mode: single
- id: squid_game_turn_light_red
alias: Squid Game (Turn Light Red)
description: ""
trigger:
- device_id: 9fac8f20fb36c15de8b5ca8b5c071fbe
domain: hue
platform: device
type: remote_button_short_release
subtype: turn_off
condition: []
action:
- service: light.turn_on
data:
brightness: 255
color_name: red
target:
entity_id:
- light.inspiration_light
- light.imac_lamp
mode: single
Eliminating Players
Now in the game players are eliminated when they move and the light is red
Each player will be assigned a vibration sensor, create multiple automations for each player.
Replace the vibration_player_1 with your own entity id. Same for the light and the media player.
- id: "squid_game_player_eliminated"
alias: Squid Game Player Eliminated
description: ""
trigger:
- platform: state
entity_id: binary_sensor.vibration_player_1
from: "off"
to: "on"
for:
hours: 0
minutes: 0
seconds: 0
milliseconds: 0
condition:
#Colour is Red
condition: template
value_template: "{{ is_state_attr('light.imac_lamp', 'rgb_color', (255, 43, 0)) }}"
action:
- service: media_player.volume_set
target:
entity_id: media_player.kitchen_speaker
data:
volume_level: 0.57
- service: tts.cloud_say
data:
entity_id: media_player.kitchen_speaker
message: Player 1 has been eliminated
language: en-GB
mode: single