Open peteh opened 5 months ago
FYI, as a workaround, you can use a custom SensorInfo subclass with the suggested_display_precision
property:
class SensorInfoExtra(SensorInfo):
suggested_display_precision: int
balance_sensor_info = SensorInfoExtra(name=f"{balance.account_name}",
device_class="monetary",
unit_of_measurement = "EUR",
state_class="measurement",
suggested_display_precision=2,
unique_id=balance_unique_id,
device=device_info)
sensor_settings = Settings(mqtt=self._mqtt_settings, entity=balance_sensor_info)
Thanks, I'm using this workaround for now
Is your feature request related to a problem? Please describe. https://www.home-assistant.io/integrations/sensor.mqtt/ The documentation describes
suggested_display_precision
however it seems that this is not settable in this library.It would configure homeassistant to set the correct decimals.
Describe the solution you'd like A clear and concise description of what you want to happen. I'd like to add suggested_display_precision to SensorInfo to give homeassistant this information for showing my numbers.
Describe alternatives you've considered I tried rounding the numbers but for some floats it will still include numerical errors.
Additional context Add any other context or screenshots about the feature request here.