88from homeassistant .helpers .update_coordinator import DataUpdateCoordinator
99from homeassistant .util import slugify
1010
11- from .const import CLIMATE , CONF_REFRESH_TIME , COVER , DOMAIN , LIGHT , SENSOR , DEFAULT_REFRESH_TIME
11+ from .const import CLIMATE , CONF_REFRESH_TIME , COVER , DOMAIN , LIGHT , SENSOR
1212from .comm .comms_thread import CommsThread2
1313
1414_LOGGER = logging .getLogger (__name__ )
@@ -42,11 +42,7 @@ async def async_setup_entry(hass, config_entry):
4242 hass .states .async_set (f"{ _server_name } .state" , "Offline" )
4343 hass .states .async_set (f"{ _server_name } .first_contact" , "True" )
4444
45- _refresh_timer = config_entry .options .get (CONF_REFRESH_TIME , DEFAULT_REFRESH_TIME )
46-
47- _LOGGER .debug ("MYIO Config:" )
48- for key in config_entry .options :
49- _LOGGER .debug (f"{ key } : { config_entry .options (key )} " )
45+ _refresh_timer = config_entry .options .get (CONF_REFRESH_TIME , 6 )
5046
5147 def server_data ():
5248 """Return the server data dictionary database."""
@@ -69,14 +65,14 @@ async def async_update_data():
6965 """Fetch data from API endpoint."""
7066
7167 was_offline = False
72- _timeout = 4
68+ _timeout = 30
7369 _comms_thread_timeout = False
7470 _temp_server_state = hass .states .get (f"{ _server_name } .state" ).state
7571
7672 if _temp_server_state == "Offline" :
7773 hass .states .async_set (f"{ _server_name } .available" , False )
7874 was_offline = True
79- _timeout = 20
75+ _timeout = 30
8076
8177 # Pull fresh data from server.
8278 try :
@@ -88,7 +84,8 @@ async def async_update_data():
8884 server_data = server_data (),
8985 server_status = _temp_server_state ,
9086 config_entry = config_entry ,
91- _post = None
87+ _post = None ,
88+ hass = hass
9289 ),
9390 timeout = _timeout ,
9491 )
0 commit comments