Skip to content

Commit

Permalink
Merge pull request #5 from XeRiZeR/main
Browse files Browse the repository at this point in the history
Update sensor.py
  • Loading branch information
DurgNomis-drol authored Nov 25, 2023
2 parents 7dc2757 + 6b771db commit 81efff9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions custom_components/dmi_pollen/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.helpers.entity import Entity
import homeassistant.helpers.config_validation as cv
from homeassistant.const import STATE_UNKNOWN, STATE_ON, STATE_OFF
import json
import requests
import xmltodict
import voluptuous as vol
import logging
from datetime import timedelta
from http import HTTPStatus

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -106,7 +106,7 @@ def icon(self):
return ICON

@property
def extra_state_attributes(self):
def device_state_attributes(self):
"""Return the state attributes."""
attributes = dict(self.data.readings[self.city])
attributes.update({JSON_FORECAST: self.data.forecasts[self.city]})
Expand Down Expand Up @@ -152,7 +152,7 @@ def convert_xml_to_json(xml):
def request_new_data(endpoint):
response = requests.get(endpoint)

if response.status_code != 200:
if response.status_code != HTTPStatus.OK:
_LOGGER.error("Error fetching data. Status code: {code} with text: {text}".format(
code=response.status_code,
text=response
Expand Down

0 comments on commit 81efff9

Please sign in to comment.