ESPHome Pin Pullup on init

I’ve almost got a device (Wio Link) running with esphome. However, I need to write to a pin to activate the ports prior to trying to do anything with them like so (https://github.com/Seeed-Studio/Wio_Link/wiki/Advanced-User-Guide#61-use-wio-link-as-arduino):

pinMode(15, OUTPUT);
digitalWrite(15, 1);

I saw a lot of scripting that can be done in the yaml, but I didn’t see anything where I could simply execute anything like a pin pullup prior to anything else. Any ideas?

Define your pins including pullup mode and then write to them on boot with a high priority.

You sir have saved me a lot of time. I’m looking forward to being able to add a number of grove sensors to what is supported.

Thank you! :slight_smile: The year is 2022 and I’ve found an old WIOLINK in my boxes… why not try it in ESPhome?
So, In order to help other guys, here’s my full config for a Grove DHT22 sensor + wio link board to be used as an example (not sure if this is the right way, but at least it works! hehe).

esphome:
  name: "wiolink"

esp8266:
  board: wio_link

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "mysecretssid"
    password: "mysecretpassword"

captive_portal:
    
output:
  - platform: gpio
    id: SENSORS_ON
    pin:
      number: GROVE
      mode: INPUT_PULLUP

sensor:
  - platform: dht
    pin: D0
    model: DHT22
    temperature:
      name: "WioLink Temperature"
    humidity:
      name: "WioLink Humidity"
    update_interval: 60s

1 Like