Skip to content

Commit

Permalink
fumeextractor, garagedoor and more
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickcollins12 committed Jan 28, 2023
1 parent 610bfcf commit cfbd00e
Show file tree
Hide file tree
Showing 10 changed files with 209 additions and 75 deletions.
1 change: 0 additions & 1 deletion 433transmitter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ remote_receiver:
# filter: 250us
# idle: 4ms
# buffer_size: 2kb

12 changes: 11 additions & 1 deletion console-fan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ substitutions:

esphome:
name: console-fan-v2
# includes:
# - pid_simulator.h

custom_component:
- lambda: |-
auto *my_component = new esphome::pid::PIDSimulator();
App.register_component(my_component);
return {my_component};
globals:
- id: dhttemp
Expand All @@ -12,7 +20,7 @@ globals:

#########################
# ESP32 AND NETWORK SETUP

esp32:
board: nodemcu-32s
framework:
Expand Down Expand Up @@ -180,7 +188,9 @@ text_sensor:
id: uptime_human
icon: mdi:clock-start


sensor:

# Send WiFi signal strength & uptime to HA
- platform: wifi_signal
name: $friendly_name WiFi Strength
Expand Down
25 changes: 25 additions & 0 deletions ct-clamp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
substitutions:
friendly_name: "CT clamp"
friendly_id: "ctclamp"

packages:
device_base: !include device_base_esp32.yaml

sensor:
- platform: ct_clamp
sensor: adc_sensor
name: "Measured Current"
id: current
sample_duration: 600ms
update_interval: 3000ms
filters:
- calibrate_linear:
- 0.012 -> 0
- 0.025 -> 1.0

- platform: adc
pin: GPIO32
id: adc_sensor
attenuation: 11db
# update_interval: never
update_interval: 3000ms
16 changes: 16 additions & 0 deletions device_base_8266_esp07.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
esphome:
name: $friendly_id

esp8266:
board: esp07

# board: nodemcuv2
# platform = espressif8266

restore_from_flash: true
framework:
version: recommended



logger:
10 changes: 9 additions & 1 deletion device_base_8266_nodemcu.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
esphome:
name: $friendly_id

esp8266:
board: nodemcuv2

# board: nodemcuv2
# platform = espressif8266

restore_from_flash: true
framework:
version: recommended


logger:
117 changes: 59 additions & 58 deletions device_base_esp32_nonetwork.yaml
Original file line number Diff line number Diff line change
@@ -1,70 +1,71 @@
esphome:
name: $friendly_name
platform: ESP32
board: esp32dev
board: nodemcu-32s

wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# wifi:
# ssid: !secret wifi_ssid
# password: !secret wifi_password

logger:
api:
ota:
captive_portal:

switch:
- platform: restart
id: restart1
name: $friendly_name ESP32 Restart
# api:
# ota:
# captive_portal:

time:
- platform: homeassistant
on_time:
# Every morning at 12:30am
- seconds: 0
minutes: 30
hours: 0
then:
- switch.turn_on: restart1
# switch:
# - platform: restart
# id: restart1
# name: $friendly_name ESP32 Restart

# time:
# - platform: homeassistant
# on_time:
# # Every morning at 12:30am
# - seconds: 0
# minutes: 30
# hours: 0
# then:
# - switch.turn_on: restart1

text_sensor:
# Send IP Address
- platform: wifi_info
ip_address:
name: "$friendly_name IP Address"
# text_sensor:
# # Send IP Address
# - platform: wifi_info
# ip_address:
# name: "$friendly_name IP Address"

# Send Uptime in raw seconds
- platform: template
name: $friendly_name Uptime
id: uptime_human
icon: mdi:clock-start
# # Send Uptime in raw seconds
# - platform: template
# name: $friendly_name Uptime
# id: uptime_human
# icon: mdi:clock-start

# Sensors that the ESPhome unit is capable of reporting
sensor:
- platform: wifi_signal
name: "$friendly_name WiFi Signal"
update_interval: 10min
# # Sensors that the ESPhome unit is capable of reporting
# sensor:
# - platform: wifi_signal
# name: "$friendly_name WiFi Signal"
# update_interval: 10min

