I need some help with ESPHome, uart port and a Windsonic anemonemeter

Ya @jorgenn Tx on arduino is connected to Rx in Wemos D1 mini. But when it does, Wemos D1 will be disconnected from network and the status become offline.

I think i want to try MQTT instead of ESPHome. Hope it’ll give different result. Thanks a lot :+1:

Are you perhaps connecting gpio0 to ground, thereby locking it in flash mode?

Also arduinos are generally 5v logic and esp has 3v3 logic. Are you kevel shifting?

An update on my Gill Windsonic sensor.
So far I has it running and internally it reads the sensor via uart, and publish correctly the variables in the log window in the esphome desktop. And it shows up as an integration, but not showing my to subsensors.

This is my current Yaml file:

esphome:
  name: vind
  platform: ESP32
  board: esp-wrover-kit
  includes:
    - windsonic.h
wifi:
  ssid: "dark-side"
  password: "xxxxxx"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Vind Fallback Hotspot"
    password: "xxxxx"

captive_portal:

# Enable logging
logger:
  baud_rate: 0
# Enable Home Assistant API
api:
  password: "xxxxxx"

ota:
  password: "xxxxxxx"

uart:
  id: wind
  tx_pin: GPIO1
  rx_pin: GPIO3
  baud_rate: 19200
  
sensor:
- platform: custom
  lambda: |-
    auto my_Windsonic = new Windsonic(id(wind));
    App.register_component(my_Windsonic);
    return {my_Windsonic->retning_sensor, my_Windsonic->hastighet_sensor};     
    
  sensors:
  - name: "Vindretning"
    unit_of_measurement: °Grader
    accuracy_decimals: 3
  - name: "Vindhastighet"
    unit_of_measurement: ms
    accuracy_decimals: 3
    
    
  

And her is my windaonic.h file:

#include "esphome.h"

class Windsonic : public Component, public Sensor, public UARTDevice {
 public:
  Windsonic(UARTComponent *parent) : UARTDevice(parent) {}
  Sensor *hastighet_sensor = new Sensor();
  Sensor *retning_sensor = new Sensor();
  float retning;
  float hastighet;
  
  
  void setup() override {
    // nothing to do here
  }
  void loop() override {
    // Use Arduino API to read data, for example
	String line = readStringUntil('\n');
    String r = line.substring(7, 10);
	String s = line.substring(14, 19);
	retning = r.toFloat();
	hastighet = s.toFloat();
    retning_sensor->publish_state(retning);
    hastighet_sensor->publish_state(hastighet);
	retning = 0;
	hastighet = 0;
	r = "";
	s = "";
  }
  
};

Are I’m doing something wrong regarding getting my to variables to show up in lovelace ?

My reading of the docs is that the return line should refer to my_sensor not my_windsonic

That is the name you give it in the definition, have testet both, no difference.
So there must be some way in the yaml file to define what to be displayed.

Just re-read? Nothing you do in esphome will configure your Lovelace, you need to do that in the ha frontend.

To be a little clearer, this windsonic shows up in in the unit list in configurastion in Home Assitant, but the 2 sensor doesn’t show up as entities. So there are nothing to grab onto in lovelace editor.

So nothing in States ui?

Not so far.

This is to lines from the log on this ESP:

[00:58:40][D][sensor:092]: 'Vindretning': Sending state 0.00000 °Grader with 3 decimals of accuracy
[00:58:40][D][sensor:092]: 'Vindhastighet': Sending state 0.00000 ms with 3 decimals of accuracy

The reason for 0 in both values is that the sensor is indoor for the moment, I have testet this with a fan pointet to the sensor. So it reads correctly

In devtools log I find this repeating:

WARNING (MainThread) [homeassistant.components.esphome] Error getting initial data: Timeout while waiting for API response!

And still nothing States ui

Are there any limitations in ESPHome custom sensor ? The ESP is doing what i should do, and to me it’s looks like there are limitation on sensor names and data types.

