How to use the pyatmo.WeatherStationData 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 / sensor.py View on Github external
moduleId=module["id"]
                ):
                    entities.append(NetatmoSensor(data, module, condition.lower()))
            return entities

        def _retry(_data):
            try:
                entities = find_devices(_data)
            except requests.exceptions.Timeout:
                return call_later(
                    hass, NETATMO_UPDATE_INTERVAL, lambda _: _retry(_data)
                )
            if entities:
                add_entities(entities, True)

        for data_class in [pyatmo.WeatherStationData, pyatmo.HomeCoachData]:
            try:
                data = NetatmoData(auth, data_class, config.get(CONF_STATION))
            except pyatmo.NoDevice:
                _LOGGER.info(
                    "No %s devices found", NETATMO_DEVICE_TYPES[data_class.__name__]
                )
                continue

            try:
                dev.extend(find_devices(data))
            except requests.exceptions.Timeout:
                call_later(hass, NETATMO_UPDATE_INTERVAL, lambda _: _retry(data))

    if dev:
        add_entities(dev, True)
github home-assistant / home-assistant / homeassistant / components / sensor / netatmo.py View on Github external
def _detect_platform_type(self):
        """Return the XXXData object corresponding to the specified platform.

        The return can be a WeatherStationData or a HomeCoachData.
        """
        import pyatmo
        for data_class in [pyatmo.WeatherStationData, pyatmo.HomeCoachData]:
            try:
                station_data = data_class(self.auth)
                _LOGGER.debug("%s detected!", str(data_class.__name__))
                return station_data
            except TypeError:
                continue

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 3 months ago

Package Health Score

78 / 100
Full package analysis