Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealFalseReality committed Nov 20, 2023
2 parents 5c1572e + d7352ed commit f68a19e
Show file tree
Hide file tree
Showing 13 changed files with 1,364 additions and 647 deletions.
670 changes: 23 additions & 647 deletions aquapi_config.yaml

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions common/aquapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
text_sensor:
# AquaPi Version
- platform: template
name: "AquaPi Version"
id: aquapi_version
icon: mdi:update
update_interval: 600s
lambda: |-
return {"${app_version}"};
entity_category: "diagnostic"

# GitHub Project URL
- platform: template
name: GitHub
id: github
icon: mdi:github
lambda: |-
return {"github.com/TheRealFalseReality/aquapi"};
entity_category: "diagnostic"
87 changes: 87 additions & 0 deletions common/binary.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
esphome:
on_boot:
priority: 200
then:
- component.update: water_level

binary_sensor:
# Optical Sensor - LOW (yellow)
- platform: gpio
id: os_low
pin:
number: ${opticalLowPin}
inverted: true
mode:
input: true
pullup: true
name: "Optical Sensor: Low"
filters:
- delayed_on_off: 30ms
on_state:
then:
component.update: water_level

# Optical Sensor - HIGH (blue)
- platform: gpio
id: os_high
pin:
number: ${opticalHighPin}
inverted: true
mode:
input: true
pullup: true
name: "Optical Sensor: High"
filters:
- delayed_on_off: 30ms
on_state:
then:
component.update: water_level

# Additional Pin 1
- platform: gpio
id: aux_1
pin:
number: ${auxPin1}
inverted: true
mode:
input: true
pullup: true
name: Aux 1
filters:
- delayed_on_off: 30ms

# Additional Pin 2
- platform: gpio
id: aux_2
pin:
number: ${auxPin2}
inverted: true
mode:
input: true
pullup: true
name: Aux 2
filters:
- delayed_on_off: 30ms

text_sensor:
# Water Level
- platform: template
icon: mdi:waves-arrow-up
name: "Water Level"
id: water_level
update_interval: "${update_water}"
lambda: |-
if(id(os_high).state == true && id(os_low).state == true) {
// Water Level is High
return {"High"};
}
if(id(os_high).state == false && id(os_low).state == false) {
// Water Level is Low
return {"Low"};
}
if(id(os_high).state == false && id(os_low).state == true) {
// Water Level is Normal
return {"Normal"};
} else {
return {"Uknown or Error"};
}
156 changes: 156 additions & 0 deletions common/device_base.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
esphome:
name: "${name}"
friendly_name: "${friendly_name}"
# Automatically add the mac address to the name
name_add_mac_suffix: ${suffix}
comment: "AquaPi ESP32 - Aquarium Controller & Monitor"
project:
name: TheRealFalseReality.aquapi
version: "${app_version}"
on_boot:
priority: 200
then:
- component.update: water_level

esp32:
board: esp32dev
framework:
type: arduino

dashboard_import:
package_import_url: github://TheRealFalseReality/aquapi/aquapi_config.yaml@main
import_full_config: ${import_config}

# Enable logging
logger:
level: "${logger}"

api:

ota:

wifi:
ap:

captive_portal:

# Sets up Bluetooth LE (Only on ESP32) to allow the user to provision wifi credentials to the device.
esp32_improv:
authorizer: none

improv_serial:

# i2c Pins
i2c:
sda: ${sdaPin}
scl: ${sclPin}
scan: true
id: bus_a

# Internal Blue LED
light:
- platform: status_led
id: internal_led
pin: GPIO2

sensor:
# Internal Magnetic Sensor
- platform: esp32_hall
name: "ESP32 Hall Sensor"
entity_category: "diagnostic"

# Internal Temp.
- platform: internal_temperature
name: "Internal Temperature"

# Wifi Signal
- platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB
# name: "WiFi Signal dB"
id: wifi_signal_db
update_interval: 60s
entity_category: "diagnostic"

# Wifi %
- platform: copy # Reports the WiFi signal strength in %
source_id: wifi_signal_db
name: "WiFi Signal Strength"
filters:
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
unit_of_measurement: "%"
entity_category: "diagnostic"

# Uptime sensor
- platform: uptime
name: Uptime

# of I2C devices connected
- platform: template
name: "I2C Devices Connected"
id: i2c_devices
icon: mdi:integrated-circuit-chip
entity_category: "diagnostic"
# disabled_by_default: true
lambda: |-
byte error, address;
int nDevices;
nDevices = 0;
for(address = 1; address < 127; address++) {
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0) {
nDevices++;
}
}
return nDevices;
binary_sensor:
# API Status
- platform: status
name: "Status"

text_sensor:
# Hostname
- platform: template
name: "Hostname"
id: hostname
icon: mdi:cellphone-arrow-down
lambda: |-
return {"${name}"};
entity_category: "diagnostic"

# Wifi Info
- platform: wifi_info
ip_address:
name: IP Address
icon: mdi:ip-network
ssid:
name: Connected SSID
icon: mdi:wifi-arrow-left-right
bssid:
name: Connected BSSID
icon: mdi:wifi-star
disabled_by_default: true
mac_address:
name: Mac Address
icon: mdi:chip

button:
# Soft Restart
- platform: restart
name: "Restart"

# Factory Reset
- platform: factory_reset
name: Factory Reset (USE WITH CAUTION)
disabled_by_default: true

# Safe Mode Restart
- platform: safe_mode
name: "Restart in Safe Mode"
id: restart_safe
disabled_by_default: true

# Shutdown
- platform: shutdown
name: "Shutdown"
disabled_by_default: true
Loading

0 comments on commit f68a19e

Please sign in to comment.