Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
)
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