Skip to content

Commit

Permalink
Add device class to elevation and velocity sensors (fixes #3)
Browse files Browse the repository at this point in the history
  • Loading branch information
BHSPitMonkey committed Dec 29, 2023
1 parent f54adc5 commit 6232401
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion custom_components/garmin_mapshare/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import cast

from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
)
Expand Down Expand Up @@ -44,6 +45,7 @@ def float_from_first_word(text: str) -> float:
translation_key="elevation",
icon="mdi:elevation-rise",
native_unit_of_measurement=UnitOfLength.METERS,
device_class=SensorDeviceClass.DISTANCE,
), float_from_first_word, None),
"Course": (SensorEntityDescription(
key="course",
Expand All @@ -55,7 +57,8 @@ def float_from_first_word(text: str) -> float:
key="velocity",
translation_key="elevation",
icon="mdi:speedometer",
native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR
native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR,
device_class=SensorDeviceClass.SPEED,
), float_from_first_word, None),
"Text": (SensorEntityDescription(
key="last_text",
Expand Down

0 comments on commit 6232401

Please sign in to comment.