diff --git a/esphome/apc7921-generic.yaml b/esphome/apc7921-generic.yaml new file mode 100644 index 0000000..ac54f0f --- /dev/null +++ b/esphome/apc7921-generic.yaml @@ -0,0 +1,128 @@ +esphome: + name: apc7921-generic + platform: ESP32 + board: esp32dev + +# Enable logging +logger: + +# Enable Home Assistant API +api: + password: "CHANGEME" + reboot_timeout: 0s + +ota: + password: "CHANGEME_ALSO" + + #Enable fallback hotspot (captive portal) in case wifi connection fails + #ap: + #ssid: "apc7921-generic fallback Hotspot" + #password: "NO_SURPRISE:ALSO_CHANGEME" + + #captive_portal: + +# ALso change the username/password combo here for the web-interface +web_server: + port: 80 + auth: + username: admin + password: admin + +i2c: + sda: 14 + scl: 15 + scan: True + +pcf8574: + - id: 'pcf8574_hub' + address: 0x24 + pcf8575: false + +switch: +- platform: gpio + name: "port8" + pin: + pcf8574: pcf8574_hub + # Use pin number 0 + number: 7 + # One of INPUT or OUTPUT + mode: OUTPUT + inverted: True +- platform: gpio + name: "port7" + pin: + pcf8574: pcf8574_hub + number: 6 + mode: OUTPUT + inverted: True +- platform: gpio + name: "port6" + pin: + pcf8574: pcf8574_hub + number: 5 + mode: OUTPUT + inverted: True +- platform: gpio + name: "port5" + pin: + pcf8574: pcf8574_hub + number: 4 + mode: OUTPUT + inverted: True +- platform: gpio + name: "port4" + pin: + pcf8574: pcf8574_hub + number: 3 + mode: OUTPUT + inverted: True +- platform: gpio + name: "port3" + pin: + pcf8574: pcf8574_hub + number: 2 + mode: OUTPUT + inverted: True +- platform: gpio + name: "port2" + pin: + pcf8574: pcf8574_hub + number: 1 + mode: OUTPUT + inverted: True +- platform: gpio + name: "port1" + pin: + pcf8574: pcf8574_hub + number: 0 + mode: OUTPUT + inverted: True + +ethernet: + type: LAN8720 + mdc_pin: GPIO23 + mdio_pin: GPIO18 + clk_mode: GPIO0_IN + phy_addr: 1 + power_pin: GPIO16 + + +# This config uses a factor of 13 which gets close (enough) to the actual voltage but is NOT calibrated. + +sensor: + - platform: adc + name: "PSU2 voltage" + pin: GPIO36 + accuracy_decimals: 2 + update_interval: 5s + attenuation: auto + filters: + - multiply: 13 + - platform: adc + name: "PSU1 voltage" + pin: GPIO39 + accuracy_decimals: 2 + update_interval: 5s + attenuation: auto + filters: + - multiply: 13