{"id":12956,"date":"2026-09-10T07:35:00","date_gmt":"2026-09-10T05:35:00","guid":{"rendered":"https:\/\/www.lukaswojcik.com\/blog\/?p=12956"},"modified":"2026-10-24T06:15:04","modified_gmt":"2026-10-24T04:15:04","slug":"tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard","status":"publish","type":"post","link":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/tutorials-en-smart-home\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\/","title":{"rendered":"Tutorial: Publishing an MQTT Discovery Payload That Reaches the Energy Dashboard"},"content":{"rendered":"<p>MQTT discovery describes a sensor to Home Assistant. A separate topic carries its readings. The Energy dashboard then uses suitable sensor data and statistics. These are three different stages: valid JSON alone does not guarantee a working entity or an energy graph.<\/p>\n<h2>1. Define the measurement first<\/h2>\n<p>The example represents cumulative imported electricity in kWh. The counter normally increases but may restart from zero, so <code>total_increasing<\/code> fits this example. A lifetime counter that never resets can use <code>total<\/code> without <code>last_reset<\/code>. A net counter that rises and falls needs different treatment; <code>total_increasing<\/code> would misinterpret genuine decreases.<\/p>\n<p>Power in W describes the current rate, while energy in kWh describes an accumulated amount. Current Home Assistant versions also accept suitable power sensors in the dashboard\u2019s power fields: <code>device_class: power<\/code> with <code>state_class: measurement<\/code>. A W reading cannot simply be relabelled kWh.<\/p>\n<figure class=\"lw-diagram\"><img decoding=\"async\" src=\"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/diagrams\/dia-12956-mqtt-energy-20261024-en.png\" alt=\"Four checks from discovery to the Energy dashboard\" loading=\"lazy\" width=\"1120\" height=\"580\"><figcaption>Four checks from discovery to the Energy dashboard<\/figcaption><\/figure>\n<h2>2. Publish a valid sensor configuration<\/h2>\n<p>Prerequisites are a reachable broker, a configured Home Assistant MQTT integration and enabled discovery with the expected prefix. This component-discovery example uses <code>homeassistant\/sensor\/example_meter_import\/config<\/code>. Topic identifiers accept letters, digits, underscores and hyphens; they are not unrestricted prose.<\/p>\n<p>The following file, <code>energy-discovery.json<\/code>, describes an invented meter. The stable unique ID should be unique within the installation. The display name can change independently.<\/p>\n<pre><code>{\n  &quot;name&quot;: &quot;Imported energy&quot;,\n  &quot;state_topic&quot;: &quot;example\/meter\/import_kwh&quot;,\n  &quot;unique_id&quot;: &quot;example_meter_import&quot;,\n  &quot;device_class&quot;: &quot;energy&quot;,\n  &quot;unit_of_measurement&quot;: &quot;kWh&quot;,\n  &quot;state_class&quot;: &quot;total_increasing&quot;,\n  &quot;expire_after&quot;: 900,\n  &quot;device&quot;: {\n    &quot;identifiers&quot;: [\n      &quot;example_meter&quot;\n    ],\n    &quot;name&quot;: &quot;Example meter&quot;\n  }\n}<\/code><\/pre>\n<p><code>state_topic<\/code> is required for an MQTT sensor. Other fields depend on the intended behavior. A unique ID enables registry-based management and is needed for the device association shown here; it is not a universal Energy dashboard requirement. Device discovery using a single <code>device<\/code> payload has additional mandatory fields and is a different format.<\/p>\n<h2>3. Keep configuration available and readings fresh<\/h2>\n<p>The example retains the configuration at the broker. An alternative is for the publisher to resend discovery when Home Assistant announces its birth, normally <code>online<\/code> on <code>homeassistant\/status<\/code>. Fresh states must also follow discovery. Retain is therefore a useful delivery option, not a compulsory field or a guarantee of disk persistence across broker failures.<\/p>\n<p>The commands below require Mosquitto clients 2.1 or newer because they use <code>-o<\/code>. <code>mqtt-client.conf<\/code> contains the actual broker address, TLS settings and authentication options, one option per line. Restrictive file permissions protect its credentials; passwords are not placed in the command line. The default client configuration is an alternative on older versions. The file must not contain a retain option for state publications.<\/p>\n<pre><code>mosquitto_pub -o .\/mqtt-client.conf -q 1 -r \\\n  -t homeassistant\/sensor\/example_meter_import\/config \\\n  -f energy-discovery.json\nmosquitto_pub -o .\/mqtt-client.conf -q 1 \\\n  -t example\/meter\/import_kwh -m &#x27;1234.500&#x27;\nmosquitto_pub -o .\/mqtt-client.conf -q 1 \\\n  -t example\/meter\/import_kwh -m &#x27;1234.625&#x27;<\/code><\/pre>\n<p>The configuration command runs first. The entity and its state subscription must be ready before the two reading commands run; a successful publish does not prove Home Assistant has processed discovery. An existing retained value on the state topic must also be cleared during a migration. Omitting Retain from later messages does not erase that older stored value.<\/p>\n<p>The two sample readings differ by 0.125 kWh. This example must use an isolated test sensor; invented readings must not enter a real meter\u2019s history. The publisher should report regularly, comfortably within the configured 900-second expiry period.<\/p>\n<p>State messages deliberately omit <code>-r<\/code>. With <code>expire_after<\/code>, a retained old state could be replayed after a reload and appear fresh again. Device availability using birth\/will messages can additionally report connection loss. It does not prove that the physical measurement itself is current.<\/p>\n<h2>4. Check each stage separately<\/h2>\n<ul>\n<li>Discovery: subscribe to the exact configuration topic and inspect Home Assistant\u2019s MQTT errors. A syntactically valid JSON document can still violate the sensor schema.<\/li>\n<li>Reading: check <code>example\/meter\/import_kwh<\/code> for a numeric payload with a decimal point and no unit suffix. A subscription to that branch does not include <code>homeassistant\/...<\/code>.<\/li>\n<li>Statistics: confirm the energy class, kWh unit, appropriate total class and active Recorder. Statistics errors and unavailable readings need resolving before interpreting a graph.<\/li>\n<li>Dashboard: select the sensor in the imported-energy field. Short-term statistics are compiled every five minutes, long-term statistics hourly. The first reading establishes a baseline; it is not consumption since installation. A full graph is not guaranteed immediately after discovery.<\/li>\n<\/ul>\n<p>Unexpected decreases require investigating the counter and its class. A reset and a genuine negative flow are different events. Adding counters that reset at different moments can create artificial totals; separate dashboard sources avoid that particular summation problem.<\/p>\n<div class=\"lw-faq\">\n<h2>Questions and answers<\/h2>\n<h3>How is a discovered sensor removed?<\/h3>\n<p>An empty retained payload on this exact discovery topic removes its configuration. That does not mean historical statistics are erased. Cleanup should target only the intended topic and entity.<\/p>\n<pre><code>mosquitto_pub -o .\/mqtt-client.conf -q 1 -r \\\n  -t homeassistant\/sensor\/example_meter_import\/config -n<\/code><\/pre>\n<h3>Can one net counter provide import and export totals?<\/h3>\n<p>Not from cumulative net readings alone. Separate import and export registers preserve both flows; netting loses that information. Available registers depend on the meter. Integrating sufficiently frequent power samples is another approach, with accuracy depending on sampling and the numerical method.<\/p>\n<h3>Which permissions are needed?<\/h3>\n<p>The example publisher needs write access to its configuration and state topics. Home Assistant needs matching subscriptions. Birth-triggered discovery and availability require their additional topics. This is a sensor example, not a complete ACL policy for actuators or an entire installation.<\/p>\n<\/div>\n<h2>Sources<\/h2>\n<ul>\n<li><a href=\"https:\/\/www.home-assistant.io\/integrations\/mqtt\/\">MQTT discovery<\/a><\/li>\n<li><a href=\"https:\/\/www.home-assistant.io\/integrations\/sensor.mqtt\/\">MQTT sensor<\/a><\/li>\n<li><a href=\"https:\/\/www.home-assistant.io\/docs\/energy\/faq\/\">Energy FAQ<\/a><\/li>\n<li><a href=\"https:\/\/www.home-assistant.io\/docs\/configuration\/long-term-statistics\/\">Long-term statistics<\/a><\/li>\n<li><a href=\"https:\/\/contributors.home-assistant.io\/core\/entities\/sensor\/\">Sensor state classes<\/a><\/li>\n<li><a href=\"https:\/\/mosquitto.org\/man\/mosquitto_pub-1.html\">Mosquitto publisher<\/a><\/li>\n<li><a href=\"https:\/\/mosquitto.org\/man\/mosquitto-conf-5.html\">Mosquitto broker persistence<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>MQTT discovery, fresh readings and statistics each need separate checks. A complete sensor example explains energy versus power, counter classes, Retain and expiry before selecting the source in Home Assistant\u2019s Energy dashboard.<\/p>\n","protected":false},"author":1,"featured_media":24106,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[92624],"tags":[91365,91374,91626,91219],"class_list":["post-12956","post","type-post","status-publish","format-standard","hentry","category-tutorials-en-smart-home","tag-home-assistant","tag-iot","tag-smart-home-de","tag-tutorial"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Tutorial: Publishing an MQTT Discovery Payload That Reaches the Energy Dashboard | Lukas Wojcik<\/title>\n<meta name=\"description\" content=\"Building an MQTT discovery message step by step: the topic, the smallest working payload, and the three fields the Energy dashboard actually reads.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/tutorials-en-smart-home\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Tutorial: Publishing an MQTT Discovery Payload That Reaches the Energy Dashboard | Lukas Wojcik\" \/>\n<meta property=\"og:description\" content=\"Building an MQTT discovery message step by step: the topic, the smallest working payload, and the three fields the Energy dashboard actually reads.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/tutorials-en-smart-home\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\/\" \/>\n<meta property=\"og:site_name\" content=\"Lukas Wojcik - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-10T05:35:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-10-24T04:15:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/10\/hero-12956-mqtt-energy-20261024-dark.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Lukas Wojcik\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Lukas Wojcik\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/tutorials-en-smart-home\\\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/tutorials-en-smart-home\\\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\\\/\"},\"author\":{\"name\":\"Lukas Wojcik\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"headline\":\"Tutorial: Publishing an MQTT Discovery Payload That Reaches the Energy Dashboard\",\"datePublished\":\"2026-09-10T05:35:00+00:00\",\"dateModified\":\"2026-10-24T04:15:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/tutorials-en-smart-home\\\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\\\/\"},\"wordCount\":817,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"image\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/tutorials-en-smart-home\\\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/hero-12956-mqtt-energy-20261024-dark.png\",\"keywords\":[\"Home Assistant\",\"IoT\",\"Smart Home\",\"Tutorial\"],\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/tutorials-en-smart-home\\\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/tutorials-en-smart-home\\\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\\\/\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/tutorials-en-smart-home\\\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\\\/\",\"name\":\"Tutorial: Publishing an MQTT Discovery Payload That Reaches the Energy Dashboard | Lukas Wojcik\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/tutorials-en-smart-home\\\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/tutorials-en-smart-home\\\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/hero-12956-mqtt-energy-20261024-dark.png\",\"datePublished\":\"2026-09-10T05:35:00+00:00\",\"dateModified\":\"2026-10-24T04:15:04+00:00\",\"description\":\"Building an MQTT discovery message step by step: the topic, the smallest working payload, and the three fields the Energy dashboard actually reads.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/tutorials-en-smart-home\\\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/tutorials-en-smart-home\\\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/tutorials-en-smart-home\\\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/hero-12956-mqtt-energy-20261024-dark.png\",\"contentUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/hero-12956-mqtt-energy-20261024-dark.png\",\"width\":1200,\"height\":630,\"caption\":\"Tutorial: Publishing an MQTT Discovery Payload That Reaches the Energy Dashboard\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/tutorials-en-smart-home\\\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tutorial: Publishing an MQTT Discovery Payload That Reaches the Energy Dashboard\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/\",\"name\":\"Lukas Wojcik - Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\",\"name\":\"Lukas Wojcik\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"contentUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"width\":424,\"height\":636,\"caption\":\"Lukas Wojcik\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\"},\"sameAs\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Tutorial: Publishing an MQTT Discovery Payload That Reaches the Energy Dashboard | Lukas Wojcik","description":"Building an MQTT discovery message step by step: the topic, the smallest working payload, and the three fields the Energy dashboard actually reads.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/tutorials-en-smart-home\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\/","og_locale":"en_US","og_type":"article","og_title":"Tutorial: Publishing an MQTT Discovery Payload That Reaches the Energy Dashboard | Lukas Wojcik","og_description":"Building an MQTT discovery message step by step: the topic, the smallest working payload, and the three fields the Energy dashboard actually reads.","og_url":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/tutorials-en-smart-home\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\/","og_site_name":"Lukas Wojcik - Blog","article_published_time":"2026-09-10T05:35:00+00:00","article_modified_time":"2026-10-24T04:15:04+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/10\/hero-12956-mqtt-energy-20261024-dark.png","type":"image\/png"}],"author":"Lukas Wojcik","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Lukas Wojcik","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/tutorials-en-smart-home\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\/#article","isPartOf":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/tutorials-en-smart-home\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\/"},"author":{"name":"Lukas Wojcik","@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"headline":"Tutorial: Publishing an MQTT Discovery Payload That Reaches the Energy Dashboard","datePublished":"2026-09-10T05:35:00+00:00","dateModified":"2026-10-24T04:15:04+00:00","mainEntityOfPage":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/tutorials-en-smart-home\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\/"},"wordCount":817,"commentCount":0,"publisher":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"image":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/tutorials-en-smart-home\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\/#primaryimage"},"thumbnailUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/10\/hero-12956-mqtt-energy-20261024-dark.png","keywords":["Home Assistant","IoT","Smart Home","Tutorial"],"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/tutorials-en-smart-home\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/tutorials-en-smart-home\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\/","url":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/tutorials-en-smart-home\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\/","name":"Tutorial: Publishing an MQTT Discovery Payload That Reaches the Energy Dashboard | Lukas Wojcik","isPartOf":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/tutorials-en-smart-home\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\/#primaryimage"},"image":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/tutorials-en-smart-home\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\/#primaryimage"},"thumbnailUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/10\/hero-12956-mqtt-energy-20261024-dark.png","datePublished":"2026-09-10T05:35:00+00:00","dateModified":"2026-10-24T04:15:04+00:00","description":"Building an MQTT discovery message step by step: the topic, the smallest working payload, and the three fields the Energy dashboard actually reads.","breadcrumb":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/tutorials-en-smart-home\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/tutorials-en-smart-home\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/tutorials-en-smart-home\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\/#primaryimage","url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/10\/hero-12956-mqtt-energy-20261024-dark.png","contentUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/10\/hero-12956-mqtt-energy-20261024-dark.png","width":1200,"height":630,"caption":"Tutorial: Publishing an MQTT Discovery Payload That Reaches the Energy Dashboard"},{"@type":"BreadcrumbList","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/tutorials-en-smart-home\/tutorial-publishing-an-mqtt-discovery-payload-that-reaches-the-energy-dashboard\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.lukaswojcik.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Tutorial: Publishing an MQTT Discovery Payload That Reaches the Energy Dashboard"}]},{"@type":"WebSite","@id":"https:\/\/www.lukaswojcik.com\/blog\/#website","url":"https:\/\/www.lukaswojcik.com\/blog\/","name":"Lukas Wojcik - Blog","description":"","publisher":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.lukaswojcik.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9","name":"Lukas Wojcik","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","contentUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","width":424,"height":636,"caption":"Lukas Wojcik"},"logo":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg"},"sameAs":["https:\/\/www.lukaswojcik.com\/blog"]}]}},"_links":{"self":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/12956","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/comments?post=12956"}],"version-history":[{"count":4,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/12956\/revisions"}],"predecessor-version":[{"id":24112,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/12956\/revisions\/24112"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/media\/24106"}],"wp:attachment":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/media?parent=12956"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/categories?post=12956"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/tags?post=12956"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}