What exactly is shown for this device the integrations tab in ha?

This is what is shown in integration and unit

Just to make sure everything else is working as it should try adding some known working component like uptime or rssi.

Added Uptime sensor, but doesn’t show up

Can you post your full esphome log please?

here is the log from the ESPHome dashboard:

ESPHome Dashboardmore_vert
OTA (Over-The-Air)
memory
cam1more_vert
 . Full path: /config/esphome/cam1.yaml

UPLOAD EDIT SHOW LOGS VALIDATE
memory
lcd2more_vert
 . Full path: /config/esphome/lcd2.yaml

UPLOAD EDIT SHOW LOGS VALIDATE
memory
temperaturmore_vert
 . Full path: /config/esphome/temperatur.yaml

UPLOAD EDIT SHOW LOGS VALIDATE
memory
vindmore_vert
 . Full path: /config/esphome/vind.yaml

UPLOAD EDIT SHOW LOGS VALIDATE
Show Logs vind.yaml
INFO Reading configuration /config/esphome/vind.yaml...
INFO Starting log output from vind.local using esphome API
INFO Connecting to vind.local:6053 (192.168.2.155)
INFO Successfully connected to vind.local
[01:42:25][I][app:100]: ESPHome version 1.14.3 compiled on Apr 11 2020, 01:18:25
[01:42:25][C][wifi:415]: WiFi:
[01:42:25][C][wifi:283]:   SSID: [redacted]
[01:42:25][C][wifi:284]:   IP Address: 192.168.2.155
[01:42:25][C][wifi:286]:   BSSID: [redacted]
[01:42:25][C][wifi:287]:   Hostname: 'vind'
[01:42:25][C][wifi:291]:   Signal strength: -50 dB ▂▄▆█
[01:42:25][C][wifi:295]:   Channel: 1
[01:42:25][C][wifi:296]:   Subnet: 255.255.255.0
[01:42:25][C][wifi:297]:   Gateway: 192.168.2.1
[01:42:25][C][wifi:298]:   DNS1: 192.168.2.1
[01:42:25][C][wifi:299]:   DNS2: 0.0.0.0
[01:42:26][E][uart:096]: Reading from UART timed out at byte 0!
[01:42:26][D][sensor:092]: 'Wind direction': Sending state 0.00000 °Degrees with 3 decimals of accuracy
[01:42:26][D][sensor:092]: 'Wind speed': Sending state 0.00000 ms with 3 decimals of accuracy
[01:42:26][C][uart:040]: UART Bus:
[01:42:26][C][uart:042]:   TX Pin: GPIO1
[01:42:26][C][uart:045]:   RX Pin: GPIO3
[01:42:26][C][uart:047]:   Baud Rate: 19200 baud
[01:42:26][C][uart:048]:   Stop bits: 1
[01:42:27][E][uart:096]: Reading from UART timed out at byte 0!
[01:42:27][D][sensor:092]: 'Wind direction': Sending state 0.00000 °Degrees with 3 decimals of accuracy
[01:42:27][D][sensor:092]: 'Wind speed': Sending state 0.00000 ms with 3 decimals of accuracy
[01:42:27][C][uptime.sensor:030]: Uptime Sensor 'Uptime Sensor'
[01:42:27][C][uptime.sensor:030]:   Unit of Measurement: 's'
[01:42:27][C][uptime.sensor:030]:   Accuracy Decimals: 0
[01:42:27][C][uptime.sensor:030]:   Icon: 'mdi:timer'
[01:42:28][E][uart:096]: Reading from UART timed out at byte 0!
[01:42:28][D][sensor:092]: 'Wind direction': Sending state 0.00000 °Degrees with 3 decimals of accuracy
[01:42:28][D][sensor:092]: 'Wind speed': Sending state 0.00000 ms with 3 decimals of accuracy
[01:42:28][C][logger:175]: Logger:
[01:42:28][C][logger:176]:   Level: DEBUG
[01:42:28][C][logger:177]:   Log Baud Rate: 0
[01:42:28][C][logger:178]:   Hardware UART: UART0
[01:42:29][E][uart:096]: Reading from UART timed out at byte 0!
[01:42:29][D][sensor:092]: 'Wind direction': Sending state 0.00000 °Degrees with 3 decimals of accuracy
[01:42:29][D][sensor:092]: 'Wind speed': Sending state 0.00000 ms with 3 decimals of accuracy
[01:42:29][D][api:067]: Disconnecting Home Assistant 0.108.2 (192.168.2.42)
[01:42:30][E][uart:096]: Reading from UART timed out at byte 0!
[01:42:30][D][sensor:092]: 'Wind direction': Sending state 0.00000 °Degrees with 3 decimals of accuracy
[01:42:30][D][sensor:092]: 'Wind speed': Sending state 0.00000 ms with 3 decimals of accuracy
[01:42:31][E][uart:096]: Reading from UART timed out at byte 0!
[01:42:31][D][sensor:092]: 'Wind direction': Sending state 0.00000 °Degrees with 3 decimals of accuracy
[01:42:31][D][sensor:092]: 'Wind speed': Sending state 0.00000 ms with 3 decimals of accuracy
[01:42:31][C][captive_portal:169]: Captive Portal:
[01:42:32][E][uart:096]: Reading from UART timed out at byte 0!
[01:42:32][D][sensor:092]: 'Wind direction': Sending state 0.00000 °Degrees with 3 decimals of accuracy
[01:42:32][D][sensor:092]: 'Wind speed': Sending state 0.00000 ms with 3 decimals of accuracy
[01:42:32][C][ota:029]: Over-The-Air Updates:
[01:42:32][C][ota:030]:   Address: vind.local:3232
[01:42:32][C][ota:032]:   Using Password.
[01:42:33][E][uart:096]: Reading from UART timed out at byte 0!
[01:42:33][D][sensor:092]: 'Wind direction': Sending state 0.00000 °Degrees with 3 decimals of accuracy
[01:42:33][D][sensor:092]: 'Wind speed': Sending state 0.00000 ms with 3 decimals of accuracy
[01:42:33][C][api:095]: API Server:
[01:42:33][C][api:096]:   Address: vind.local:6053
[01:42:34][E][uart:096]: Reading from UART timed out at byte 0!
[01:42:34][D][sensor:092]: 'Wind direction': Sending state 0.00000 °Degrees with 3 decimals of accuracy
[01:42:34][D][sensor:092]: 'Wind speed': Sending state 0.00000 ms with 3 decimals of accuracy
[01:42:34][D][api.connection:583]: Client 'Home Assistant 0.108.2 (192.168.2.42)' connected successfully!
[01:42:35][E][uart:096]: Reading from UART timed out at byte 0!
[01:42:35][D][sensor:092]: 'Wind direction': Sending state 0.00000 °Degrees with 3 decimals of accuracy
[01:42:35][D][sensor:092]: 'Wind speed': Sending state 0.00000 ms with 3 decimals of accuracy
[01:42:36][E][uart:096]: Reading from UART timed out at byte 0!
[01:42:36][D][sensor:092]: 'Wind direction': Sending state 0.00000 °Degrees with 3 decimals of accuracy
[01:42:36][D][sensor:092]: 'Wind speed': Sending state 0.00000 ms with 3 decimals of accuracy
[01:42:37][E][uart:096]: Reading from UART timed out at byte 0!
[01:42:37][D][sensor:092]: 'Wind direction': Sending state 0.00000 °Degrees with 3 decimals of accuracy
[01:42:37][D][sensor:092]: 'Wind speed': Sending state 0.00000 ms with 3 decimals of accuracy
[01:42:38][E][uart:096]: Reading from UART timed out at byte 0!
[01:42:39][D][sensor:092]: 'Wind direction': Sending state 0.00000 °Degrees with 3 decimals of accuracy
[01:42:39][D][sensor:092]: 'Wind speed': Sending state 0.00000 ms with 3 decimals of accuracy
[01:42:40][E][uart:096]: Reading from UART timed out at byte 0!
[01:42:40][D][sensor:092]: 'Wind direction': Sending state 0.00000 °Degrees with 3 decimals of accuracy
[01:42:40][D][sensor:092]: 'Wind speed': Sending state 0.00000 ms with 3 decimals of accuracy
[01:42:41][E][uart:096]: Reading from UART timed out at byte 0!
[01:42:41][D][sensor:092]: 'Wind direction': Sending state 0.00000 °Degrees with 3 decimals of accuracy
[01:42:41][D][sensor:092]: 'Wind speed': Sending state 0.00000 ms with 3 decimals of accuracy
[01:42:42][E][uart:096]: Reading from UART timed out at byte 0!
[01:42:42][D][sensor:092]: 'Wind direction': Sending state 0.00000 °Degrees with 3 decimals of accuracy
[01:42:42][D][sensor:092]: 'Wind speed': Sending state 0.00000 ms with 3 decimals of accuracy
[01:42:42][D][api:067]: Disconnecting Home Assistant 0.108.2 (192.168.2.42)
[01:42:43][E][uart:096]: Reading from UART timed out at byte 0!
[01:42:43][D][sensor:092]: 'Wind direction': Sending state 0.00000 °Degrees with 3 decimals of accuracy
[01:42:43][D][sensor:092]: 'Wind speed': Sending state 0.00000 ms with 3 decimals of accuracy
[01:42:44][E][uart:096]: Reading from UART timed out at byte 0!
[01:42:44][D][sensor:092]: 'Wind direction': Sending state 0.00000 °Degrees with 3 decimals of accuracy
[01:42:44][D][sensor:092]: 'Wind speed': Sending state 0.00000 ms with 3 decimals of accuracy
[01:42:45][E][uart:096]: Reading from UART timed out at byte 0!
[01:42:45][D][sensor:092]: 'Wind direction': Sending state 0.00000 °Degrees with 3 decimals of accuracy
[01:42:45][D][sensor:092]: 'Wind speed': Sending state 0.00000 ms with 3 decimals of accuracy
[01:42:46][E][uart:096]: Reading from UART timed out at byte 0!
[01:42:46][D][sensor:092]: 'Wind direction': Sending state 0.00000 °Degrees with 3 decimals of accuracy
[01:42:46][D][sensor:092]: 'Wind speed': Sending state 0.00000 ms with 3 decimals of accuracy
[01:42:47][E][uart:096]: Reading from UART timed out at byte 0!
[01:42:47][D][sensor:092]: 'Wind direction': Sending state 0.00000 °Degrees with 3 decimals of accuracy
[01:42:47][D][sensor:092]: 'Wind speed': Sending state 0.00000 ms with 3 decimals of accuracy
[01:42:48][E][uart:096]: Reading from UART timed out at byte 0!
[01:42:48][D][sensor:092]: 'Wind direction': Sending state 0.00000 °Degrees with 3 decimals of accuracy
[01:42:48][D][sensor:092]: 'Wind speed': Sending state 0.00000 ms with 3 decimals of accuracy
[01:42:48][D][api.connection:583]: Client 'Home Assistant 0.108.2 (192.168.2.42)' connected successfully!
© 2019 Copyright ESPHome, Made with MaterializeESPHome 1.14.3 Documentation

@nickrout I used arduino version with 3.3v logic. I verified it from official source over here. Thanks for the hint

@nickrout Pins on Wemos D1 mini are clear except Tx Rx pin, because i connect those pin to serial on my arduino. I also tried to use teensy instead of arduino, but the result is same.