Skip to content

Commit

Permalink
Add numeric sensor for wind direction
Browse files Browse the repository at this point in the history
  • Loading branch information
astrandb committed Dec 17, 2023
1 parent 315f2d0 commit 9c632ec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions custom_components/weatherlink/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
DEGREE,
PERCENTAGE,
UnitOfElectricPotential,
UnitOfIrradiance,
Expand Down Expand Up @@ -122,6 +123,15 @@ class WLSensorDescription(SensorEntityDescription):
icon="mdi:compass-outline",
translation_key="wind_direction",
),
WLSensorDescription(
key="WindDirDeg",
tag=DataKey.WIND_DIR,
icon="mdi:compass-outline",
native_unit_of_measurement=DEGREE,
translation_key="wind_direction_deg",
state_class=SensorStateClass.MEASUREMENT,
entity_registry_enabled_default=False,
),
WLSensorDescription(
key="RainToday",
tag=DataKey.RAIN_DAY,
Expand Down Expand Up @@ -403,6 +413,7 @@ def native_value(self):
"WetBulb",
"Wind",
"WindChill",
"WindDirDeg",
"WindGust",
]:
return self.coordinator.data.get(self.entity_description.tag)
Expand Down
3 changes: 3 additions & 0 deletions custom_components/weatherlink/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@
"wsw": "WSW"
}
},
"wind_direction_deg": {
"name": "Wind direction deg"
},
"wind_gust": {
"name": "Wind gust"
},
Expand Down

0 comments on commit 9c632ec

Please sign in to comment.