Add support for NetAtmo rain gauge

Example Config:
...
modules:
    Bedroom:
      - temperature
    LivingRoom:
      - temperature
    Outside:
      - temperature
    Garden:
      - rain
      - sum_rain_1
      - sum_rain_24

The three new parameters stand for:
- rain # Estimated rainfall for today in "mm"
- sum_rain_1 # Rainfall in the last hour in "mm"
- sum_rain_24 # Rainfall in "mm" from 00:00am - 23:59pm
This commit is contained in:
Gregor Gruener 2016-02-28 12:24:45 +01:00
parent 49982ac83c
commit c14ca9983c

View File

@ -26,7 +26,10 @@ SENSOR_TYPES = {
'co2': ['CO2', 'ppm', 'mdi:cloud'], 'co2': ['CO2', 'ppm', 'mdi:cloud'],
'pressure': ['Pressure', 'mbar', 'mdi:gauge'], 'pressure': ['Pressure', 'mbar', 'mdi:gauge'],
'noise': ['Noise', 'dB', 'mdi:volume-high'], 'noise': ['Noise', 'dB', 'mdi:volume-high'],
'humidity': ['Humidity', '%', 'mdi:water-percent'] 'humidity': ['Humidity', '%', 'mdi:water-percent'],
'rain': ['Rain', 'mm', 'mdi:weather-rainy'],
'sum_rain_1': ['sum_rain_1', 'mm', 'mdi:weather-rainy'],
'sum_rain_24': ['sum_rain_24', 'mm', 'mdi:weather-rainy'],
} }
CONF_SECRET_KEY = 'secret_key' CONF_SECRET_KEY = 'secret_key'
@ -128,6 +131,12 @@ class NetAtmoSensor(Entity):
self._state = round(data['Temperature'], 1) self._state = round(data['Temperature'], 1)
elif self.type == 'humidity': elif self.type == 'humidity':
self._state = data['Humidity'] self._state = data['Humidity']
elif self.type == 'rain':
self._state = data['Rain']
elif self.type == 'sum_rain_1':
self._state = data['sum_rain_1']
elif self.type == 'sum_rain_24':
self._state = data['sum_rain_24']
elif self.type == 'noise': elif self.type == 'noise':
self._state = data['Noise'] self._state = data['Noise']
elif self.type == 'co2': elif self.type == 'co2':