Connection problem after reboot of Home Assitant

I have several ESPHome units that works very well with one exception. This one is running av custom sensor and is function well until I do a reboot off the home assistant. Then its shows up as connected in the ESPHome listing, but when i look at it in it’s lovelace card it shows “unaviable” instead off the data it should have shown.

Is there some way to to let this ESPHome instance check that it’s properly connected to the Home Assistant, and if not do a full reboot by itself ?

I think it is probably waiting for an update of the sensor data. However this may help

I did test you’re sugestion, but then it stops working all togehter.

This sensor is a Gill instruments Windsonic Anemometer who updates values each second.

So each time I restart Home Assistant then I have to restart this ESP32, noe one off the other ones need that.

Is there any API command, funtion I can use i the C++ code on the ESP32 that can help with this ?

Why not run a service call on homeassistant start? Turn this switch on and the esp device will restart.

I will try to develope this sensor into a proffesional level, ie it must restart itself if the data is not presentet correctly.

i have earlier used this type off sensors running on python scripts publishing winddata to critical uses for ferries in the north off Norway, so I’m trying to get this done on the ESPHome platform using Home Assistant as the server component.

So far the sensors running stable as long as I don’t restart Home Assistant, Now it’s time to get this last bit fixed.
So is there some way to set the ESPHome to reboot in a set time interval ?

The sensor should be picked up on home assistant restart, I am not sure why you are having problems.

Yes, regular reboot is well documented.

But if the problem arises only when restarting homeassistant, why not restart the esphome device when home assistant restarts?

Anyway, to restart every day:

  - platform: restart
    name: "Kitchen32 Restart"
    id: "restart_switch"
  - platform: homeassistant
    id: time1
    timezone: Pacific/Auckland
      - seconds: 0
        minutes: 0
        hours: 4
        days_of_week: MON-SUN
           - switch.toggle: restart_switch

I have tried to place these configs both beforee and after the config for the wind sensor config in the sensors YAML file. No difference.

So I’m beginning to suspect that it’s somthing I need to change in the sensors .h file. maybe go from it being a subclass off component to being a subclass off pollingcomponent.

here is my windsonic.h file

#include "esphome.h"
#include "sensor.h"

class Windsonic : public Component, public UARTDevice {
  Windsonic(UARTComponent *parent) : UARTDevice(parent) {}
  Sensor *winddirection_sensor = new Sensor();
  Sensor *windspeed_sensor = new Sensor();
  void setup() override {
    // nothing to do here
  void loop() override {
    // Use Arduino API to read data, for example
  //String line = "";  
  String line = readStringUntil('\n');
  String r = line.substring(7, 10);
  String s = line.substring(13, 19);
  float winddirection = r.toFloat();
  float windspeed = s.toFloat();
  winddirection = 0;
  windspeed = 0;
  r = "";
  s = "";