I worked up a config that uses a GPIO to control a slow PWM while giving me control of the duty cycle. This felt like a simple task for an ESP12F (ESP8266EX) that I had a few and the compiled report showed below 50% use of flash and ram. I ended up trying it on two different ESP12F parts and both gave me lots of connection issues to HA. The basic automation in the config worked just fine but the api never really worked after HA integration. Lots of warnings the api was blocking too long and disconnects. Finally changed the config to run on an ESP32-S3 part with the same functions and works without issues. This is running ESPhome 2023.8.2 as an add-on to HA.
Does the config below put too much on the ESP8266? If not, should I be debugging the ESP8266 or maybe try another framework or platformio settings?
substitutions:
device_name: Humidifier
pwm_period: 60s
esphome:
name: humidifier
friendly_name: ${device_name}
esp8266:
board: esp12e
restore_from_flash: True
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "xxx"
ota:
password: "xxx"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 192.168.10.20
gateway: 192.168.10.1
subnet: 255.255.255.0
dns1: xxx
dns2: xxx
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Humidifier Fallback Hotspot"
password: "xxx"
captive_portal:
# Enable NTP
time:
- platform: sntp
id: my_time
# General Config
text_sensor:
- platform: version
name: "${device_name} Version"
- platform: wifi_info
ip_address:
name: "IP Address"
ssid:
name: "SSID"
bssid:
name: "BSSID"
sensor:
- platform: wifi_signal
name: "WiFi Signal"
update_interval: 60s
filters:
- delta: 0.01
- throttle: 300s
- platform: uptime
name: "${device_name} Uptime"
filters:
- throttle: 300s
binary_sensor:
- platform: gpio
pin:
number: GPIO14
mode:
input: True
pullup: True
inverted: True
name: "Humidity Request"
id: humidity_request
device_class: running
filters:
- delayed_on: 10ms
on_press:
- output.set_level:
id: pwm_out1
level: !lambda return (id(on_time).state/100);
on_release:
- output.set_level:
id: pwm_out1
level: !lambda return 0;
# - platform: template
# name: "Valve State"
# id: valve_state
number:
- platform: template
id: on_time
name: "Mist Duty Cycle"
optimistic: True
min_value: 0
max_value: 100
step: 10
unit_of_measurement: "%"
restore_value: True
initial_value: 30
output:
- platform: slow_pwm
id: pwm_out1
period: ${pwm_period}
pin:
number: GPIO2
inverted: True
restart_cycle_on_state_change: True
# turn_on_action:
# - binary_sensor.template.publish:
# id: valve_state
# state: ON
# turn_off_action:
# - binary_sensor.template.publish:
# id: valve_state
# state: OFF