ryanmac8 / HA-Mint-Mobile

Mint Mobile Integration for Data Usage Monitoring
MIT License
8 stars 4 forks source link

Error while setting up mintmobile platform for sensor #5

Closed FoxxMD closed 3 years ago

FoxxMD commented 3 years ago

Describe the bug After configuring the integration through the UI I hit finish (with no errors). The integration does not show any entities/devices. In the logs I found this:

Error while setting up mintmobile platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 199, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/mintmobile/sensor.py", line 27, in async_setup_entry
    lines = await hass.async_add_executor_job(mm.lines)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/mintmobile/api.py", line 124, in lines
    self.get_family_members()
  File "/config/custom_components/mintmobile/api.py", line 85, in get_family_members
    for activeMembers in response["activeMembers"]:
KeyError: 'activeMembers'

I do not have mint family setup.

To Reproduce Steps to reproduce the behavior:

  1. Try to configure a new integration (installed through hacs)

Version: HA 2020.12.0

ryanmac8 commented 3 years ago

I'll take another look at that section and push out a new version some time today.

ryanmac8 commented 3 years ago

@FoxxMD Just released v1.4 that should hopefully fix the issue you were seeing. Please let me know as I don't have a single account to test with.

FoxxMD commented 3 years ago

Updated to 1.4 still getting a similar. I restarted HA after the HACS install. then tried reloading the integration, then removing and re-adding it. Same error all three times.

2020-12-22 23:11:59 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up mintmobile platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 199, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/mintmobile/sensor.py", line 27, in async_setup_entry
lines = await hass.async_add_executor_job(mm.lines)
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/mintmobile/api.py", line 130, in lines
self.get_family_members()
File "/config/custom_components/mintmobile/api.py", line 88, in get_family_members
if response["activeMembers"]:
KeyError: 'activeMembers'
ryanmac8 commented 3 years ago

Interesting. Let me add a few more items to my debugging script as that will help me identify what response you are getting back from their API. I figured it would just be an empty object but that doesn't seem like the case.

Codel1417 commented 3 years ago

image Same, HA: 2020.12.7 Home Assistant OS: 5.8, Version 1.4 Installed via hacs

ryanmac8 commented 3 years ago

@Codel1417 @FoxxMD Try v1.4.1 as it should be fixed. I was able to get credentials for a single account to test with and was able to replicate the issue myself this time around.

FoxxMD commented 3 years ago

Fixed it for me! thanks