Searching the forum and elsewhere, I haven’t found any examples of using RAK with ESPHome. Is there any reason for this?
So, my case. I’m using a RAK19001 baseboard combined with RAK11200 to read sensors via SDI12 interface using RAK13010.
I need to use ESPHome for this since the solution is based on Home Assistant.
I already have a solution that uses ESP32 + a commercial SDI12 adapter running on ESPHome.
Searching through the documentation, I couldn’t figure out for sure how to use RAK with ESPHome for this solution.
In my attempt, using the official documentation as an example, I came up with this code:
esphome:
name: esphome-web-8d8d80
friendly_name: ESPHome Web 8d8d80
platform: ESP32
board: esp32dev
includes:
- uart_read_line_sensor.h
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
platform: esphome
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
captive_portal:
uart:
id: sensor_reader
tx_pin: 38 # WB_IO6
rx_pin: 37 # WB_IO5
baud_rate: 1200
text_sensor:
- platform: custom
text_sensors:
id: "sensor_reader_uart"
name: "Soil Sensor Reader"
lambda: |-
auto sensor_measurements = new UartReadLineSensor(id(sensor_reader));
App.register_component(sensor_measurements);
return {sensor_measurements};
switch:
- platform: uart
name: "read sensor 0"
data: '0M!'
- platform: uart
name: "get measurement 0"
data: '0D0!'
- platform: uart
name: "read sensor 1"
data: '1M!'
- platform: uart
name: "get measurement 1"
data: '1D0!'
This code already works with my current solution. So I just tried to adapt it for use with RAK.
The first problem. The compiler gives the error GPIO38 (34-39) does not support output pin mode.