Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Division by zero error #15

Closed
bmcclure opened this issue Jun 12, 2022 · 1 comment
Closed

Division by zero error #15

bmcclure opened this issue Jun 12, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@bmcclure
Copy link

Describe the bug

When setting up the integration, no entities get added, and in the log I find the error:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/steam_wishlist/sensor.py", line 12, in async_setup_entry
    await hass.data[DOMAIN][config_entry.entry_id].async_register_component(
  File "/config/custom_components/steam_wishlist/sensor_manager.py", line 136, in async_register_component
    await self.coordinator.async_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_refresh
    await self._async_refresh(log_failures=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 270, in _async_refresh
    update_callback()
  File "/config/custom_components/steam_wishlist/sensor_manager.py", line 169, in async_update_items
    steam_game = get_steam_game(game_id, game)
  File "/config/custom_components/steam_wishlist/util.py", line 22, in get_steam_game
    normal_price = round(pricing["price"] / (100 - discount_pct), 2)
ZeroDivisionError: division by zero

To Reproduce
Steps to reproduce the behavior:

  1. Add free games to your wishlist (I assume?)
  2. Attempt to add the Steam Wishlist integration for your account
  3. Check the logs

Expected behavior
I expected the entities to be created related to my wishlist, but instead got this error.

Home Assistant Version:
2022.6.5

Custom Component Version:
2.2.2

Additional context
This used to work fine for me, but I'm thinking maybe I didn't have free games in my wishlist at that time. Now, I use my wishlist to remember some free games that I haven't had a chance to install or play yet, and I'm thinking that is causing a division by 0 in the price math.

@bmcclure bmcclure added the bug Something isn't working label Jun 12, 2022
@boralyl boralyl self-assigned this Jun 12, 2022
@boralyl
Copy link
Owner

boralyl commented Jun 12, 2022

Fixed in v2.2.3, thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants