Arduino sensor unavailable after HA re-start

Hi, relative newbie here. I’m using Dawid Chyrzynski’s Arduino HA library to integrate a level sensor connected to my Arduino back into HA. I was quite chuffed when I got it to all work in mid Dec 2023. I even got a flow going in Node-Red to autofill the tank when the level is low :slight_smile:

It broke during a HA update in mid Feb 2024. I don’t recall the exact versions of HA, but I just do the updates when they are released and then fix the issues. I think it broke due to the naming of the unique_id etc. I got that sorted but still have an issue when HA reboots, the Arduino needs to be power cycled as the entity state shows as ‘unavailable’. I even fired up another Arduino using some of Dawid’s sample code just to prove that it wasn’t my coding and that exhibits the same behaviour.

I’m not exactly sure where the issue lies as MQTT explorer shows messages being transmitted from the Arduino. It’s like HA needs to rediscover the Arduino as the state changes from unavailable to unknown then a value.

Power cycling the Arduino is a work around as it’s a 1km return trip from the house to do this!!

Any help would be much appreciated. I’m happy to post more info as requested. Thx.

Did you implement LWT ?

Thx Francis, yes, it’s both in the Arduino code and the HA MQTT config.

Matt