From 28dba2eadae6ee5232e609451474e64b1e2ba511 Mon Sep 17 00:00:00 2001 From: Trevor Schirmer Date: Mon, 23 Sep 2024 21:28:01 -0400 Subject: [PATCH] Initial Code --- .github/workflows/build.yml | 2 +- .github/workflows/ci.yml | 6 +- Integrations/ESPHome/Core.yaml | 146 +++++++++++++++++- .../ESPHome/{AIR-1.yaml => PUMP-1.yaml} | 16 +- README.md | 10 +- index.html | 10 +- 6 files changed, 166 insertions(+), 24 deletions(-) rename Integrations/ESPHome/{AIR-1.yaml => PUMP-1.yaml} (57%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 55e1280..eeb7276 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,6 @@ name: Build env: - DEVICE_NAME: plt-1 # TODO: Rename + DEVICE_NAME: pump-1 # TODO: Rename RELEASE_URL: ${{ github.server_url }}/${{ github.repository }}/releases/latest on: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a697c5a..f68b9c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,9 +9,9 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - file: # TODO: Rename - - Integrations/ESPHome/PLT-1.yaml - - Integrations/ESPHome/PLT-1_BLE.yaml + file: + - Integrations/ESPHome/PUMP-1.yaml + - Integrations/ESPHome/PUMP-1_BLE.yaml steps: - name: Checkout source code uses: actions/checkout@v4.1.7 diff --git a/Integrations/ESPHome/Core.yaml b/Integrations/ESPHome/Core.yaml index 0540c2d..7403802 100644 --- a/Integrations/ESPHome/Core.yaml +++ b/Integrations/ESPHome/Core.yaml @@ -1,5 +1,5 @@ substitutions: - name: apollo-plt-1 # TODO: Rename + name: apollo-pump-1 version: "24.8.7.2" device_description: ${name} made by Apollo Automation - version ${version}. @@ -9,6 +9,13 @@ esp32: type: esp-idf api: + services: + - service: play_buzzer + variables: + song_str: string + then: + - rtttl.play: + rtttl: !lambda 'return song_str;' globals: - id: cycleCounter @@ -23,4 +30,139 @@ globals: captive_portal: web_server: - port: 80 \ No newline at end of file + port: 80 + +# Buzzer +output: + - platform: ledc + pin: GPIO10 + id: buzzer +rtttl: + output: buzzer + +switch: + - platform: factory_reset + id: factory_reset_switch + internal: true + - platform: gpio + pin: GPIO7 + name: "Pump Control" + id: pump_control + +binary_sensor: + - platform: status + name: Online + id: ink_ha_connected + - platform: gpio + pin: + number: GPIO9 + inverted: true + mode: + input: true + pullup: true + id: reset_button + on_press: + then: + - lambda: |- + id(button_press_timestamp) = millis(); + on_release: + then: + - lambda: |- + if (millis() - id(button_press_timestamp) >= 10000) { + // Remove Wifi + id(factory_reset_switch).turn_on(); + } + else { + // StatusCheck + id(statusCheck).execute(); + } + - platform: gpio + name: Water level exists + id: water_level_exists + icon: mdi:water + pin: + number: GPIO4 + mode: + input: true + pulldown: True + filters: + - invert: + + + +sensor: + - platform: internal_temperature + name: "ESP Temperature" + id: sys_esp_temperature + + - platform: uptime + name: Uptime + id: sys_uptime + update_interval: 60s + + - platform: wifi_signal + name: RSSI + id: wifi_signal_db + update_interval: 60s + entity_category: "diagnostic" + +light: + - platform: esp32_rmt_led_strip + id: rgb_light + name: "RGB Light" + pin: GPIO3 + rmt_channel: 0 + default_transition_length: 0s + chipset: WS2812 + num_leds: 1 + rgb_order: grb + effects: + - pulse: + name: "Slow Pulse" + transition_length: 1000ms + update_interval: 1000ms + min_brightness: 0% + max_brightness: 100% + - pulse: + name: "Fast Pulse" + transition_length: 100ms + update_interval: 100ms + min_brightness: 50% + max_brightness: 100% + +script: + - id: statusCheck + then: + - if: + condition: + - lambda: 'return id(ink_ha_connected).state;' + then: + - logger.log: "Apollo Automation: Connected To HA" + - light.turn_on: + id: rgb_light + brightness: 100% + red: 0% + green: 0% + blue: 100% + else: + - if: + condition: + - wifi.connected + then: + - logger.log: "Apollo Automation: Connected To Wifi" + - light.turn_on: + id: rgb_light + brightness: 100% + red: 0% + green: 100% + blue: 0% + else: + - logger.log: "Apollo Automation: Not Connected To Wifi" + - light.turn_on: + id: rgb_light + brightness: 100% + red: 100% + green: 100% + blue: 0% + - delay: 5s + - light.turn_off: rgb_light \ No newline at end of file diff --git a/Integrations/ESPHome/AIR-1.yaml b/Integrations/ESPHome/PUMP-1.yaml similarity index 57% rename from Integrations/ESPHome/AIR-1.yaml rename to Integrations/ESPHome/PUMP-1.yaml index 09d1a25..514c106 100644 --- a/Integrations/ESPHome/AIR-1.yaml +++ b/Integrations/ESPHome/PUMP-1.yaml @@ -1,20 +1,20 @@ esphome: name: "${name}" - friendly_name: Apollo AIR-1 # TODO: Rename - comment: Apollo AIR-1 # TODO: Rename + friendly_name: Apollo PUMP-1 + comment: Apollo PUMP-1 name_add_mac_suffix: true platformio_options: board_build.flash_mode: dio project: - name: "ApolloAutomation.AIR-1" # TODO: Rename + name: "ApolloAutomation.PUMP-1" version: "${version}" min_version: 2023.11.1 dashboard_import: - package_import_url: github://ApolloAutomation/AIR-1/Integrations/ESPHome/AIR-1.yaml - import_full_config: false # TODO: Rename + package_import_url: github://ApolloAutomation/PUMP-1/Integrations/ESPHome/PUMP-1.yaml + import_full_config: false improv_serial: @@ -36,7 +36,7 @@ update: - platform: http_request id: firmware_update name: Firmware Update - source: https://apolloautomation.github.io/PLT-1/artifact/manifest.json # TODO: Rename + source: https://apolloautomation.github.io/PUMP-1/artifact/manifest.json wifi: on_connect: @@ -45,9 +45,9 @@ wifi: on_disconnect: - ble.enable: ap: - ssid: "Apollo PLT1 Hotspot" # TODO: Rename + ssid: "Apollo PUMP1 Hotspot" logger: packages: - core: !include Core.yaml + core: !include Core.yaml \ No newline at end of file diff --git a/README.md b/README.md index d68fbe8..a322ea7 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# Apollo AIR-1 +# Apollo PUMP-1 -![Pen no dust](https://github.com/ApolloAutomation/AIR-1/assets/24777085/183af36d-4611-4cb3-af1e-43b84d4d201a) +![Pen no dust](https://github.com/ApolloAutomation/PUMP-1/assets/24777085/183af36d-4611-4cb3-af1e-43b84d4d201a) -Key Features of the AIR-1 Sensor: +Key Features of the PUMP-1 Sensor: MiCS-4514 Below have individual gas % readout: CO, C2H5OH (Alcohol), H2, NO2, and NH3 @@ -15,9 +15,9 @@ DPS310: Barometric air pressure and temperature. Dimensions & Design: -The AIR-1 measures just 61mm x 61mm x 30mm, and we have focused on efficient heat management within this small package to maintain sensor accuracy. This includes a thoughtful PCB layout and case design, incorporating ventilation and strategic component placement. +The PUMP-1 measures just 61mm x 61mm x 30mm, and we have focused on efficient heat management within this small package to maintain sensor accuracy. This includes a thoughtful PCB layout and case design, incorporating ventilation and strategic component placement. Links: \ Discord (Support/feedback/discussion/future products): [https://discord.gg/8PpS4yUaUh](https://discord.gg/mMNgQPyF94) \ -Shop: [https://apolloautomation.com](https://apolloautomation.com/products/air-1)https://apolloautomation.com/products/air-1 \ +Shop: [https://apolloautomation.com](https://apolloautomation.com/products/pump-1)https://apolloautomation.com/products/pump-1 \ Wiki: [https://wiki.apolloautomation.com](https://wiki.apolloautomation.com/)https://wiki.apolloautomation.com/ diff --git a/index.html b/index.html index 72b7774..ea3bae5 100644 --- a/index.html +++ b/index.html @@ -2,10 +2,10 @@ - Apollo AIR-1 Installer + Apollo PUMP-1 Installer @@ -79,7 +79,7 @@
-

Apollo AIR-1 Installer

+

Apollo PUMP-1 Installer

@@ -87,8 +87,8 @@

Apollo AIR-1 Installer