{"id":10374,"date":"2026-09-09T07:20:00","date_gmt":"2026-09-09T05:20:00","guid":{"rendered":"https:\/\/www.lukaswojcik.com\/blog\/?p=10374"},"modified":"2026-10-24T04:25:34","modified_gmt":"2026-10-24T02:25:34","slug":"home-assistant-energy-dashboard-device-class-unit-and-state-class","status":"publish","type":"post","link":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/home-assistant-energy-dashboard-device-class-unit-and-state-class\/","title":{"rendered":"Home Assistant Energy Dashboard: Device Class, Unit and State Class in the Discovery Payload"},"content":{"rendered":"<p>An MQTT sensor can show changing values in history while remaining unavailable in a particular Energy dashboard field. Device class, unit and state class must fit the measurement, but discovery validity, recording and statistics errors matter too. These fields describe the data; changing a label does not convert watts into kilowatt-hours.<\/p>\n<figure class=\"lw-diagram\"><img decoding=\"async\" src=\"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/diagrams\/dia-10374-energy-20261024.png\" alt=\"Energy metadata, valid readings and freshness must agree.\"\/><figcaption>Energy metadata, valid readings and freshness must agree.<\/figcaption><\/figure>\n<h2>Match the quantity to the dashboard field<\/h2>\n<p>For an accumulated energy reading, use <code>device_class: energy<\/code>, a supported energy unit such as <code>kWh<\/code>, and an appropriate total state class. Unit spelling matters: <code>kwh<\/code> is not the standard <code>kWh<\/code> symbol. Supported units must also fit the selected dashboard field. Invalid combinations can produce logs or statistics errors; failure is not necessarily silent.<\/p>\n<p>Power is a rate in watts. Current Home Assistant versions provide separate power-measurement fields in the Energy dashboard, using <code>device_class: power<\/code> and <code>state_class: measurement<\/code>. Such a value is useful there, but is not an accumulated-energy counter. Changing W to kWh without integrating over time would falsify the measurement.<\/p>\n<h2>Choose the state class from reset behavior<\/h2>\n<ul>\n<li><code>measurement<\/code> records measurements such as power or temperature. It can generate long-term minimum, maximum and mean statistics; it does not produce an energy-counter sum.<\/li>\n<li><code>total<\/code> supports totals that rise or fall. A lifetime counter that never resets can use total without last_reset. For a total that resets at known boundaries, the integration must provide the appropriate reset information.<\/li>\n<li><code>total_increasing<\/code> fits a nonnegative counter that rises and can restart from zero. It does not require last_reset. A recognized downward reset starts another cycle; the first reading of the new cycle contributes from zero.<\/li>\n<\/ul>\n<p>The first observed reading is a baseline, not automatically the entire historical consumption. A sequence 1000, 1005, 0, 1006 can nevertheless add a false 1006 after the zero reset. Small decreases are not all treated as resets: current developer documentation describes a tolerance for drops below 10%. This is not a substitute for detecting stale or invalid readings.<\/p>\n<h2>A complete single-sensor discovery example<\/h2>\n<p>The following <code>sensor.json<\/code> describes a counter that really uses the total_increasing behavior. The state topic expects a numeric kWh payload such as <code>123.456<\/code>, without a unit suffix. The publisher must supply online\/offline availability messages and valid readings frequently enough for the illustrative 300-second expiry.<\/p>\n<pre><code>{\n  &quot;name&quot;: &quot;Energy&quot;,\n  &quot;unique_id&quot;: &quot;example_meter_energy&quot;,\n  &quot;state_topic&quot;: &quot;example\/meter\/energy&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;availability_topic&quot;: &quot;example\/meter\/status&quot;,\n  &quot;payload_available&quot;: &quot;online&quot;,\n  &quot;payload_not_available&quot;: &quot;offline&quot;,\n  &quot;expire_after&quot;: 300\n}<\/code><\/pre>\n<p>The commands below publish the configuration and, separately, remove that exact example configuration. BROKER is a placeholder; credentials, port and TLS settings must match the test broker. Removal is a distinct administrative operation, not the next step after every creation.<\/p>\n<pre><code>mosquitto_pub -h BROKER -r -t &quot;homeassistant\/sensor\/example_meter_energy\/config&quot; -f sensor.json\n\nmosquitto_pub -h BROKER -r -t &quot;homeassistant\/sensor\/example_meter_energy\/config&quot; -n<\/code><\/pre>\n<p>Single-component discovery follows <code>&lt;prefix&gt;\/&lt;component&gt;\/[&lt;node_id&gt;\/]&lt;object_id&gt;\/config<\/code>. The node segment is optional. Retained configuration can be replayed when Home Assistant subscribes again; publishers can instead resend discovery after Home Assistant&#8217;s birth message. Retaining discovery does not retain current sensor readings or prove that the device is online.<\/p>\n<p>A zero-length retained message clears this retained configuration. Permanent retirement also requires stopping a publisher from advertising it again; a device with other entities need not disappear. A stable unique_id supports registry identity and customization. It is mandatory for device-based discovery, but is not itself a universal energy-statistics prerequisite. Invalid required fields can reject configuration; only unknown keys are generally ignored.<\/p>\n<h2>Availability and freshness are separate checks<\/h2>\n<p>A last-will offline message helps detect a lost MQTT connection. It does not detect every frozen measurement while the publishing client remains connected. expire_after can expose missing updates, provided the normal publication interval is known. Repeating an old number as a new message can still defeat a message-age check; the producer should validate acquisition freshness.<\/p>\n<p>Retained state values require particular care: replay after a Home Assistant restart can make an expired reading appear fresh. The MQTT Sensor documentation recommends avoiding retained sensor-state payloads with expiry handling; Home Assistant can restore its state and remaining expiry itself. The discovery configuration can still be retained.<\/p>\n<h2>Check statistics before relying on the result<\/h2>\n<p>Inspect the entity&#8217;s actual attributes and value, then Settings \u2192 Tools \u2192 Statistics and the logs. Confirm that recording includes the sensor. Short-term statistics are compiled every five minutes and hourly aggregates form long-term statistics. Correcting discovery does not automatically reconstruct all missing past energy totals.<\/p>\n<p>The statistics tools can correct recorded anomalies. They cannot infer missing readings from a blank interval. Changes to cumulative sums can affect later offsets and adjacent differences, so review the surrounding timeline and preserve a backup before correction. A later cumulative reading can reveal the total increase across an outage without revealing its true hourly distribution.<\/p>\n<h2>Questions and answers<\/h2>\n<h3>Can power become an energy counter?<\/h3>\n<p>The Integral helper approximates energy from sampled power over time. For a source in W, prefix k and time unit h produce kWh. The left method can suit accurately reported step changes followed by stable plateaus; trapezoidal integration can suit smooth, frequently sampled signals. Neither method repairs missing measurements. A trustworthy hardware energy counter is preferable when available.<\/p>\n<h3>Should every zero be rejected?<\/h3>\n<p>No. Zero can be a valid new meter reading or reset. Communication failure should be represented as unavailable or unknown, not fabricated zero. Filtering must use device status, timestamps and plausible changes, with an explicit meter-replacement path. A blanket value-greater-than-zero template would also hide legitimate zeros and does not solve every stale-value problem.<\/p>\n<h2>Sources<\/h2>\n<ul>\n<li><a href=\"https:\/\/www.home-assistant.io\/docs\/\">Home Assistant: Documentation<\/a><\/li>\n<li><a href=\"https:\/\/www.home-assistant.io\/docs\/energy\/faq\/\">Home Assistant: Energy management FAQ<\/a><\/li>\n<li><a href=\"https:\/\/www.home-assistant.io\/integrations\/sensor\/\">Home Assistant: Sensor state classes<\/a><\/li>\n<li><a href=\"https:\/\/contributors.home-assistant.io\/core\/entities\/sensor\/\">Home Assistant: Sensor entity and total statistics<\/a><\/li>\n<li><a href=\"https:\/\/www.home-assistant.io\/integrations\/mqtt\/\">Home Assistant: MQTT discovery<\/a><\/li>\n<li><a href=\"https:\/\/www.home-assistant.io\/integrations\/sensor.mqtt\/\">Home Assistant: MQTT Sensor<\/a><\/li>\n<li><a href=\"https:\/\/www.home-assistant.io\/integrations\/integration\/\">Home Assistant: Integral helper<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Energy sensors need matching device class, unit and state class. Discovery, availability and recorder settings also matter; validation and statistics tools help diagnose missing or incorrect values.<\/p>\n","protected":false},"author":1,"featured_media":15161,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[91106,91626],"class_list":["post-10374","post","type-post","status-publish","format-standard","hentry","category-smart-home","tag-automation","tag-smart-home-de"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Home Assistant Energy Dashboard: Device Class, Unit and State Class in the Discovery Payload | Lukas Wojcik<\/title>\n<meta name=\"description\" content=\"device_class, unit_of_measurement and state_class in a Home Assistant discovery payload: which combinations are accepted, and why a rejected one fails silently.\" \/>\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\/home-assistant-energy-dashboard-device-class-unit-and-state-class\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Home Assistant Energy Dashboard: Device Class, Unit and State Class in the Discovery Payload | Lukas Wojcik\" \/>\n<meta property=\"og:description\" content=\"device_class, unit_of_measurement and state_class in a Home Assistant discovery payload: which combinations are accepted, and why a rejected one fails silently.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/home-assistant-energy-dashboard-device-class-unit-and-state-class\/\" \/>\n<meta property=\"og:site_name\" content=\"Lukas Wojcik - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-09T05:20:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-10-24T02:25:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/09\/hero-10374-why-a-sensor-never-reaches-the-energ-n.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\\\/home-assistant-energy-dashboard-device-class-unit-and-state-class\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/home-assistant-energy-dashboard-device-class-unit-and-state-class\\\/\"},\"author\":{\"name\":\"Lukas Wojcik\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"headline\":\"Home Assistant Energy Dashboard: Device Class, Unit and State Class in the Discovery Payload\",\"datePublished\":\"2026-09-09T05:20:00+00:00\",\"dateModified\":\"2026-10-24T02:25:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/home-assistant-energy-dashboard-device-class-unit-and-state-class\\\/\"},\"wordCount\":893,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"image\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/home-assistant-energy-dashboard-device-class-unit-and-state-class\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/hero-10374-why-a-sensor-never-reaches-the-energ-n.png\",\"keywords\":[\"Automation\",\"Smart Home\"],\"articleSection\":[\"Smart Home\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/home-assistant-energy-dashboard-device-class-unit-and-state-class\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/home-assistant-energy-dashboard-device-class-unit-and-state-class\\\/\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/home-assistant-energy-dashboard-device-class-unit-and-state-class\\\/\",\"name\":\"Home Assistant Energy Dashboard: Device Class, Unit and State Class in the Discovery Payload | Lukas Wojcik\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/home-assistant-energy-dashboard-device-class-unit-and-state-class\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/home-assistant-energy-dashboard-device-class-unit-and-state-class\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/hero-10374-why-a-sensor-never-reaches-the-energ-n.png\",\"datePublished\":\"2026-09-09T05:20:00+00:00\",\"dateModified\":\"2026-10-24T02:25:34+00:00\",\"description\":\"device_class, unit_of_measurement and state_class in a Home Assistant discovery payload: which combinations are accepted, and why a rejected one fails silently.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/home-assistant-energy-dashboard-device-class-unit-and-state-class\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/home-assistant-energy-dashboard-device-class-unit-and-state-class\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/home-assistant-energy-dashboard-device-class-unit-and-state-class\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/hero-10374-why-a-sensor-never-reaches-the-energ-n.png\",\"contentUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/hero-10374-why-a-sensor-never-reaches-the-energ-n.png\",\"width\":1200,\"height\":630,\"caption\":\"Home Assistant Energy Dashboard: Device Class, Unit and State Class in the Discovery Payload\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/smart-home\\\/home-assistant-energy-dashboard-device-class-unit-and-state-class\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Home Assistant Energy Dashboard: Device Class, Unit and State Class in the Discovery Payload\"}]},{\"@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":"Home Assistant Energy Dashboard: Device Class, Unit and State Class in the Discovery Payload | Lukas Wojcik","description":"device_class, unit_of_measurement and state_class in a Home Assistant discovery payload: which combinations are accepted, and why a rejected one fails silently.","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\/home-assistant-energy-dashboard-device-class-unit-and-state-class\/","og_locale":"en_US","og_type":"article","og_title":"Home Assistant Energy Dashboard: Device Class, Unit and State Class in the Discovery Payload | Lukas Wojcik","og_description":"device_class, unit_of_measurement and state_class in a Home Assistant discovery payload: which combinations are accepted, and why a rejected one fails silently.","og_url":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/home-assistant-energy-dashboard-device-class-unit-and-state-class\/","og_site_name":"Lukas Wojcik - Blog","article_published_time":"2026-09-09T05:20:00+00:00","article_modified_time":"2026-10-24T02:25:34+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/09\/hero-10374-why-a-sensor-never-reaches-the-energ-n.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\/home-assistant-energy-dashboard-device-class-unit-and-state-class\/#article","isPartOf":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/home-assistant-energy-dashboard-device-class-unit-and-state-class\/"},"author":{"name":"Lukas Wojcik","@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"headline":"Home Assistant Energy Dashboard: Device Class, Unit and State Class in the Discovery Payload","datePublished":"2026-09-09T05:20:00+00:00","dateModified":"2026-10-24T02:25:34+00:00","mainEntityOfPage":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/home-assistant-energy-dashboard-device-class-unit-and-state-class\/"},"wordCount":893,"commentCount":0,"publisher":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"image":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/home-assistant-energy-dashboard-device-class-unit-and-state-class\/#primaryimage"},"thumbnailUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/09\/hero-10374-why-a-sensor-never-reaches-the-energ-n.png","keywords":["Automation","Smart Home"],"articleSection":["Smart Home"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/home-assistant-energy-dashboard-device-class-unit-and-state-class\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/home-assistant-energy-dashboard-device-class-unit-and-state-class\/","url":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/home-assistant-energy-dashboard-device-class-unit-and-state-class\/","name":"Home Assistant Energy Dashboard: Device Class, Unit and State Class in the Discovery Payload | Lukas Wojcik","isPartOf":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/home-assistant-energy-dashboard-device-class-unit-and-state-class\/#primaryimage"},"image":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/home-assistant-energy-dashboard-device-class-unit-and-state-class\/#primaryimage"},"thumbnailUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/09\/hero-10374-why-a-sensor-never-reaches-the-energ-n.png","datePublished":"2026-09-09T05:20:00+00:00","dateModified":"2026-10-24T02:25:34+00:00","description":"device_class, unit_of_measurement and state_class in a Home Assistant discovery payload: which combinations are accepted, and why a rejected one fails silently.","breadcrumb":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/home-assistant-energy-dashboard-device-class-unit-and-state-class\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/home-assistant-energy-dashboard-device-class-unit-and-state-class\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/home-assistant-energy-dashboard-device-class-unit-and-state-class\/#primaryimage","url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/09\/hero-10374-why-a-sensor-never-reaches-the-energ-n.png","contentUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/09\/hero-10374-why-a-sensor-never-reaches-the-energ-n.png","width":1200,"height":630,"caption":"Home Assistant Energy Dashboard: Device Class, Unit and State Class in the Discovery Payload"},{"@type":"BreadcrumbList","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/smart-home\/home-assistant-energy-dashboard-device-class-unit-and-state-class\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.lukaswojcik.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Home Assistant Energy Dashboard: Device Class, Unit and State Class in the Discovery Payload"}]},{"@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\/10374","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=10374"}],"version-history":[{"count":5,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/10374\/revisions"}],"predecessor-version":[{"id":23586,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/10374\/revisions\/23586"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/media\/15161"}],"wp:attachment":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/media?parent=10374"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/categories?post=10374"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/tags?post=10374"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}