diff --git a/homeassistant/components/sensor/yr.py b/homeassistant/components/sensor/yr.py index ef12ba392e1..7da72b6fd38 100644 --- a/homeassistant/components/sensor/yr.py +++ b/homeassistant/components/sensor/yr.py @@ -82,8 +82,9 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None): weather = YrData(hass, coordinates, dev) # Update weather on the hour, spread seconds - async_track_utc_time_change(hass, weather.async_update, minute=0, - second=randrange(5, 25)) + async_track_utc_time_change(hass, weather.async_update, + minute=randrange(1, 10), + second=randrange(0, 59)) yield from weather.async_update() @@ -139,7 +140,8 @@ class YrData(object): def __init__(self, hass, coordinates, devices): """Initialize the data object.""" - self._url = 'http://api.yr.no/weatherapi/locationforecast/1.9/' + self._url = 'https://aa015h6buqvih86i1.api.met.no/'\ + 'weatherapi/locationforecast/1.9/' self._urlparams = coordinates self._nextrun = None self.devices = devices diff --git a/tests/components/sensor/test_yr.py b/tests/components/sensor/test_yr.py index 8d54037a379..d0504db963c 100644 --- a/tests/components/sensor/test_yr.py +++ b/tests/components/sensor/test_yr.py @@ -14,7 +14,8 @@ NOW = datetime(2016, 6, 9, 1, tzinfo=dt_util.UTC) @asyncio.coroutine def test_default_setup(hass, aioclient_mock): """Test the default setup.""" - aioclient_mock.get('http://api.yr.no/weatherapi/locationforecast/1.9/', + aioclient_mock.get('https://aa015h6buqvih86i1.api.met.no/' + 'weatherapi/locationforecast/1.9/', text=load_fixture('yr.no.json')) config = {'platform': 'yr', 'elevation': 0} @@ -32,7 +33,8 @@ def test_default_setup(hass, aioclient_mock): @asyncio.coroutine def test_custom_setup(hass, aioclient_mock): """Test a custom setup.""" - aioclient_mock.get('http://api.yr.no/weatherapi/locationforecast/1.9/', + aioclient_mock.get('https://aa015h6buqvih86i1.api.met.no/' + 'weatherapi/locationforecast/1.9/', text=load_fixture('yr.no.json')) config = {'platform': 'yr',