Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: suggested_display_precision = 1 #46

Merged
merged 2 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ template: |
categories:
- title: 🚀 Features
labels:
- feat
- feature
- enhancement
- title: 🐛 Bug Fixes
Expand All @@ -17,6 +18,7 @@ categories:
- title: ⚠️ Breaking
labels:
- breaking
- breaking change
- title: ⚠️ Changes
labels:
- changed
Expand All @@ -32,7 +34,21 @@ categories:
- title: 📄 Documentation
labels:
- docs
- doc
- documentation
- title: 🛠 Refactoring
labels:
- refactor
- style
- title: 🚀 Performance
labels:
- perf
- title: 🧪 Test
labels:
- test
- title: 👷 Chore
labels:
- chore
- title: 🧩 Dependency Updates
labels:
- deps
Expand Down
21 changes: 14 additions & 7 deletions custom_components/nexxtmove/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
from dataclasses import dataclass
from typing import Any

from homeassistant.components.sensor import SensorDeviceClass
from homeassistant.components.sensor import SensorEntity
from homeassistant.components.sensor import SensorEntityDescription
from homeassistant.components.sensor import SensorStateClass
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
SensorStateClass,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CURRENCY_EURO
from homeassistant.const import UnitOfEnergy
from homeassistant.const import CURRENCY_EURO, UnitOfEnergy
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityDescription
from homeassistant.helpers.entity_platform import AddEntitiesCallback
Expand Down Expand Up @@ -40,18 +41,21 @@ class NexxtmoveSensorDescription(SensorEntityDescription):
device_class=SensorDeviceClass.ENERGY,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
icon="mdi:gauge",
suggested_display_precision=1,
),
NexxtmoveSensorDescription(
key="consumptionTotal",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
suggested_display_precision=1,
icon="mdi:gauge",
),
NexxtmoveSensorDescription(
key="totalEnergyWh",
device_class=SensorDeviceClass.ENERGY,
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
suggested_display_precision=1,
icon="mdi:gauge",
),
NexxtmoveSensorDescription(key="counter", icon="mdi:counter"),
Expand All @@ -60,11 +64,14 @@ class NexxtmoveSensorDescription(SensorEntityDescription):
NexxtmoveSensorDescription(
key="charging_events", icon="mdi:calendar-multiple-check"
),
NexxtmoveSensorDescription(key="price", icon="mdi:currency-eur"),
NexxtmoveSensorDescription(
key="price", suggested_display_precision=1, icon="mdi:currency-eur"
),
NexxtmoveSensorDescription(key="charges", icon="mdi:currency-eur"),
NexxtmoveSensorDescription(
key="euro",
icon="mdi:currency-eur",
suggested_display_precision=1,
device_class=SensorDeviceClass.MONETARY,
native_unit_of_measurement=CURRENCY_EURO,
),
Expand Down