How to use the pyatmo.PublicData function in pyatmo

To help you get started, we’ve selected a few pyatmo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github home-assistant / home-assistant / homeassistant / components / netatmo_public / sensor.py View on Github external
def update(self):
        """Request an update from the Netatmo API."""
        import pyatmo
        data = pyatmo.PublicData(self.auth,
                                 LAT_NE=self.lat_ne,
                                 LON_NE=self.lon_ne,
                                 LAT_SW=self.lat_sw,
                                 LON_SW=self.lon_sw,
                                 filtering=True)

        if data.CountStationInArea() == 0:
            _LOGGER.warning('No Stations available in this area.')
            return

        self.data = data
github home-assistant / home-assistant / homeassistant / components / sensor / netatmo_public.py View on Github external
def update(self):
        """Request an update from the Netatmo API."""
        import pyatmo
        raindata = pyatmo.PublicData(self.auth,
                                     LAT_NE=self.lat_ne,
                                     LON_NE=self.lon_ne,
                                     LAT_SW=self.lat_sw,
                                     LON_SW=self.lon_sw,
                                     required_data_type="rain")

        if raindata.CountStationInArea() == 0:
            _LOGGER.warning('No Rain Station available in this area.')
            return

        raindata_live = raindata.getLive()

        if self.calculation == 'avg':
            self.data = sum(raindata_live.values()) / len(raindata_live)
        else:
            self.data = max(raindata_live.values())
github home-assistant / home-assistant / homeassistant / components / netatmo / sensor.py View on Github external
def update(self):
        """Request an update from the Netatmo API."""
        data = pyatmo.PublicData(
            self.auth,
            LAT_NE=self.lat_ne,
            LON_NE=self.lon_ne,
            LAT_SW=self.lat_sw,
            LON_SW=self.lon_sw,
            filtering=True,
        )

        if data.CountStationInArea() == 0:
            _LOGGER.warning("No Stations available in this area.")
            return

        self.data = data

pyatmo

Simple API to access Netatmo weather station data from any Python 3 script. Designed for Home Assistant (but not only)

MIT
Latest version published 4 months ago

Package Health Score

72 / 100
Full package analysis