Hi all,
I developed a pool pump automation system. Basically it starts and stops the pool pump at two different time intervals set by Home Assistant and also reports back on current usage, temperature and humidity in the pump house.
When I installed the device in the pump house, it wouldn’t connect to my AP at all. I made the external antenna mod and it now connects. Sometimes it stays connected for hours, and sometimes it barely connects at all in a span of 24 hours. I also disabled the power saving setting.
Looking at the debug log, it shows a signal of -40db, but looking at my access point it shows a signal of -85db. Based on that, I’m deducting the ESP32 is receiving the WIFI signal ok, but the AP is not seeing the ESP with the same strength.
Has anyone experienced a similar issue? Is there a way to increase the TX power of the ESP32?
I’m attaching my code below for reference. Thank you!
esphome:
name: poolpump
platform: ESP32
board: esp32doit-devkit-v1
on_boot:
then:
lambda: |-
if (id(pump_on_switch).state) { // ON mode
id(pool_mode_auto).turn_off();
id(pool_mode_off).turn_off();
id(pool_mode_on).turn_on();
id(pool_pump_run).turn_on();
} else {
if (id(pump_off_switch).state) { //OFF mode
id(pool_pump_run).turn_off();
id(pool_mode_auto).turn_off();
id(pool_mode_on).turn_off();
id(pool_mode_off).turn_on();
} else { //AUTO mode
id(pool_mode_on).turn_off();
id(pool_mode_off).turn_off();
id(pool_mode_auto).turn_on();
}
}
wifi:
power_save_mode: none
fast_connect: on
networks:
- ssid: xxxx
password: xxxx
time:
- platform: homeassistant
id: homeassistant_time
timezone: Australia/Sydney
on_time:
- seconds: 0
minutes: /1
then:
- script.execute: minute_script
# Pump timer control
script:
- id: minute_script
then:
lambda: |-
if (id(pump_timer1).state) {
if ((id(pump_start_minute1).state == id(homeassistant_time).now().minute) &&
(id(pump_start_hour1).state == id(homeassistant_time).now().hour)) {
id(pool_pump).turn_on();
}
if ((id(pump_stop_minute1).state == id(homeassistant_time).now().minute) &&
(id(pump_stop_hour1).state == id(homeassistant_time).now().hour)) {
id(pool_pump).turn_off();
}
}
if (id(pump_timer2).state) {
if ((id(pump_start_minute2).state == id(homeassistant_time).now().minute) &&
(id(pump_start_hour2).state == id(homeassistant_time).now().hour)) {
id(pool_pump).turn_on();
}
if ((id(pump_stop_minute2).state == id(homeassistant_time).now().minute) &&
(id(pump_stop_hour2).state == id(homeassistant_time).now().hour)) {
id(pool_pump).turn_off();
}
}
# Pins description
# 27: On Led (Red)
# 26: Auto Led (Yellow)
# 25: Off Led (Green)
#
# 33: Pump control (Output)
#
# 19: Power meter 500 pulses -> 1kWh
#
# 18: Pump mode sw On
# 13: Pump mode sw Off
#
# 14: DHT22 Temperature sensor (IO)
# A0: Pump current (AI)
switch:
- platform: gpio
pin: 27
name: "Pool Pump Mode On"
id: pool_mode_on
- platform: gpio
pin: 26
name: "Pool Pump Mode Auto"
id: pool_mode_auto
- platform: gpio
pin: 25
name: "Pool Pump Mode Off"
id: pool_mode_off
#Pool Pump Control: Internal switch
- platform: gpio
pin: 33
id: pool_pump_run
restore_mode: ALWAYS_OFF
- platform: template
name: "Pool Pump Run"
id: pool_pump
lambda: |-
if (id(pool_pump_run).state) {
return true;
} else {
return false;
}
turn_on_action:
lambda: |-
if (id(pool_mode_auto).state) {
id(pool_pump_run).turn_on();
}
turn_off_action:
lambda: |-
if (id(pool_mode_auto).state) {
id(pool_pump_run).turn_off();
}
sensor:
- platform: adc
pin: A0
id: pool_pump_ct
update_interval: 15s
attenuation: 11db
- platform: ct_clamp
sensor: pool_pump_ct
name: "Pool Pump Current"
update_interval: 15s
filters:
- calibrate_linear:
# Measured value of 0 maps to 0A
- 0.006 -> 0
- 0.42 -> 6.1
- 0.55 -> 8.5
id: pool_pump_current
- platform: dht
model: DHT22
pin: 14
temperature:
name: "Pumphouse Temperature"
humidity:
name: "Pumphouse Humidity"
update_interval: 60s
# Pump start stop times from Home Assistant
- platform: homeassistant
# name: "Pump Start Hour"
entity_id: input_number.pump_start_hour1
id: pump_start_hour1
- platform: homeassistant
# name: "Pump Start Minute"
entity_id: input_number.pump_start_minute1
id: pump_start_minute1
- platform: homeassistant
# name: "Pump Stop Hour"
entity_id: input_number.pump_stop_hour1
id: pump_stop_hour1
- platform: homeassistant
# name: "Pump Stop Minute"
entity_id: input_number.pump_stop_minute1
id: pump_stop_minute1
- platform: homeassistant
# name: "Pump Start Hour"
entity_id: input_number.pump_start_hour2
id: pump_start_hour2
- platform: homeassistant
# name: "Pump Start Minute"
entity_id: input_number.pump_start_minute2
id: pump_start_minute2
- platform: homeassistant
# name: "Pump Stop Hour"
entity_id: input_number.pump_stop_hour2
id: pump_stop_hour2
- platform: homeassistant
# name: "Pump Stop Minute"
entity_id: input_number.pump_stop_minute2
id: pump_stop_minute2
- platform: pulse_counter
pin: 19
unit_of_measurement: 'kW'
name: 'Pool Pump Power Meter'
id: pump_power_meter
filters:
- multiply: 0.12
- platform: total_daily_energy
name: "Pool Pump Total Daily Energy"
power_id: pump_power_meter
binary_sensor:
- platform: gpio
pin:
number: 18
inverted: True
mode:
input: True
pullup: True
# name: "Pump On Switch"
id: pump_on_switch
on_press:
then:
- switch.turn_on: pool_pump_run
- switch.turn_on: pool_mode_on
- switch.turn_off: pool_mode_auto
on_release:
then:
- switch.turn_off: pool_mode_on
- switch.turn_on: pool_mode_auto
- platform: gpio
pin:
number: 13
inverted: True
mode:
input: True
pullup: True
# name: "Pump Off Switch"
id: pump_off_switch
on_press:
then:
- switch.turn_off: pool_pump_run
- switch.turn_on: pool_mode_off
- switch.turn_off: pool_mode_auto
on_release:
then:
- switch.turn_off: pool_mode_off
- switch.turn_on: pool_mode_auto
- platform: template
id: pump_run_sensor
name: "Pool Pump Running"
lambda: |-
if (id(pool_pump_current).state > 1.5) {
return true;
} else {
return false;
}
- platform: homeassistant
# name: "Pump Timer 1"
entity_id: input_boolean.pump_timer1
id: pump_timer1
- platform: homeassistant
# name: "Pump Timer 2"
entity_id: input_boolean.pump_timer2
id: pump_timer2
# Enable logging
logger:
api:
ota: