Adding MQTT Temperature Sensor

Background: I have several temperature sensors that log to a server via HTML. I would like to integrate this data with home assistant. The most straightforward option seems to be to use MQTT but I'm having trouble tying all the documentation together. So far, what I have been able to find is that I need to

  • Add an MQTT broker to home assistant (or use external but not my intent).
  • Have my logging server make MQTT pubs to the broker with the sensor temperature
  • Edit configuration.yaml and add an mqtt section.

That's when thing start to get murky. There seems to be an assumption in the documentation that I have something setup which is not there by default. I'm thinking it's probably the MQTT integration. I tried adding it but then I get a popup with options that I'm not completely understanding.

Not wanting to leave badly configured poops all over my server, I'm reluctant to make a guess at this stage. Is the first option just meaning connecting to the local broker? (If so, the wording is a bit confusing vs the preceding text).

Can someone point my in the right direction? Even some hold-your-hand style documentation or a video of someone going through the full process would help.

It means that you want to connect to the Mosquitto MQTT broker add-on (now called app) specifically. Not just any "local broker".

You have not actually told us which broker you are using so it is difficult to tell you which option to choose.

I intend to use the Home Assistant app. First bullet point but I admit I wasn't 100% clear. I thought that might be what it meant but "Choose how you want to connect to the MQTT broker" is a bit badly worded in that case. But yes, first option then.

Edit: So the question becomes, is adding MQTT as an integration going to be the way I need to go to have the modifications I made to configuration.yaml show up as an actual thing (In this case, a temperature sensor)?

Step back a little further before you go the MQTT route. What make and model are your sensors? What server are they connecting to?
Maybe you don't need MQTT at all. Maybe you do (it is quite robust and widely deployed), but we are guessing at this stage.
It seems you already have the required data stored on a server. Maybe just access that rather than re-invent the wheel?

The sensors are a) ones I created myself based on ESP01s and also b) A weather station I am receiving using RTL433.

The sensors talk directly to an Apache web server. The weather station data talks to the same webpage via a script that processes the RTL433 output. The web server then provides graphs for display on a modded Kindle.

I still want to keep the stuff I'm doing with the web server and the kindle so it seemed like the most straightforward option was the MQTT server. In addition, I have a bunch of Tasmota flashed devices I wish to integrate in (my primary reason for finally getting to installing Home Assistant) so MQTT was going to be a thing anyway.

Having access to your sensor source code gives you great flexibility.

Just install the MQTT that comes with HomeAssistant (follow the vendor documentation steps is recommended) and add MQTT code to your sensors to send the data via suitably formatted packets inside the software loop that they run. MQTT is a lightweight protocol and you should have enough space to run the added code.
The data should be automatically recognised and available for automation in HomeAssistant. You may find your other server functionality may become redundant, and you can explore ESPHome or Tasmota as your firmware base to drive the sensors and MQTT transmission.
Your Kindle can be probably redeployed to display a HomeAssistant dashboard with similar graphs to those you are used to on the Apache server

Yep. Those are the easy part. It's having the device show up that's the trick. As mentioned, the documentation I found suggested adding to the configuration.yaml but I think there has to be more. I guess I'll prod at it some over the weekend.

But here's an example of the issue I'm having. This page

Talks about the mqtt sensor integration. But when I go to add an integration and search for mqtt, I get the following:

None of which mention an mqtt sensor. Undoubtedly this is me just not grokking the HA way of doing things yet but I'm trying to hit the learning curve pretty hard.

You also add the MQTT code at the sending end, at the sensor that defines the sensor attributes. HomeAssistant gets the incoming packets and adds the devices automagically, based on the MQTT topic, etc you have carefully defined.

Post your existing working source code (suitably formatted with </> for forum readability) for the ESP01 and other sensor and maybe we can make suggestions where to go from there.

The MQTT documentation for Tasmota may give you some added pointers as well as the HomeAssistant MQTT section under Temperature and humidity sensors (your eyes probably glazed over by the time you got so far down that page near the very bottom, and you may have missed the linked sample code). Read both and a pattern will emerge on what is needed and what is optional. For experimentation, try installing Tasmota on your ESP01 - you can always revert to the existing code when you have finished - and see what, and how, it works. Use the extra MQTT Explorer app on the HomeAssistant server to check the generated MQTT traffic and gain an in-depth understanding of what is happening behind the scenes.

Well, I see the sensors I defined in configuration.yaml in the list of entities but I have an alert telling me that mqtt is configured incorrectly (without telling me how, unfortunately). I need to get some more ducks in a row before I ask more questions though. Plus it's late and I need sleep.

Just FWIW, the Tasmotas are various switches rather than sensors. I'll check out that page though.

Enjoy your rest and a fresh day can bring enlightenment.

Tasmota MQTT WebUI configuration page will be interesting for you.

I use Tasmota for both controlling switches and temperature sensing with no issues whatsoever once I understood the basics for configuration.

Have a play, see the incoming packets using MQTT Explorer, fix the parameters, and watch it spring to life as HomeAssistant AutoDiscovery kicks in.