Wichtige Info

Die Inhalte, die du hier siehst stelle ich dir ohne Werbeanzeigen und ohne Tracking deiner Daten zur Verfügung. Trotzdem muss ich die Server bezahlen sowie Zeit in Recherche, Umsetzung sowie Mail Support stecken.
Um dies leisten zu können, verlinke ich in einigen Artikeln auf die Plattform Amazon. Alle diese Links nennen sich Afiliate Links. Wenn du dir mit diesem Link etwas kaufst, dann erhalte ich eine kleine Provision. Dies ändert jedoch NICHT den Preis, den du bezahlst!
Falls du mich also unterstützen möchtest, kannst du auf den Link zum Produkt klicken und hilfst mir dabei, dieses Hobby weiter zu betreiben.
Da ich Keine Werbung schalte und keine Spenden sammle, ist dies die einzige Möglichkeit, meine Systeme und mich zu finanzieren. Ich hoffe du kannst das verstehen :)



Homeassistant custom MQTT sensors easy import


Introduction:

To my current meter with MODBUS RS485 output into my Homeassistant to be able to integrate, after some considerations, Disable integration via MQTT.
The following short contribution I exemplarily show how to use in Homeassistant MQTT sensors can integrate. The Automatic Discovery function of Homeassistant I do not use it yet, a corresponding contribution will be I'll be back.

Preparations

At first, it must of course be ensured that the data on the MQTT Brokers are available, so it was first checked that the ESP8266 is connected to my home broker.

In Homeassistant, the MQTT Addon must also be installed and be configured. Since I do not abuse this blog as a waste mine I don't want to explain how this addon will be installed here as this is explained by Google

– In principle, the Homeassistant Doku explains the fun very well. https://www.home-assistant.io/integrations/mqtt/

Customize the config.yaml

Once Homeassistant and Broker are ready, we can get to the Config file and edit the config.yaml.
If not yet we add the point “sensor” and then make the following:

sensor:
  - platform: mqtt
    name: "mainEnergyMeterTotalConsumptionForwardKwh" #Name im frontend
    unique_id: sensor.mainenergymeter_total_forward_consumption_kwh_new #unique ID um Einstellungen im Frontend anpassen zu können.
    state_topic: mainPowerMeter/forwardenergy/counted/total #Broker Path um die Daten zu Empfangen
    unit_of_measurement: "kWh" #Zahleneinheit - in meinem Fall (Stromzaehler) kWh.

Finally, Homeassistant must be restarted (Developer Tools -> YAML -> Check Configuration -> (If Config correct) -> Restart

The sensor can then be found under Settings -> Devices -> Entities.


Back…