Skip to content

Commit

Permalink
Change scan interval to 5 minutes and check for null in bodylinks
Browse files Browse the repository at this point in the history
  • Loading branch information
Isabella Gross Alström committed Jan 23, 2019
1 parent fcf7a4b commit 98bbc68
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions custom_components/sensor/krisinformation.py
Expand Up @@ -33,13 +33,13 @@
import homeassistant.util.dt as dt_util
from homeassistant.components.sensor.rest import RestData

__version__ = '0.0.4'
__version__ = '0.0.5'

_LOGGER = logging.getLogger(__name__)

DEFAULT_NAME = 'Krisinformation'

SCAN_INTERVAL = timedelta(minutes=1)
SCAN_INTERVAL = timedelta(minutes=5)

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
Expand Down Expand Up @@ -167,10 +167,10 @@ def make_object(self, index, element):
message['Event'] = element['Event']
message['SenderName'] = element['SenderName']
message['Links'] = []
for numbers, link in enumerate(element['BodyLinks']):
message['Links'].append(link['Url'])
if element['BodyLinks'] is not None:
for numbers, link in enumerate(element['BodyLinks']):
message['Links'].append(link['Url'])
message['SourceID'] = element['SourceID']
# _LOGGER.error(message)

self.attributes["messages"].append(message)
if element['Event'] == "Alert":
Expand Down

0 comments on commit 98bbc68

Please sign in to comment.