How to use the regenmaschine.errors.RequestError function in regenmaschine

To help you get started, we’ve selected a few regenmaschine 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 / rainmachine / switch.py View on Github external
ATTR_PRECIP_RATE: self._properties_json.get("waterSense").get(
                        "precipitationRate"
                    ),
                    ATTR_RESTRICTIONS: self._obj.get("restriction"),
                    ATTR_SLOPE: SLOPE_TYPE_MAP.get(self._properties_json.get("slope")),
                    ATTR_SOIL_TYPE: SOIL_TYPE_MAP.get(self._properties_json.get("sun")),
                    ATTR_SPRINKLER_TYPE: SPRINKLER_TYPE_MAP.get(
                        self._properties_json.get("group_id")
                    ),
                    ATTR_SUN_EXPOSURE: SUN_EXPOSURE_MAP.get(
                        self._properties_json.get("sun")
                    ),
                    ATTR_VEGETATION_TYPE: VEGETATION_MAP.get(self._obj.get("type")),
                }
            )
        except RequestError as err:
            _LOGGER.error(
                'Unable to update info for zone "%s": %s', self.unique_id, str(err)
            )
github bachya / smart-home / home-assistant / settings / custom_components / rainmachine / switch.py View on Github external
async def _async_run_switch_coroutine(self, api_coro) -> None:
        """Run a coroutine to toggle the switch."""
        try:
            resp = await api_coro
        except RequestError as err:
            _LOGGER.error(
                'Error while toggling %s "%s": %s',
                self._switch_type,
                self.unique_id,
                err,
            )
            return

        if resp["statusCode"] != 0:
            _LOGGER.error(
                'Error while toggling %s "%s": %s',
                self._switch_type,
                self.unique_id,
                resp["message"],
            )
            return

regenmaschine

A simple API for RainMachine sprinkler controllers

MIT
Latest version published 3 months ago

Package Health Score

69 / 100
Full package analysis

Similar packages