Skip to content

Commit

Permalink
new attribute category
Browse files Browse the repository at this point in the history
  • Loading branch information
FaserF committed Sep 22, 2022
1 parent 8f223de commit f7557dd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions custom_components/rewe/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
ATTR_BASE_PRICE,
ATTR_PICTURE,
ATTR_VALID_DATE,
ATTR_CATEGORY,

DOMAIN,
)
Expand Down Expand Up @@ -103,7 +104,7 @@ def state(self) -> Optional[str]:
@property
def unit_of_measurement(self):
"""Return unit of measurement."""
return "date"
return "items"

@property
def session(self):
Expand Down Expand Up @@ -159,7 +160,7 @@ async def async_update(self):
discounts = []
n = 0
for category in data['categories']:
_LOGGER.debug(f"Processing category: '{category}")
_LOGGER.debug(f"Processing category: '{category['title']}")
if 'PAYBACK' in category['title']: # ignore payback offers
n += 1
continue
Expand All @@ -175,6 +176,7 @@ async def async_update(self):
ATTR_DISCOUNT_PRICE: item['priceData'],
#ATTR_BASE_PRICE: item['subtitle']
ATTR_PICTURE: item['images'],
ATTR_CATEGORY: category['title']
}
)
n += 1
Expand Down

0 comments on commit f7557dd

Please sign in to comment.