- platform: uptime
internal: true
id: uptime_sensor
update_interval: 10min
on_raw_value:
then:
- text_sensor.template.publish:
id: uptime_human
# Custom C++ code to generate the result
state: !lambda |-
int seconds = round(id(uptime_sensor).raw_state);
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
seconds = seconds % 3600;
int minutes = seconds / 60;
seconds = seconds % 60;
return (
(days ? to_string(days) + "d " : "") +
(hours ? to_string(hours) + "h " : "") +
(minutes ? to_string(minutes) + "m " : "") +
(to_string(seconds) + "s")
).c_str();
# - platform: uptime
# internal: true
# id: uptime_sensor
# update_interval: 10min
# on_raw_value:
# then:
# - text_sensor.template.publish:
# id: uptime_human
# # Custom C++ code to generate the result
# state: !lambda |-
# int seconds = round(id(uptime_sensor).raw_state);
# int days = seconds / (24 * 3600);
# seconds = seconds % (24 * 3600);
# int hours = seconds / 3600;
# seconds = seconds % 3600;
# int minutes = seconds / 60;
# seconds = seconds % 60;
# return (
# (days ? to_string(days) + "d " : "") +
# (hours ? to_string(hours) + "h " : "") +
# (minutes ? to_string(minutes) + "m " : "") +
# (to_string(seconds) + "s")
# ).c_str();
6 changes: 6 additions & 0 deletions empty-esp32.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
substitutions:
friendly_name: "Test"
friendly_id: "test"

packages:
device_base: !include device_base_esp32.yaml
51 changes: 51 additions & 0 deletions fumeextractor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
substitutions:
friendly_name: fumeextractor
friendly_id: fumeextractor

packages:
# device_base: !include device_base_esp32_nonetwork.yaml
device_base: !include device_base_8266_nodemcu.yaml

# ESP32
# sensor:
# - platform: adc
# name: "fanpot"
# pin: GPIO2
# accuracy_decimals: 2
# update_interval: 100ms
# attenuation: auto
# filters:
# - calibrate_linear:
# - 0.075 -> 0.0
# - 3.148 -> 3.3
# - delta: 0.01

output:
- platform: esp8266_pwm
pin: D0
id: fan
frequency: 25kHz
# inverted: false
# min_power: 0.01
# max_power: 0.75

sensor:
- platform: adc
name: "fanpot"
id: fanpot
pin: A0
raw: true
accuracy_decimals: 1
update_interval: 100ms
# attenuation: auto
filters:
- calibrate_linear:
- 0 -> 0.0
- 1024 -> 1000
- delta: 10
- multiply: 0.001
on_value:
then:
- output.set_level:
id: fan
level: !lambda return id(fanpot).state;
45 changes: 31 additions & 14 deletions garage-door.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ substitutions:
packages:
device_base: !include device_base_esp32.yaml

# Sensors: closed = magnetic, open = no presence.
# Top Sensor (measures door closed)
# Bottom Sensor (measures door is open)
# Top (closed) sensor is closed, DOOR IS CLOSED DOWN
# Bottom (open) sensor is closed, DOOR HAS OPENED UP
# Both sensors are open, DOOR IS MOVING
# Both sensors are closed, BUG, rare, they're both in contact.

cover:
- platform: template
name: "Garage Door v2"
Expand All @@ -23,15 +31,15 @@ cover:

stop_action:
- switch.turn_on: garage_door_relay
optimistic: true
assumed_state: true
optimistic: false
assumed_state: false

lambda: |-
if (id(garage_open_sensor).state) {
if (!id(garage_open_sensor).state) {
return COVER_OPEN;
}
else if (id(garage_closed_sensor).state) {
else if (!id(garage_closed_sensor).state) {
return COVER_CLOSED;
}
return 1;
Expand All @@ -52,22 +60,30 @@ switch:
- delay: 1000ms
- switch.turn_off: garage_door_relay


# Sensors: closed = magnetic, open = no presence.
# Top Sensor (measures door closed)
# Bottom Sensor (measures door is open)
# Top (closed) sensor is closed, DOOR IS CLOSED DOWN
# Bottom (open) sensor is closed, DOOR HAS OPENED UP
# Both sensors are open, DOOR IS MOVING
# Both sensors are closed, BUG, rare, they're both in contact.

# Define Hall Effect Sensors
binary_sensor:
- platform: gpio
name: "Garage Door Open Hall Sensor (Top)"
name: "Garage Door Open (Bottom) Hall Sensor"
id: garage_open_sensor
device_class: garage_door
internal: true
#internal: true
pin:
number: GPIO33
inverted: true
number: GPIO32
mode:
pullup: true
input: true
filters:
- delayed_off: 500ms
on_press:
on_release:
then:
- cover.template.publish:
id: garage_door_v2
Expand All @@ -76,22 +92,23 @@ binary_sensor:
return COVER_OPEN;
- platform: gpio
name: "Garage Door Closed Hall Sensor (Bottom)"
name: "Garage Door Closed (Top) Hall Sensor"
id: garage_closed_sensor
internal: true
device_class: garage_door
#internal: true
pin:
number: GPIO32
inverted: true
number: GPIO33
mode:
pullup: true
input: true
filters:
- delayed_off: 500ms

on_press:
on_release:
then:
- cover.template.publish:
id: garage_door_v2
state: !lambda |-
id(garage_door_v2).current_operation = COVER_OPERATION_IDLE;
return COVER_CLOSED;
Loading

0 comments on commit cfbd00e

Please sign in to comment.