Add Netatmo weather trend sensors (#41318)

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
cgtobi 2020-10-06 15:25:12 +02:00 committed by GitHub
parent 4d5948b4d0
commit 6065ab118f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,8 +49,10 @@ 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],
@ -312,6 +314,8 @@ class NetatmoSensor(NetatmoBase):
try:
if self.type == "temperature":
self._state = round(data["Temperature"], 1)
elif self.type == "temp_trend":
self._state = data["temp_trend"]
elif self.type == "humidity":
self._state = data["Humidity"]
elif self.type == "rain":
@ -326,6 +330,8 @@ class NetatmoSensor(NetatmoBase):
self._state = data["CO2"]
elif self.type == "pressure":
self._state = round(data["Pressure"], 1)
elif self.type == "pressure_trend":
self._state = data["pressure_trend"]
elif self.type == "battery_percent":
self._state = data["battery_percent"]
elif self.type == "battery_lvl":