Updated BasketBall Code with Blog Instructions and links.
This commit is contained in:
parent
f14cbb562c
commit
1be1421f79
|
@ -1,3 +1,13 @@
|
||||||
|
#-------------------------------------------
|
||||||
|
# @CCOSTAN
|
||||||
|
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
|
||||||
|
# ESPHome YAML by Jeremy Shephard
|
||||||
|
#-------------------------------------------
|
||||||
|
######################################################################
|
||||||
|
## https://www.vcloudinfo.com/2020/09/home-assistant-smart-diy-basketball-backboard-project.html
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
esphome:
|
esphome:
|
||||||
name: bb_node
|
name: bb_node
|
||||||
platform: ESP8266
|
platform: ESP8266
|
||||||
|
@ -7,7 +17,7 @@ wifi:
|
||||||
ssid: "********"
|
ssid: "********"
|
||||||
password: "********"
|
password: "********"
|
||||||
|
|
||||||
|
|
||||||
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||||
ap:
|
ap:
|
||||||
ssid: "Bb Node Fallback Hotspot"
|
ssid: "Bb Node Fallback Hotspot"
|
||||||
|
@ -28,45 +38,45 @@ sensor:
|
||||||
name: Baskets
|
name: Baskets
|
||||||
id: basket
|
id: basket
|
||||||
icon: mdi:basketball-hoop-outline
|
icon: mdi:basketball-hoop-outline
|
||||||
|
|
||||||
- platform: template
|
- platform: template
|
||||||
name: Swish
|
name: Swish
|
||||||
id: swish
|
id: swish
|
||||||
icon: mdi:basketball
|
icon: mdi:basketball
|
||||||
|
|
||||||
- platform: template
|
- platform: template
|
||||||
name: Backboards
|
name: Backboards
|
||||||
id: backboard
|
id: backboard
|
||||||
icon: mdi:basketball-hoop
|
icon: mdi:basketball-hoop
|
||||||
|
|
||||||
- platform: template
|
- platform: template
|
||||||
name: Previous Baskets
|
name: Previous Baskets
|
||||||
id: last_basket
|
id: last_basket
|
||||||
icon: mdi:basketball-hoop-outline
|
icon: mdi:basketball-hoop-outline
|
||||||
|
|
||||||
- platform: template
|
- platform: template
|
||||||
name: Previous Swishes
|
name: Previous Swishes
|
||||||
id: last_swish
|
id: last_swish
|
||||||
icon: mdi:basketball
|
icon: mdi:basketball
|
||||||
|
|
||||||
- platform: template
|
- platform: template
|
||||||
name: Previous Backboards
|
name: Previous Backboards
|
||||||
id: last_backboard
|
id: last_backboard
|
||||||
icon: mdi:basketball-hoop
|
icon: mdi:basketball-hoop
|
||||||
|
|
||||||
binary_sensor:
|
binary_sensor:
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
pin: D0
|
pin: D0
|
||||||
name: "Vibration Sensor"
|
name: "Vibration Sensor"
|
||||||
id: bs
|
id: bs
|
||||||
filters:
|
filters:
|
||||||
- delayed_on: 50ms
|
- delayed_on: 50ms
|
||||||
- delayed_off: 2s
|
- delayed_off: 2s
|
||||||
on_press:
|
on_press:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
id(backboard_gbl) += 1;
|
id(backboard_gbl) += 1;
|
||||||
id(backboard).publish_state(id(backboard_gbl));
|
id(backboard).publish_state(id(backboard_gbl));
|
||||||
|
|
||||||
- if:
|
- if:
|
||||||
condition:
|
condition:
|
||||||
switch.is_on: bb_on_lights_off
|
switch.is_on: bb_on_lights_off
|
||||||
|
@ -80,7 +90,7 @@ binary_sensor:
|
||||||
- delay: 3s
|
- delay: 3s
|
||||||
- light.turn_off: bb_light
|
- light.turn_off: bb_light
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
pin:
|
pin:
|
||||||
number: D5
|
number: D5
|
||||||
inverted: True
|
inverted: True
|
||||||
name: "Distance Sensor"
|
name: "Distance Sensor"
|
||||||
|
@ -111,7 +121,7 @@ binary_sensor:
|
||||||
red: 100%
|
red: 100%
|
||||||
green: 0%
|
green: 0%
|
||||||
blue: 0%
|
blue: 0%
|
||||||
|
|
||||||
- if:
|
- if:
|
||||||
condition:
|
condition:
|
||||||
binary_sensor.is_on: bs
|
binary_sensor.is_on: bs
|
||||||
|
@ -134,7 +144,7 @@ binary_sensor:
|
||||||
red: 100%
|
red: 100%
|
||||||
green: 0%
|
green: 0%
|
||||||
blue: 0%
|
blue: 0%
|
||||||
|
|
||||||
- if:
|
- if:
|
||||||
condition:
|
condition:
|
||||||
switch.is_on: bb_on_lights_off
|
switch.is_on: bb_on_lights_off
|
||||||
|
@ -152,7 +162,7 @@ binary_sensor:
|
||||||
call.perform();
|
call.perform();
|
||||||
- delay: 5s
|
- delay: 5s
|
||||||
- light.turn_off: bb_light
|
- light.turn_off: bb_light
|
||||||
|
|
||||||
- if:
|
- if:
|
||||||
condition:
|
condition:
|
||||||
binary_sensor.is_on: bs
|
binary_sensor.is_on: bs
|
||||||
|
@ -169,10 +179,10 @@ binary_sensor:
|
||||||
blue: 10%
|
blue: 10%
|
||||||
- delay: 3s
|
- delay: 3s
|
||||||
- light.turn_off: bb_light
|
- light.turn_off: bb_light
|
||||||
|
|
||||||
|
|
||||||
light:
|
light:
|
||||||
|
|
||||||
- platform: fastled_clockless
|
- platform: fastled_clockless
|
||||||
chipset: WS2812
|
chipset: WS2812
|
||||||
name: "FastLED WS2811 Light"
|
name: "FastLED WS2811 Light"
|
||||||
|
@ -219,19 +229,19 @@ light:
|
||||||
- red: 0%
|
- red: 0%
|
||||||
green: 0%
|
green: 0%
|
||||||
blue: 100%
|
blue: 100%
|
||||||
num_leds: 20
|
num_leds: 20
|
||||||
- red: 0%
|
- red: 0%
|
||||||
green: 0%
|
green: 0%
|
||||||
blue: 0%
|
blue: 0%
|
||||||
num_leds: 10
|
num_leds: 10
|
||||||
- red: 0%
|
- red: 0%
|
||||||
green: 0%
|
green: 0%
|
||||||
blue: 100%
|
blue: 100%
|
||||||
num_leds: 40
|
num_leds: 40
|
||||||
- red: 0%
|
- red: 0%
|
||||||
green: 0%
|
green: 0%
|
||||||
blue: 0%
|
blue: 0%
|
||||||
num_leds: 10
|
num_leds: 10
|
||||||
add_led_interval: 32ms
|
add_led_interval: 32ms
|
||||||
reverse: False
|
reverse: False
|
||||||
- addressable_fireworks:
|
- addressable_fireworks:
|
||||||
|
@ -240,7 +250,7 @@ light:
|
||||||
spark_probability: 80%
|
spark_probability: 80%
|
||||||
use_random_color: true
|
use_random_color: true
|
||||||
fade_out_rate: 50
|
fade_out_rate: 50
|
||||||
|
|
||||||
switch:
|
switch:
|
||||||
- platform: template
|
- platform: template
|
||||||
name: Basketball Status Lights
|
name: Basketball Status Lights
|
||||||
|
@ -264,7 +274,7 @@ switch:
|
||||||
id(backboard).publish_state(id(backboard_gbl));
|
id(backboard).publish_state(id(backboard_gbl));
|
||||||
id(basket).publish_state(id(basket_gbl));
|
id(basket).publish_state(id(basket_gbl));
|
||||||
id(swish).publish_state(id(swish_gbl));
|
id(swish).publish_state(id(swish_gbl));
|
||||||
|
|
||||||
- platform: template
|
- platform: template
|
||||||
name: Basketball Always Lights
|
name: Basketball Always Lights
|
||||||
id: bb_on
|
id: bb_on
|
||||||
|
@ -279,7 +289,7 @@ switch:
|
||||||
red: 100%
|
red: 100%
|
||||||
green: 0%
|
green: 0%
|
||||||
blue: 0%
|
blue: 0%
|
||||||
|
|
||||||
turn_off_action:
|
turn_off_action:
|
||||||
- switch.template.publish:
|
- switch.template.publish:
|
||||||
id: bb_on
|
id: bb_on
|
||||||
|
@ -301,12 +311,12 @@ globals:
|
||||||
type: int
|
type: int
|
||||||
restore_value: no
|
restore_value: no
|
||||||
initial_value: '0'
|
initial_value: '0'
|
||||||
|
|
||||||
- id: basket_gbl
|
- id: basket_gbl
|
||||||
type: int
|
type: int
|
||||||
restore_value: no
|
restore_value: no
|
||||||
initial_value: '0'
|
initial_value: '0'
|
||||||
|
|
||||||
- id: swish_gbl
|
- id: swish_gbl
|
||||||
type: int
|
type: int
|
||||||
restore_value: no
|
restore_value: no
|
||||||
|
|
Loading…
Reference in New Issue