volca / april-soil-esphome-module

Custom april soil moisture sensor module for esphome
https://wiki.aprbrother.com/en/april_soil_moisture_sensor.html
2 stars 1 forks source link

Flashing ESP32 S2 April Moistue Sensor #1

Closed peterbarbosa closed 3 months ago

peterbarbosa commented 3 months ago

Hello,

I am trying to use this project to connect my newly purchased April Soil Moisture sensors to MQTT.

First, I am hoping to flash it with the ESPHome web installer from my PC, then will use HA (HAOS) to install the project over wifi.

I am trying to do a test flash on ESPHome web, and am following the instructions:

**With battery removed/unplugged

Press and hold IO0 Plug USB cable. Wait seconds for boot Release IO0**

I keep running into the issue where it says

Failed to initialize. Try resetting your device or holding the BOOT button while selecting your serial port until it starts preparing the installation.

Any ideas or better way to implement this? Should I run ESPHome on my PC and try flashing from there? Is there a different sequence of buttons I should be trying?

volca commented 3 months ago
peterbarbosa commented 3 months ago

Hi @volca I've made some progress:

Now I am trying to get the code in this repo to work. My steps:

  1. Load the necessary files into ESPHome config folder
  2. Do a manual install of april-soil.yaml, download bin to local PC
  3. Upload bin via Adafruit ESPTool (from local PC)

When I run #2 from ESPHome, I get the following error now:

UnknownPackageError: Could not find the package with 'espressif/toolchain-riscv32-esp @ 8.4.0+2021r1' requirements for your system 'linux_x86_64' My guess is im missing some kind of dependency or package on my ESPHome instance. Any ideas?

peterbarbosa commented 3 months ago

I've made it one step further (I believe).

On april-soil.yaml line 9, I changed the version number from 2.0.1 to 2.0.6.

It now compiles, but at the end I get this error:

*** [.pioenvs/april-soil/bootloader.bin] Source /root/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s2/bin/bootloader__80m.elf' not found, needed by target.pioenvs/april-soil/bootloader.bin'. ========================= [FAILED] Took 56.47 seconds =========================

volca commented 3 months ago

Hi Peter,

The yaml is outdated. I just made a little modify for the april-soil.yaml and compiled it. see my log

INFO ESPHome 2024.7.0
INFO Reading configuration april-soil.yaml...
WARNING `attenuation: 11db` is deprecated, use `attenuation: 12db` instead
INFO Generating C++ source...
INFO Core config or version changed, cleaning build files...
INFO Compiling app...
Processing april-soil (board: esp32-s2-saola-1; framework: arduino; platform: platformio/espressif32@5.4.0)
----------------------------------------------------------------------------------------------------------------------
Tool Manager: Installing espressif/toolchain-xtensa-esp32s2 @ 8.4.0+2021r2-patch5
INFO Installing espressif/toolchain-xtensa-esp32s2 @ 8.4.0+2021r2-patch5
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Tool Manager: toolchain-xtensa-esp32s2@8.4.0+2021r2-patch5 has been installed!
INFO toolchain-xtensa-esp32s2@8.4.0+2021r2-patch5 has been installed!
Tool Manager: Installing platformio/framework-arduinoespressif32 @ ~3.20005.0
INFO Installing platformio/framework-arduinoespressif32 @ ~3.20005.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Tool Manager: framework-arduinoespressif32@3.20005.220925 has been installed!
INFO framework-arduinoespressif32@3.20005.220925 has been installed!
Library Manager: Installing bblanchon/ArduinoJson @ 6.18.5
INFO Installing bblanchon/ArduinoJson @ 6.18.5
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Library Manager: ArduinoJson@6.18.5 has been installed!
INFO ArduinoJson@6.18.5 has been installed!
HARDWARE: ESP32S2 240MHz, 320KB RAM, 4MB Flash
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
 - toolchain-xtensa-esp32s2 @ 8.4.0+2021r2-patch5
Dependency Graph
|-- Wire @ 2.0.0
|-- WiFi @ 2.0.0
|-- ESPmDNS @ 2.0.0
peterbarbosa commented 3 months ago

Hi @volca - this compiles good and loads onto my board!

I can see the board on my network with an assigned IP but I cant see it on HA via my MQTT broker.

What format should mqtt_brower be? Should it include port?

And is there anywhere to put your mqtt username (is it required)?

volca commented 3 months ago

I just put the broker host like this

mqtt_broker: 192.168.31.20

Does your MQTT broker have username and password? Or you should add it to the yaml file

volca commented 3 months ago

You can edit the april-soild.yaml and add the MQTT username & password directly. see the link

https://esphome.io/components/mqtt.html

peterbarbosa commented 3 months ago

Yes that seems to have worked :)

volca commented 3 months ago

Thanks for your update quickly! So I will close the issue.