mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add Netatmo sensor enable default (#41928)
This commit is contained in:
parent
5230ff6640
commit
c052c261d5
@ -48,39 +48,53 @@ SUPPORTED_PUBLIC_SENSOR_TYPES = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
SENSOR_TYPES = {
|
SENSOR_TYPES = {
|
||||||
"temperature": ["Temperature", TEMP_CELSIUS, None, DEVICE_CLASS_TEMPERATURE],
|
"temperature": ["Temperature", TEMP_CELSIUS, None, DEVICE_CLASS_TEMPERATURE, True],
|
||||||
"temp_trend": ["Temperature trend", None, "mdi:trending-up", None],
|
"temp_trend": ["Temperature trend", None, "mdi:trending-up", None, False],
|
||||||
"co2": ["CO2", CONCENTRATION_PARTS_PER_MILLION, "mdi:molecule-co2", None],
|
"co2": ["CO2", CONCENTRATION_PARTS_PER_MILLION, "mdi:molecule-co2", None, True],
|
||||||
"pressure": ["Pressure", PRESSURE_MBAR, None, DEVICE_CLASS_PRESSURE],
|
"pressure": ["Pressure", PRESSURE_MBAR, None, DEVICE_CLASS_PRESSURE, True],
|
||||||
"pressure_trend": ["Pressure trend", None, "mdi:trending-up", None],
|
"pressure_trend": ["Pressure trend", None, "mdi:trending-up", None, False],
|
||||||
"noise": ["Noise", "dB", "mdi:volume-high", None],
|
"noise": ["Noise", "dB", "mdi:volume-high", None, True],
|
||||||
"humidity": ["Humidity", PERCENTAGE, None, DEVICE_CLASS_HUMIDITY],
|
"humidity": ["Humidity", PERCENTAGE, None, DEVICE_CLASS_HUMIDITY, True],
|
||||||
"rain": ["Rain", LENGTH_MILLIMETERS, "mdi:weather-rainy", None],
|
"rain": ["Rain", LENGTH_MILLIMETERS, "mdi:weather-rainy", None, True],
|
||||||
"sum_rain_1": ["Rain last hour", LENGTH_MILLIMETERS, "mdi:weather-rainy", None],
|
"sum_rain_1": [
|
||||||
"sum_rain_24": ["Rain today", LENGTH_MILLIMETERS, "mdi:weather-rainy", None],
|
"Rain last hour",
|
||||||
"battery_percent": ["Battery Percent", PERCENTAGE, None, DEVICE_CLASS_BATTERY],
|
LENGTH_MILLIMETERS,
|
||||||
"windangle": ["Direction", None, "mdi:compass-outline", None],
|
"mdi:weather-rainy",
|
||||||
"windangle_value": ["Angle", DEGREE, "mdi:compass-outline", None],
|
None,
|
||||||
|
False,
|
||||||
|
],
|
||||||
|
"sum_rain_24": ["Rain today", LENGTH_MILLIMETERS, "mdi:weather-rainy", None, True],
|
||||||
|
"battery_percent": [
|
||||||
|
"Battery Percent",
|
||||||
|
PERCENTAGE,
|
||||||
|
None,
|
||||||
|
DEVICE_CLASS_BATTERY,
|
||||||
|
True,
|
||||||
|
],
|
||||||
|
"windangle": ["Direction", None, "mdi:compass-outline", None, True],
|
||||||
|
"windangle_value": ["Angle", DEGREE, "mdi:compass-outline", None, False],
|
||||||
"windstrength": [
|
"windstrength": [
|
||||||
"Wind Strength",
|
"Wind Strength",
|
||||||
SPEED_KILOMETERS_PER_HOUR,
|
SPEED_KILOMETERS_PER_HOUR,
|
||||||
"mdi:weather-windy",
|
"mdi:weather-windy",
|
||||||
None,
|
None,
|
||||||
|
True,
|
||||||
],
|
],
|
||||||
"gustangle": ["Gust Direction", None, "mdi:compass-outline", None],
|
"gustangle": ["Gust Direction", None, "mdi:compass-outline", None, False],
|
||||||
"gustangle_value": ["Gust Angle", DEGREE, "mdi:compass-outline", None],
|
"gustangle_value": ["Gust Angle", DEGREE, "mdi:compass-outline", None, False],
|
||||||
"guststrength": [
|
"guststrength": [
|
||||||
"Gust Strength",
|
"Gust Strength",
|
||||||
SPEED_KILOMETERS_PER_HOUR,
|
SPEED_KILOMETERS_PER_HOUR,
|
||||||
"mdi:weather-windy",
|
"mdi:weather-windy",
|
||||||
None,
|
None,
|
||||||
|
False,
|
||||||
],
|
],
|
||||||
"reachable": ["Reachability", None, "mdi:signal", None],
|
"reachable": ["Reachability", None, "mdi:signal", None, False],
|
||||||
"rf_status": ["Radio", None, "mdi:signal", None],
|
"rf_status": ["Radio", None, "mdi:signal", None, False],
|
||||||
"rf_status_lvl": ["Radio Level", "", None, DEVICE_CLASS_SIGNAL_STRENGTH],
|
"rf_status_lvl": ["Radio Level", "", None, DEVICE_CLASS_SIGNAL_STRENGTH, False],
|
||||||
"wifi_status": ["Wifi", None, "mdi:wifi", None],
|
"wifi_status": ["Wifi", None, "mdi:wifi", None, False],
|
||||||
"wifi_status_lvl": ["Wifi Level", "dBm", None, DEVICE_CLASS_SIGNAL_STRENGTH],
|
"wifi_status_lvl": ["Wifi Level", "dBm", None, DEVICE_CLASS_SIGNAL_STRENGTH, False],
|
||||||
"health_idx": ["Health", None, "mdi:cloud", None],
|
"health_idx": ["Health", None, "mdi:cloud", None, True],
|
||||||
}
|
}
|
||||||
|
|
||||||
MODULE_TYPE_OUTDOOR = "NAModule1"
|
MODULE_TYPE_OUTDOOR = "NAModule1"
|
||||||
@ -257,6 +271,7 @@ class NetatmoSensor(NetatmoBase):
|
|||||||
self._unit_of_measurement = SENSOR_TYPES[self.type][1]
|
self._unit_of_measurement = SENSOR_TYPES[self.type][1]
|
||||||
self._model = device["type"]
|
self._model = device["type"]
|
||||||
self._unique_id = f"{self._id}-{self.type}"
|
self._unique_id = f"{self._id}-{self.type}"
|
||||||
|
self._enabled_default = SENSOR_TYPES[self.type][4]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def icon(self):
|
def icon(self):
|
||||||
@ -283,6 +298,11 @@ class NetatmoSensor(NetatmoBase):
|
|||||||
"""Return entity availability."""
|
"""Return entity availability."""
|
||||||
return self._state is not None
|
return self._state is not None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def entity_registry_enabled_default(self) -> bool:
|
||||||
|
"""Return if the entity should be enabled when first added to the entity registry."""
|
||||||
|
return self._enabled_default
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_update_callback(self):
|
def async_update_callback(self):
|
||||||
"""Update the entity's state."""
|
"""Update the entity's state."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user