diff --git a/homeassistant/components/netatmo/sensor.py b/homeassistant/components/netatmo/sensor.py index 9cecc19683b..84e18ba7241 100644 --- a/homeassistant/components/netatmo/sensor.py +++ b/homeassistant/components/netatmo/sensor.py @@ -48,39 +48,53 @@ SUPPORTED_PUBLIC_SENSOR_TYPES = [ ] SENSOR_TYPES = { - "temperature": ["Temperature", TEMP_CELSIUS, None, DEVICE_CLASS_TEMPERATURE], - "temp_trend": ["Temperature trend", None, "mdi:trending-up", None], - "co2": ["CO2", CONCENTRATION_PARTS_PER_MILLION, "mdi:molecule-co2", None], - "pressure": ["Pressure", PRESSURE_MBAR, None, DEVICE_CLASS_PRESSURE], - "pressure_trend": ["Pressure trend", None, "mdi:trending-up", None], - "noise": ["Noise", "dB", "mdi:volume-high", None], - "humidity": ["Humidity", PERCENTAGE, None, DEVICE_CLASS_HUMIDITY], - "rain": ["Rain", 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], - "battery_percent": ["Battery Percent", PERCENTAGE, None, DEVICE_CLASS_BATTERY], - "windangle": ["Direction", None, "mdi:compass-outline", None], - "windangle_value": ["Angle", DEGREE, "mdi:compass-outline", None], + "temperature": ["Temperature", TEMP_CELSIUS, None, DEVICE_CLASS_TEMPERATURE, True], + "temp_trend": ["Temperature trend", None, "mdi:trending-up", None, False], + "co2": ["CO2", CONCENTRATION_PARTS_PER_MILLION, "mdi:molecule-co2", None, True], + "pressure": ["Pressure", PRESSURE_MBAR, None, DEVICE_CLASS_PRESSURE, True], + "pressure_trend": ["Pressure trend", None, "mdi:trending-up", None, False], + "noise": ["Noise", "dB", "mdi:volume-high", None, True], + "humidity": ["Humidity", PERCENTAGE, None, DEVICE_CLASS_HUMIDITY, True], + "rain": ["Rain", LENGTH_MILLIMETERS, "mdi:weather-rainy", None, True], + "sum_rain_1": [ + "Rain last hour", + LENGTH_MILLIMETERS, + "mdi:weather-rainy", + 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": [ "Wind Strength", SPEED_KILOMETERS_PER_HOUR, "mdi:weather-windy", None, + True, ], - "gustangle": ["Gust Direction", None, "mdi:compass-outline", None], - "gustangle_value": ["Gust Angle", DEGREE, "mdi:compass-outline", None], + "gustangle": ["Gust Direction", None, "mdi:compass-outline", None, False], + "gustangle_value": ["Gust Angle", DEGREE, "mdi:compass-outline", None, False], "guststrength": [ "Gust Strength", SPEED_KILOMETERS_PER_HOUR, "mdi:weather-windy", None, + False, ], - "reachable": ["Reachability", None, "mdi:signal", None], - "rf_status": ["Radio", None, "mdi:signal", None], - "rf_status_lvl": ["Radio Level", "", None, DEVICE_CLASS_SIGNAL_STRENGTH], - "wifi_status": ["Wifi", None, "mdi:wifi", None], - "wifi_status_lvl": ["Wifi Level", "dBm", None, DEVICE_CLASS_SIGNAL_STRENGTH], - "health_idx": ["Health", None, "mdi:cloud", None], + "reachable": ["Reachability", None, "mdi:signal", None, False], + "rf_status": ["Radio", None, "mdi:signal", None, False], + "rf_status_lvl": ["Radio Level", "", None, DEVICE_CLASS_SIGNAL_STRENGTH, False], + "wifi_status": ["Wifi", None, "mdi:wifi", None, False], + "wifi_status_lvl": ["Wifi Level", "dBm", None, DEVICE_CLASS_SIGNAL_STRENGTH, False], + "health_idx": ["Health", None, "mdi:cloud", None, True], } MODULE_TYPE_OUTDOOR = "NAModule1" @@ -257,6 +271,7 @@ class NetatmoSensor(NetatmoBase): self._unit_of_measurement = SENSOR_TYPES[self.type][1] self._model = device["type"] self._unique_id = f"{self._id}-{self.type}" + self._enabled_default = SENSOR_TYPES[self.type][4] @property def icon(self): @@ -283,6 +298,11 @@ class NetatmoSensor(NetatmoBase): """Return entity availability.""" 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 def async_update_callback(self): """Update the entity's state."""