custom_components/nea_sg_weather/__init__.py
async def async_update(self) -> NeaData:
        """Get the latest data from NEA API for entities registered."""
        # Consolidate data requests to avoid redundant requests
        self.data = self.NeaData()
        _data_objects = list()
        _response = dict()
        if self._config_entry.data[CONF_WEATHER]:
            _data_objects += [
                self.data.forecast2hr,
                self.data.forecast24hr,
                self.data.forecast4day,
                self.data.temperature,
                self.data.humidity,
                self.data.wind,
                self.data.rain,
            ]
        else:
            if self._config_entry.data[CONF_SENSORS].get(CONF_AREAS, ["None"]) != [
                "None"
            ]:
                _data_objects += [self.data.forecast2hr]
            if self._config_entry.data[CONF_SENSORS].get(CONF_REGION, False):
                _data_objects += [self.data.forecast24hr]
        _data_objects = set(_data_objects)

        for data_object in _data_objects:
            await data_object.async_init()
            _response[data_object.__class__.__name__] = data_object.response

        # _LOGGER.debug("Data is: %s", _response)
        _LOGGER.debug("Coordinator was updated at %s", self.data.query_time)
        return self.data
Get the latest data from NEA API for entities registered.
Get the latest data from NEA API for entities registered.
Get the latest data from NEA API for entities registered .
async def async_update(self) -> NeaData:
        self.data = self.NeaData()
        _data_objects = list()
        _response = dict()
        if self._config_entry.data[CONF_WEATHER]:
            _data_objects += [
                self.data.forecast2hr,
                self.data.forecast24hr,
                self.data.forecast4day,
                self.data.temperature,
                self.data.humidity,
                self.data.wind,
                self.data.rain,
            ]
        else:
            if self._config_entry.data[CONF_SENSORS].get(CONF_AREAS, ["None"]) != [
                "None"
            ]:
                _data_objects += [self.data.forecast2hr]
            if self._config_entry.data[CONF_SENSORS].get(CONF_REGION, False):
                _data_objects += [self.data.forecast24hr]
        _data_objects = set(_data_objects)
        for data_object in _data_objects:
            await data_object.async_init()
            _response[data_object.__class__.__name__] = data_object.response
        _LOGGER.debug("Coordinator was updated at %s", self.data.query_time)
        return self.data
async def async_update ( self ) -> NeaData : self . data = self . NeaData ( ) _data_objects = list ( ) _response = dict ( ) if self . _config_entry . data [ CONF_WEATHER ] : _data_objects += [ self . data . forecast2hr , self . data . forecast24hr , self . data . forecast4day , self . data . temperature , self . data . humidity , self . data . wind , self . data . rain , ] else : if self . _config_entry . data [ CONF_SENSORS ] . get ( CONF_AREAS , [ "None" ] ) != [ "None" ] : _data_objects += [ self . data . forecast2hr ] if self . _config_entry . data [ CONF_SENSORS ] . get ( CONF_REGION , False ) : _data_objects += [ self . data . forecast24hr ] _data_objects = set ( _data_objects ) for data_object in _data_objects : await data_object . async_init ( ) _response [ data_object . __class__ . __name__ ] = data_object . response _LOGGER . debug ( "Coordinator was updated at %s" , self . data . query_time ) return self . data
Get the latest data from NEA API for entities registered.
Get the latest data from NEA API for entities registered .
"""Get the latest data from NEA API for entities registered.""" # Consolidate data requests to avoid redundant requests # _LOGGER.debug("Data is: %s", _response)
self