{"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-09-09T13:24:05","modified_gmt":"2026-09-09T11:24:05","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>A device that announces itself over MQTT does so with a single message. It lands on a topic Home Assistant is already listening to, it carries JSON, and it has to be retained &#8211; otherwise it exists only until the next restart of either side.<\/p>\n<p>Creating an entity that way is a matter of six lines. Getting that entity accepted as an energy source is a matter of three more, and those three are where the work actually sits: each of them is silently ignored when it is wrong, and the symptom is always the same empty dropdown.<\/p>\n<figure class=\"lw-diagram\">\n<img src=\"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/diagrams\/discovery-nachricht-en.png\" width=\"1120\" height=\"580\" decoding=\"async\" loading=\"lazy\"\n     alt=\"A discovery payload on the left with three highlighted lines, and on the right three conditions that all have to hold before the entity can be selected in the Energy dashboard\"><figcaption>The entity appears as soon as the payload is valid JSON. The three highlighted fields decide something else: whether it can also be picked as an energy source.<\/figcaption><\/figure>\n<h2>The Topic Decides Where the Entity Appears<\/h2>\n<p>Discovery works over a topic pattern rather than a registration call. Home Assistant subscribes to a prefix, and everything published beneath it in the right shape becomes an entity.<\/p>\n<pre class=\"wp-block-kevinbatdorf-code-block-pro\"><code>homeassistant\/sensor\/kellerzaehler\/energie\/config\n      \u2502          \u2502         \u2502           \u2502\n   prefix     component  node_id    object_id<\/code><\/pre>\n<p>The prefix is <code>homeassistant<\/code> unless it was changed in the MQTT integration. The component decides the entity type and has to match what the payload describes &#8211; a <code>sensor<\/code> for a reading, a <code>binary_sensor<\/code> for a yes-or-no state, a <code>switch<\/code> for something that can be commanded.<\/p>\n<p>Node ID and object ID are free text and serve only to keep the topic unique. They are not the entity ID: that one is built from the name later, and changing the topic afterwards creates a second entity rather than renaming the first.<\/p>\n<h2>The Smallest Payload That Actually Works<\/h2>\n<p>Four keys are enough for an entity to exist. A name, the topic the readings arrive on, a unit, and an identifier that stays stable across restarts.<\/p>\n<pre class=\"wp-block-kevinbatdorf-code-block-pro\"><code>{\n  \"name\": \"Cellar meter\",\n  \"state_topic\": \"haus\/keller\/zaehler\",\n  \"unit_of_measurement\": \"kWh\",\n  \"unique_id\": \"kellerzaehler_energie\"\n}<\/code><\/pre>\n<p>Of those four, <code>unique_id<\/code> is the one worth insisting on. Without it the entity shows up but cannot be renamed, cannot be assigned to an area, and cannot be selected in the Energy dashboard at all. It has to be unique across the whole installation, which is why the topic segments make a good basis for it.<\/p>\n<p>A <code>device<\/code> block is optional and pays for itself immediately: entities that share the same identifier are grouped under one device, and one device with eight readings is far easier to live with than eight loose entities.<\/p>\n<pre class=\"wp-block-kevinbatdorf-code-block-pro\"><code>  \"device\": {\n    \"identifiers\": [\"kellerzaehler\"],\n    \"name\": \"Cellar meter\",\n    \"manufacturer\": \"Eastron\",\n    \"model\": \"SDM630\"\n  }<\/code><\/pre>\n<h2>The Three Fields the Energy Dashboard Reads<\/h2>\n<p>An entity with a number in it is still not an energy source. Three fields have to agree before it turns up in the selection list, and all three describe something different.<\/p>\n<table style=\"width:100%;border-collapse:collapse;table-layout:auto;\">\n<thead>\n<tr>\n<th style=\"white-space:nowrap;vertical-align:top;\">Field<\/th>\n<th style=\"white-space:nowrap;vertical-align:top;\">Required value<\/th>\n<th style=\"vertical-align:top;\">What it says<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"white-space:nowrap;vertical-align:top;\">device_class<\/td>\n<td style=\"white-space:nowrap;vertical-align:top;\">energy<\/td>\n<td>The number is an amount of energy, not a power<\/td>\n<\/tr>\n<tr>\n<td style=\"white-space:nowrap;vertical-align:top;\">unit_of_measurement<\/td>\n<td style=\"white-space:nowrap;vertical-align:top;\">Wh, kWh, MJ or GJ<\/td>\n<td>The unit that amount is counted in<\/td>\n<\/tr>\n<tr>\n<td style=\"white-space:nowrap;vertical-align:top;\">state_class<\/td>\n<td style=\"white-space:nowrap;vertical-align:top;\">total_increasing<\/td>\n<td>The value only ever counts upwards<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The most frequent mismatch is between the first two. A meter reporting watts is a power sensor: <code>device_class<\/code> power, <code>state_class<\/code> measurement, unit W. That sensor is useful and correct, and it will never appear as an energy source, because power is not energy. What the Energy dashboard wants is the counter that adds up.<\/p>\n<p>The third field is the one that decides how a meter reset is handled. With <code>total_increasing<\/code>, a value that suddenly drops is read as a new counting cycle rather than as negative consumption, and the statistics carry on. With <code>total<\/code>, the same drop needs a <code>last_reset<\/code> timestamp to be interpreted, and without it the hour in question becomes a spike. For a physical meter that runs forwards and occasionally starts over, <code>total_increasing<\/code> is the honest choice.<\/p>\n<h2>Publishing It by Hand<\/h2>\n<p>Nothing about this needs a device. A single command creates the entity, and the same command with different content updates it.<\/p>\n<pre class=\"wp-block-kevinbatdorf-code-block-pro\"><code>mosquitto_pub -h 192.168.1.10 -u ha -P geheim -r \\\n  -t \"homeassistant\/sensor\/kellerzaehler\/energie\/config\" \\\n  -m '{\n    \"name\": \"Cellar meter\",\n    \"state_topic\": \"haus\/keller\/zaehler\",\n    \"unit_of_measurement\": \"kWh\",\n    \"device_class\": \"energy\",\n    \"state_class\": \"total_increasing\",\n    \"unique_id\": \"kellerzaehler_energie\",\n    \"device\": { \"identifiers\": [\"kellerzaehler\"], \"name\": \"Cellar meter\" }\n  }'\n\nmosquitto_pub -h 192.168.1.10 -u ha -P geheim -r \\\n  -t \"haus\/keller\/zaehler\" -m \"18234.7\"<\/code><\/pre>\n<p>The <code>-r<\/code> flag is the part that gets forgotten, and it belongs on both messages for different reasons. On the config topic it means the description survives a Home Assistant restart, which would otherwise wipe the entity until the device happens to announce itself again. On the state topic it means the entity has a value immediately after a restart instead of sitting unavailable until the next reading arrives.<\/p>\n<p>One caveat about payload size: firmware that speaks discovery usually sends abbreviated keys &#8211; <code>stat_t<\/code>, <code>dev_cla<\/code>, <code>stat_cla<\/code>, <code>unit_of_meas<\/code>, <code>uniq_id<\/code>, <code>dev<\/code>. Both spellings work and can even be mixed. Handwritten payloads are easier to read in full form.<\/p>\n<h2>When the Entity Appears and Stays Empty<\/h2>\n<p>An entity that exists but shows nothing is almost always a topic mismatch: the <code>state_topic<\/code> in the payload and the topic the value is published on differ by a character. Subscribing to the wildcard shows both sides at once.<\/p>\n<pre class=\"wp-block-kevinbatdorf-code-block-pro\"><code>mosquitto_sub -h 192.168.1.10 -u ha -P geheim -v -t \"haus\/#\"<\/code><\/pre>\n<p>If the value arrives but is nested inside a larger JSON message, a <code>value_template<\/code> picks it out &#8211; <code>\"value_template\": \"{{ value_json.total_kwh }}\"<\/code>. Without it the entity receives the whole object and reports it as unknown.<\/p>\n<p>And a warning about a field that looks helpful: <code>expire_after<\/code> marks the entity unavailable when no update arrives within the given number of seconds. On a switch that is useful. On an energy counter it tears holes into the long-term statistics, because every gap ends a counting run. A meter that reports every fifteen minutes is better off without it.<\/p>\n<p>Patience helps with the last step. Long-term statistics are computed in five-minute intervals and the Energy dashboard aggregates by the hour, so a freshly created sensor stays blank until the first full hour has passed. That is not a fault, and re-publishing the payload does not speed it up.<\/p>\n<h2>Removing a Device Without Leaving a Ghost<\/h2>\n<p>Deleting the entity in the interface removes it until the next restart, at which point the retained config message recreates it. The removal has to happen where the creation happened.<\/p>\n<pre class=\"wp-block-kevinbatdorf-code-block-pro\"><code>mosquitto_pub -h 192.168.1.10 -u ha -P geheim -r \\\n  -t \"homeassistant\/sensor\/kellerzaehler\/energie\/config\" -m \"\"<\/code><\/pre>\n<p>An empty retained payload on the config topic deletes both the entity and the stored message. The state topic keeps its own retained value and is worth clearing the same way, otherwise the next device to use that topic inherits a reading that belongs to something else.<\/p>\n<div class=\"lw-quellen\">\n<h2>Sources<\/h2>\n<ul>\n<li><a href=\"https:\/\/mqtt.org\/mqtt-specification\/\" target=\"_blank\" rel=\"noopener noreferrer\">MQTT specification<\/a><\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>One retained JSON message on the right topic creates an entity in Home Assistant. Three fields inside it decide whether that entity can also be picked as an energy source &#8211; and none of the three reports an error when it is wrong.<\/p>\n","protected":false},"author":1,"featured_media":13213,"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 - Blog<\/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 - Blog\" \/>\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=\"og:image\" content=\"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/08\/hero-12956-tutorial-publishing-an-mqtt-discovery-pa.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=\"luky\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"luky\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 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\":\"luky\",\"@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\",\"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\":985,\"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\\\/08\\\/hero-12956-tutorial-publishing-an-mqtt-discovery-pa.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 - Blog\",\"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\\\/08\\\/hero-12956-tutorial-publishing-an-mqtt-discovery-pa.png\",\"datePublished\":\"2026-09-10T05:35:00+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\\\/08\\\/hero-12956-tutorial-publishing-an-mqtt-discovery-pa.png\",\"contentUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/08\\\/hero-12956-tutorial-publishing-an-mqtt-discovery-pa.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\":\"luky\",\"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\":\"luky\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\"},\"sameAs\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\"],\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/author\\\/luky\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Tutorial: Publishing an MQTT Discovery Payload That Reaches the Energy Dashboard - Lukas Wojcik - Blog","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 - Blog","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","og_image":[{"width":1200,"height":630,"url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/08\/hero-12956-tutorial-publishing-an-mqtt-discovery-pa.png","type":"image\/png"}],"author":"luky","twitter_card":"summary_large_image","twitter_misc":{"Written by":"luky","Est. reading time":"6 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":"luky","@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","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":985,"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\/08\/hero-12956-tutorial-publishing-an-mqtt-discovery-pa.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 - Blog","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\/08\/hero-12956-tutorial-publishing-an-mqtt-discovery-pa.png","datePublished":"2026-09-10T05:35:00+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\/08\/hero-12956-tutorial-publishing-an-mqtt-discovery-pa.png","contentUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/08\/hero-12956-tutorial-publishing-an-mqtt-discovery-pa.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":"luky","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":"luky"},"logo":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg"},"sameAs":["https:\/\/www.lukaswojcik.com\/blog"],"url":"https:\/\/www.lukaswojcik.com\/blog\/author\/luky\/"}]}},"_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":1,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/12956\/revisions"}],"predecessor-version":[{"id":17305,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/12956\/revisions\/17305"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/media\/13213"}],"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}]}}