diff --git a/README.md b/README.md new file mode 100644 index 0000000..d14c5d2 --- /dev/null +++ b/README.md @@ -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 diff --git a/downlight_1.yaml b/_data/downlight_1.yaml similarity index 100% rename from downlight_1.yaml rename to _data/downlight_1.yaml diff --git a/fountain_1.yaml b/_data/fountain_1.yaml similarity index 100% rename from fountain_1.yaml rename to _data/fountain_1.yaml diff --git a/fountain_1_light.yaml b/_data/fountain_1_light.yaml similarity index 100% rename from fountain_1_light.yaml rename to _data/fountain_1_light.yaml diff --git a/fountain_outside.yaml b/_data/fountain_outside.yaml similarity index 100% rename from fountain_outside.yaml rename to _data/fountain_outside.yaml diff --git a/_data/pj_3_duct_fan_pwr.yaml b/_data/pj_3_duct_fan_pwr.yaml new file mode 100644 index 0000000..d3189cc --- /dev/null +++ b/_data/pj_3_duct_fan_pwr.yaml @@ -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" \ No newline at end of file diff --git a/projector_3.yaml b/_data/projector_3.yaml similarity index 100% rename from projector_3.yaml rename to _data/projector_3.yaml diff --git a/rack_2.yaml b/_data/rack_2.yaml similarity index 100% rename from rack_2.yaml rename to _data/rack_2.yaml diff --git a/rack_2_duct_fan_pwr.yaml b/_data/rack_2_duct_fan_pwr.yaml similarity index 100% rename from rack_2_duct_fan_pwr.yaml rename to _data/rack_2_duct_fan_pwr.yaml diff --git a/rack_3.yaml b/_data/rack_3.yaml similarity index 100% rename from rack_3.yaml rename to _data/rack_3.yaml diff --git a/rack_3_duct_fan_pwr.yaml b/_data/rack_3_duct_fan_pwr.yaml similarity index 100% rename from rack_3_duct_fan_pwr.yaml rename to _data/rack_3_duct_fan_pwr.yaml diff --git a/weather-in-1.yaml b/_data/weather-in-1.yaml similarity index 100% rename from weather-in-1.yaml rename to _data/weather-in-1.yaml diff --git a/weather-out-n.yaml b/_data/weather-out-n.yaml similarity index 100% rename from weather-out-n.yaml rename to _data/weather-out-n.yaml diff --git a/weather-out-s.yaml b/_data/weather-out-s.yaml similarity index 100% rename from weather-out-s.yaml rename to _data/weather-out-s.yaml diff --git a/attic_2_fan.yaml.0 b/attic_2_fan.yaml.0 new file mode 100644 index 0000000..8fe6cca --- /dev/null +++ b/attic_2_fan.yaml.0 @@ -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" diff --git a/base_esp32.yaml b/base_esp32.yaml new file mode 100644 index 0000000..74a85a7 --- /dev/null +++ b/base_esp32.yaml @@ -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: diff --git a/base_esp8266.yaml b/base_esp8266.yaml new file mode 100644 index 0000000..dccec1b --- /dev/null +++ b/base_esp8266.yaml @@ -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: diff --git a/pj_3_duct_fan_pwr.yaml b/pj_3_duct_fan_pwr.yaml index d3189cc..f2ec18e 100644 --- a/pj_3_duct_fan_pwr.yaml +++ b/pj_3_duct_fan_pwr.yaml @@ -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" \ No newline at end of file + - platform: uptime + name: "${dev_name} uptime" + +# text_sensor: +# - platform: version diff --git a/rack_3_duct_fan_pwr.yaml.0 b/rack_3_duct_fan_pwr.yaml.0 new file mode 100644 index 0000000..f7ba303 --- /dev/null +++ b/rack_3_duct_fan_pwr.yaml.0 @@ -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: