mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
Remove Netatmo unnecessary battery sensors (#41321)
This commit is contained in:
parent
4434958265
commit
05765f1700
@ -58,8 +58,6 @@ SENSOR_TYPES = {
|
|||||||
"rain": ["Rain", LENGTH_MILLIMETERS, "mdi:weather-rainy", None],
|
"rain": ["Rain", LENGTH_MILLIMETERS, "mdi:weather-rainy", None],
|
||||||
"sum_rain_1": ["Rain last hour", LENGTH_MILLIMETERS, "mdi:weather-rainy", None],
|
"sum_rain_1": ["Rain last hour", LENGTH_MILLIMETERS, "mdi:weather-rainy", None],
|
||||||
"sum_rain_24": ["Rain today", LENGTH_MILLIMETERS, "mdi:weather-rainy", None],
|
"sum_rain_24": ["Rain today", LENGTH_MILLIMETERS, "mdi:weather-rainy", None],
|
||||||
"battery_vp": ["Battery", "", "mdi:battery", None],
|
|
||||||
"battery_lvl": ["Battery Level", "", "mdi:battery", None],
|
|
||||||
"battery_percent": ["Battery Percent", PERCENTAGE, None, DEVICE_CLASS_BATTERY],
|
"battery_percent": ["Battery Percent", PERCENTAGE, None, DEVICE_CLASS_BATTERY],
|
||||||
"min_temp": ["Min Temp.", TEMP_CELSIUS, None, DEVICE_CLASS_TEMPERATURE],
|
"min_temp": ["Min Temp.", TEMP_CELSIUS, None, DEVICE_CLASS_TEMPERATURE],
|
||||||
"max_temp": ["Max Temp.", TEMP_CELSIUS, None, DEVICE_CLASS_TEMPERATURE],
|
"max_temp": ["Max Temp.", TEMP_CELSIUS, None, DEVICE_CLASS_TEMPERATURE],
|
||||||
@ -138,14 +136,13 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
|||||||
conditions = [
|
conditions = [
|
||||||
c.lower()
|
c.lower()
|
||||||
for c in data_class.get_monitored_conditions(module_id=module["_id"])
|
for c in data_class.get_monitored_conditions(module_id=module["_id"])
|
||||||
|
if c in SENSOR_TYPES
|
||||||
]
|
]
|
||||||
for condition in conditions:
|
for condition in conditions:
|
||||||
if f"{condition}_value" in SENSOR_TYPES:
|
if f"{condition}_value" in SENSOR_TYPES:
|
||||||
conditions.append(f"{condition}_value")
|
conditions.append(f"{condition}_value")
|
||||||
elif f"{condition}_lvl" in SENSOR_TYPES:
|
elif f"{condition}_lvl" in SENSOR_TYPES:
|
||||||
conditions.append(f"{condition}_lvl")
|
conditions.append(f"{condition}_lvl")
|
||||||
elif condition == "battery_vp":
|
|
||||||
conditions.append("battery_lvl")
|
|
||||||
|
|
||||||
for condition in conditions:
|
for condition in conditions:
|
||||||
entities.append(
|
entities.append(
|
||||||
@ -248,7 +245,10 @@ class NetatmoSensor(NetatmoBase):
|
|||||||
if device["type"] in ("NHC", "NAMain"):
|
if device["type"] in ("NHC", "NAMain"):
|
||||||
self._device_name = module_info["station_name"]
|
self._device_name = module_info["station_name"]
|
||||||
else:
|
else:
|
||||||
self._device_name = f"{station['station_name']} {module_info.get('module_name', device['type'])}"
|
self._device_name = (
|
||||||
|
f"{station['station_name']} "
|
||||||
|
f"{module_info.get('module_name', device['type'])}"
|
||||||
|
)
|
||||||
|
|
||||||
self._name = (
|
self._name = (
|
||||||
f"{MANUFACTURER} {self._device_name} {SENSOR_TYPES[sensor_type][0]}"
|
f"{MANUFACTURER} {self._device_name} {SENSOR_TYPES[sensor_type][0]}"
|
||||||
@ -334,10 +334,6 @@ class NetatmoSensor(NetatmoBase):
|
|||||||
self._state = data["pressure_trend"]
|
self._state = data["pressure_trend"]
|
||||||
elif self.type == "battery_percent":
|
elif self.type == "battery_percent":
|
||||||
self._state = data["battery_percent"]
|
self._state = data["battery_percent"]
|
||||||
elif self.type == "battery_lvl":
|
|
||||||
self._state = data["battery_vp"]
|
|
||||||
elif self.type == "battery_vp":
|
|
||||||
self._state = process_battery(data["battery_vp"], self._model)
|
|
||||||
elif self.type == "min_temp":
|
elif self.type == "min_temp":
|
||||||
self._state = data["min_temp"]
|
self._state = data["min_temp"]
|
||||||
elif self.type == "max_temp":
|
elif self.type == "max_temp":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user