Pretty much what the title says. I have a few entities in which I track the price of things that fluctuate (ex. Electricity Price in Texas which can change quickly). In this case the value is a spot price not a totalization of some cost (like the total of my electric bill)
I couldn’t find a discussion anywhere on why Monetary isn’t allowed as a measurement but I’m very curious
Not sure if too late, but I stumbled across something when I was trying to solve for the same issue as you. I created a template sensor through the UI and set its Unit of Measurement to “USD”, and boom! That did the trick.
2024-02-24 01:33:47.601 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.ing_deutschland_direkt_depot_XXXXXXXX_total_total_equity_value (<class 'homeassistant.components.mqtt.sensor.MqttSensor'>) is using state class 'measurement' which is impossible considering device class ('monetary') it is using; expected None or one of 'total'; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+mqtt%22
I’m confused by that message as well.
I don’t see another device_class that represent a “price” (I’m monitoring fuel price, here).
EDIT: To be clear, the point of having a state_class in the first place is to be able to generate long-term statistics. The device_class is just a nice-to-have
Monetary means it represents money. Limiting it to be a balance does not serve any purpose I can see. Either have multiple Monetary like device classes or allow it to represent different things. For Energy we allow total and total_increasing, but for monetary we allow total but not total increasing? Hence we cannot use monetary for the cost of energy in utility meters. And what about price? That is money, right? but it is not a total, it is a measurement. So either mke it flexible or allow different kinds of money.
Here in the UK, the Hildebrand DCC (installed via HACS) domestic meter integration started failing a couple of days ago because SensorStateClass.TOTAL_INCREASING cannot be used with SensoeDeviceClass.MONETRY but for daily reporting of UK domestic gas costs that seems the ideal combination.
In the error log I get:
2025-04-01 17:39:09.175 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.dcc_sourced_smart_electricity_meter_cost_today (<class ‘custom_components.hildebrandglow_dcc.sensor.Cost’>) is using state class ‘total_increasing’ which is impossible considering device class (‘monetary’) it is using; expected None or one of ‘total’; Please update your configuration if your entity is manually configured, otherwise create a bug report at GitHub · Where software is built