But it doesn’t show in Home Assistant. I tried adding device_class: timestamp since I read in another thread that humidity needs a device class to show, and I thought that might be the problem here too. But ut still doesn’t show in Hass at all. How can I make it show? Do I need to create an MQTT sensor in Hass for each of the ten plus ESPHome devices and use that instead? That seems unnecessary complicated. The wifi sensor has the same problem, I have this code:
ESPHome and HA have over the past years made massive improvements to the built-in Native API Component such that it does almost everything that we used to need MQTT to do.
MQTT works well and still has its uses … but be aware that there are still a large number of users, forum posts and blog entries which say to use MQTT because that used to be the best option. For those who are already familiar with MQTT there is no good reason to change … but for new users I suggest that the Native API component will be much easier.
This is a system running in my boat. And my problem was that the native API did not play nice when MQTT was activated at the same time. For safety reasons I have a redundancy system that uses MQTT to make sure that even if an ESP should boot, the relays that were on before the boot will still be on.
That system runs on a separate Pi that has a few extra checks (one of them being a custom Python script running at all times) to make sure everything’s working as it should. It can also control the main Pi by restarting Hass or SignalK (boating software) when they lock up (which almost never happens, but if it happens at the wrong time it can be dangerous) and reboot/power cycle the main Pi.
This separate Pi also has the access point for wifi and the MQTT server, so it’s as directly connected to the ESPs as wifi can be. For the most important functions (main power, engine, sonar) I even have a Phidgets physical board that is connected to the main relays so that if the ESP fails, I won’t loose power. Yeah, I’m a bit extreme when it comes to that, 99 % stability is no stability.