Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
kylegordon committed May 31, 2024
2 parents 481a471 + 8a59bee commit 7aa1ed8
Show file tree
Hide file tree
Showing 7 changed files with 398 additions and 6 deletions.
2 changes: 1 addition & 1 deletion esphome/common/common.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
api:

ota:
- platform: esphome
platform: esphome

wifi:
ssid: !secret wifi_ssid
Expand Down
1 change: 1 addition & 0 deletions esphome/common/shelly_1_detached_push_button_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ packages:
esphome:
name: ${device_name}
comment: ${device_description}
friendly_name: ${friendly_name}
platform: ESP8266
board: esp01_1m

Expand Down
2 changes: 1 addition & 1 deletion esphome/common/usb_switch_relay_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ output:
- platform: gpio
pin: GPIO14
id: green_led
inverted: true # start on
inverted: true # start on

# Binary Output template to link relay and green LED states
# LED is on when relay is off
Expand Down
198 changes: 198 additions & 0 deletions esphome/traffic-light.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
---
substitutions:
device_name: traffic-light
device_description: Traffic Light
friendly_name: Traffic Light
default_state: "ALWAYS_OFF"
icon: mdi:traffic-light
go_green_pin: D7
go_red_pin: D6
green_output_pin: D3
amber_output_pin: D2
red_output_pin: D1
blue_led_pin: D4

packages:
common: !include common/common.yaml

esphome:
name: ${device_name}
comment: ${device_description}

esp8266:
board: d1_mini

captive_portal:

logger:

# Enable web server
web_server:
port: 80

syslog:
ip_address: 172.24.32.13
port: 515

light:
# ... and then make a light out of it.
- platform: monochromatic
id: blue_led_light
name: "${friendly_name} Blue LED"
output: blue_led

- platform: binary
id: red
name: "${friendly_name} Red"
output: red_relay

- platform: binary
id: green
name: "${friendly_name} Green"
output: green_relay

- platform: binary
id: amber
name: "${friendly_name} Amber"
output: amber_relay

binary_sensor:
- platform: gpio
pin:
number: ${go_green_pin}
# mode: INPUT_PULLUP
inverted: true
name: "Go Green Button"
on_release:
then:
switch.toggle: go_green_sequence

- platform: gpio
pin:
number: ${go_red_pin}
# mode: INPUT_PULLUP
inverted: true
name: "Go Red Button"
on_release:
then:
switch.toggle: go_red_sequence

output:
# Register the blue LED as a dimmable output ....
- platform: esp8266_pwm
id: blue_led
pin: ${blue_led_pin}
inverted: true

- platform: gpio
# name: ${friendly_name} Green Relay
pin: ${green_output_pin}
id: green_relay
# restore_mode: "${default_state}"

- platform: gpio
# name: ${friendly_name} Amber Relay
pin: ${amber_output_pin}
id: amber_relay
# restore_mode: "${default_state}"

- platform: gpio
# name: ${friendly_name} Red Relay
pin: ${red_output_pin}
id: red_relay
# restore_mode: "${default_state}"

# Page 35 of https://assets.publishing.service.gov.uk/media/5df0e29fed915d15f42c4820/dft-traffic-signs-manual-chapter-6.pdf

switch:
- platform: template
id: go_green_sequence
name: "${friendly_name} Go Green Sequence"
turn_on_action:
# Start it up and show red for 3 seconds
- light.turn_off:
id: green
- light.turn_off:
id: amber
- light.turn_on:
id: red
- delay: 3s
# Now the sequence really starts
- light.turn_on:
id: amber
- delay: 2s
- light.turn_off:
id: red
- light.turn_off:
id: amber
- light.turn_on:
id: green

- platform: template
id: go_red_sequence
name: "${friendly_name} Go Red Sequence"
turn_on_action:
# Start it up and show green for 3 seconds
- light.turn_off:
id: red
- light.turn_off:
id: amber
- light.turn_on:
id: green
- delay: 3s
# Now the sequence really starts
- light.turn_on:
id: amber
- light.turn_off:
id: green
- delay: 3s
- light.turn_off:
id: amber
- light.turn_on:
id: red

# Blink the light if we aren't connected to WiFi.
interval:
- interval: 5000ms
id: no_wifi
then:
- if:
condition:
not:
wifi.connected:
then:
- light.turn_on:
id: blue_led_light
brightness: 100%
transition_length: 0s
- delay: 250ms
- light.turn_off:
id: blue_led_light
transition_length: 0ms
- delay: 250ms
- interval: 5000ms
id: no_api
then:
- if:
condition:
not:
api.connected:
then:
- light.turn_on:
id: blue_led_light
brightness: 100%
transition_length: 0s
- delay: 250ms
- light.turn_off:
id: blue_led_light
transition_length: 0ms
- delay: 250ms
- light.turn_on:
id: blue_led_light
brightness: 100%
transition_length: 0s
- delay: 250ms
- light.turn_off:
id: blue_led_light
transition_length: 0ms
- delay: 250ms
3 changes: 3 additions & 0 deletions packages/outside_lights.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ automation:
"Woooo, it's dark and scary. Something moved! Turning on the outside lights!",
"Did you hear that? I can't see a thing. Turning on the outside lights"
] | random + " https://amzn.to/2CR5mbQ" }}
- service: homeassistant.turn_on
entity_id:
- group.outside_lights
- service: notify.mobile_app_nothing_phone_1
data:
title: "Motion outside!"
Expand Down
Loading

0 comments on commit 7aa1ed8

Please sign in to comment.