File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
homeassistant/components/uptimerobot Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change 22
33from __future__ import annotations
44
5+ from typing import TYPE_CHECKING
6+
57from pyuptimerobot import (
68 UptimeRobot ,
79 UptimeRobotAuthenticationException ,
@@ -51,7 +53,12 @@ async def _async_update_data(self) -> list[UptimeRobotMonitor]:
5153 raise UpdateFailed (exception ) from exception
5254
5355 if response .status != API_ATTR_OK :
54- raise UpdateFailed (response .error .message )
56+ raise UpdateFailed (
57+ response .error .message if response .error else "Unknown error"
58+ )
59+
60+ if TYPE_CHECKING :
61+ assert isinstance (response .data , list )
5562
5663 monitors : list [UptimeRobotMonitor ] = response .data
5764
@@ -70,11 +77,4 @@ async def _async_update_data(self) -> list[UptimeRobotMonitor]:
7077 remove_config_entry_id = self .config_entry .entry_id ,
7178 )
7279
73- # If there are new monitors, we should reload the config entry so we can
74- # create new devices and entities.
75- if self .data and new_monitors - current_monitors :
76- self .hass .async_create_task (
77- self .hass .config_entries .async_reload (self .config_entry .entry_id )
78- )
79-
8080 return monitors
You can’t perform that action at this time.
0 commit comments