Move to _data along with some misc clean-up.

This commit is contained in:
2022-04-03 09:29:13 -07:00
parent 1df0987e67
commit 042c9d6108
19 changed files with 259 additions and 30 deletions

39
README.md Normal file
View File

@@ -0,0 +1,39 @@
# esphome
## esp32
[docs](https://esphome.io/guides/getting_started_command_line.html)
Just start with an existing yaml, such as base_esp32.yaml.
Plug it in to laptop, then run:
```sh
docker run --rm -v "${PWD}":/config --device=/dev/ttyUSB0 -it esphome/esphome base_esp32.yaml run
```
Then set static IP in router.
Then in [esphome on server](http://wildebeest:6052/) create same thing, add static IP block, then upload.
Should now be online.
## Hardware
### irf520
[pin-out](https://protosupplies.com/product/irf520-n-ch-mosfet-module/)
#### 1 x 3 Male Header
SIG = Signal input (active HIGH). Typically used with 5V logic. Can be driven at up to 10V to fully turn on the IRF520.
VCC = No connection
GND = Digital ground.
#### 1 x 2 Screw Terminal (Load)
V+ = Connect to positive lead of load (motor, LEDs, fan, etc)
V- = Connect to negative lead of load
#### 1 x 2 Screw Terminal (Power)
VIN = Connect to power supply (0-24V) being used to power the load
GND = Connect to power supply ground

View File

@@ -0,0 +1,83 @@
substitutions:
device_name: "pj_3_duct_fan_pwr"
friendly_name: "Prj 3 Duct Fan Pwr"
esphome:
name: pj_3_duct_fan_pwr
platform: ESP8266
board: esp01_1m
wifi:
ssid: "kungle-oss"
password: "hcfU8@gG&8Hm"
fast_connect: true
manual_ip:
static_ip: 192.168.35.240
gateway: 192.168.35.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Pj 3 Duct Fan Pwr"
password: "ImgAxoEGSc90"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
binary_sensor:
- platform: gpio
pin:
number: GPIO4
mode: INPUT_PULLUP
inverted: True
name: "${friendly_name} Button"
id: "${device_name}_button"
on_press:
- switch.toggle: "${device_name}_relay"
- platform: status
name: "${friendly_name} Status"
id: "${device_name}_status"
switch:
- platform: gpio
name: "${friendly_name} Relay"
id: "${device_name}_relay"
pin: GPIO14
on_turn_on:
- output.turn_on: led
on_turn_off:
- output.turn_off: led
status_led:
pin:
number: GPIO12
inverted: yes
output:
- platform: gpio
pin: GPIO13
inverted: true
id: led
sensor:
- platform: wifi_signal
name: "${friendly_name} WiFi signal"
id: "${device_name}_wifi_signal"
update_interval: 60s
- platform: uptime
name: "${friendly_name} Uptime"
id: "${device_name}_uptime"
update_interval: 60s
text_sensor:
- platform: version
name: "${friendly_name} ESPHome Version"
id: "${device_name}_esphome_version"

55
attic_2_fan.yaml.0 Normal file
View File

@@ -0,0 +1,55 @@
esphome:
name: attic_2_fan
platform: ESP8266
board: esp01_1m
wifi:
ssid: kungle-ot
password: ThingsWelcomeToKungle
manual_ip:
static_ip: 192.168.37.70
gateway: 192.168.37.1
subnet: 255.255.255.0
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
binary_sensor:
- platform: gpio
pin:
number: GPIO4
mode: INPUT_PULLUP
inverted: True
name: "Attic 2 Fan button"
on_press:
- switch.toggle: relay
switch:
- platform: gpio
name: "Attic 2 Fan relay"
pin: GPIO14
id: relay
status_led:
pin:
number: GPIO12
inverted: yes
sensor:
- platform: wifi_signal
name: "Attic 2 Fan WiFi signal"
update_interval: 60s
- platform: uptime
name: "Attic 2 Fan uptime"
text_sensor:
- platform: version
name: "Attic 2 Fan ESPHome version"

24
base_esp32.yaml Normal file
View File

@@ -0,0 +1,24 @@
esphome:
name: base_esp32
platform: ESP32
board: esp32doit-devkit-v1
wifi:
ssid: "kungle-oss"
password: "hcfU8@gG&8Hm"
fast_connect: true
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Server 2 Fallback Hotspot"
password: "kRzC55vFjigT"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:

24
base_esp8266.yaml Normal file
View File

@@ -0,0 +1,24 @@
esphome:
name: esp8266
platform: ESP8266
board: esp01_1m
wifi:
ssid: "kungle-oss"
password: "hcfU8@gG&8Hm"
fast_connect: true
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "esp8266 Fallback Hotspot"
password: "kRzC55vFjigT"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:

View File

@@ -1,6 +1,5 @@
substitutions:
device_name: "pj_3_duct_fan_pwr"
friendly_name: "Prj 3 Duct Fan Pwr"
dev_name: "pj_3_duct_fan_pwr"
esphome:
name: pj_3_duct_fan_pwr
@@ -38,46 +37,28 @@ binary_sensor:
number: GPIO4
mode: INPUT_PULLUP
inverted: True
name: "${friendly_name} Button"
id: "${device_name}_button"
name: "${dev_name} button"
on_press:
- switch.toggle: "${device_name}_relay"
- platform: status
name: "${friendly_name} Status"
id: "${device_name}_status"
- switch.toggle: relay
switch:
- platform: gpio
name: "${friendly_name} Relay"
id: "${device_name}_relay"
name: "${dev_name} relay"
pin: GPIO14
on_turn_on:
- output.turn_on: led
on_turn_off:
- output.turn_off: led
id: relay
status_led:
pin:
number: GPIO12
inverted: yes
output:
- platform: gpio
pin: GPIO13
inverted: true
id: led
sensor:
- platform: wifi_signal
name: "${friendly_name} WiFi signal"
id: "${device_name}_wifi_signal"
update_interval: 60s
- platform: uptime
name: "${friendly_name} Uptime"
id: "${device_name}_uptime"
name: "${dev_name} WiFi signal"
update_interval: 60s
text_sensor:
- platform: version
name: "${friendly_name} ESPHome Version"
id: "${device_name}_esphome_version"
- platform: uptime
name: "${dev_name} uptime"
# text_sensor:
# - platform: version

View File

@@ -0,0 +1,23 @@
esphome:
name: rack_3_duct_fan_pwr
platform: ESP8266
board: esp01_1m
wifi:
ssid: "kungle-ot"
password: "ThingsWelcomeToKungle"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Rack 3 Duct Fan Pwr"
password: "sbIiBVpW39Zb"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota: