Skip to content

Commit

Permalink
Fix the name of sensors incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
tsunglung committed Jan 24, 2024
1 parent 8bdbdc8 commit abec37e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions custom_components/opencwb/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
DOMAIN = "opencwb"
DEFAULT_NAME = "OpenCWB"
DEFAULT_LANGUAGE = "zh_tw"
ATTRIBUTION = "Data provided by Opendata CWB"
MANUFACTURER = "OpenCWB (\u4e2d\u592e\u6c23\u8c61\u5c40\u6c23\u8c61\u8cc7\u6599\u958b\u653e\u5e73\u81fa)"
ATTRIBUTION = "Data provided by Opendata CWA"
MANUFACTURER = "OpenCWA (\u4e2d\u592e\u6c23\u8c61\u5c40\u6c23\u8c61\u8cc7\u6599\u958b\u653e\u5e73\u81fa)"
CONF_LANGUAGE = "language"
CONF_LOCATION_NAME = "location_name"
CONFIG_FLOW_VERSION = 1
Expand Down
9 changes: 7 additions & 2 deletions custom_components/opencwb/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
unique_id = f"{config_entry.unique_id}-{sensor_type}"
entities.append(
OpenCWBSensor(
name,
f"{name} {sensor_type}",
unique_id,
sensor_type,
weather_sensor_types[sensor_type],
Expand All @@ -39,7 +39,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
unique_id = f"{config_entry.unique_id}-forecast-{sensor_type}"
entities.append(
OpenCWBForecastSensor(
f"{name} Forecast",
f"{name} Forecast {sensor_type}",
unique_id,
sensor_type,
forecast_sensor_types[sensor_type],
Expand Down Expand Up @@ -70,6 +70,9 @@ def __init__(
weather_coordinator
)
self._weather_coordinator = weather_coordinator
self._attr_name = name.replace("_", " ")
self._attr_unique_id = unique_id


@property
def state(self):
Expand Down Expand Up @@ -97,6 +100,8 @@ def __init__(
weather_coordinator
)
self._weather_coordinator = weather_coordinator
self._attr_name = name.replace("_", " ")
self._attr_unique_id = unique_id

@property
def state(self):
Expand Down

0 comments on commit abec37e

Please sign in to comment.