custom-components / weatheralerts

A sensor that gives you weather alerts from alerts.weather.gov.
MIT License
125 stars 15 forks source link

Error while setting up platform weatheralerts #5

Closed bru73f0rc3 closed 5 years ago

bru73f0rc3 commented 5 years ago

Version of the cusom_component

weatheralerts.py - _version = '0.0.3' HA 0.76.2

Describe the bug Error while setting up platform weatheralerts: File "/config/deps/lib/python3.6/site-packages/weatheralerts/geo.py", line 75, in _get_states_from_samecodes state = self.samecodes[code]['state'] TypeError: 'NoneType' object is not subscriptable

sameid: '027053'

log

2018-08-29 04:13:27 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.weatheralerts
2018-08-29 04:13:27 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform weatheralerts
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 129, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/sensor/weatheralerts.py", line 38, in setup_platform
    add_devices([WeatherAlertsSensor(sameid)])
  File "/config/custom_components/sensor/weatheralerts.py", line 43, in __init__
    self.update()
  File "/config/custom_components/sensor/weatheralerts.py", line 47, in update
    nws = WeatherAlerts(samecodes=self._sameid)
  File "/config/deps/lib/python3.6/site-packages/weatheralerts/weather_alerts.py", line 43, in __init__
    self.scope = self.geo.getfeedscope(self.samecodes)
  File "/config/deps/lib/python3.6/site-packages/weatheralerts/geo.py", line 59, in getfeedscope
    states = self._get_states_from_samecodes(geocodes)
  File "/config/deps/lib/python3.6/site-packages/weatheralerts/geo.py", line 75, in _get_states_from_samecodes
    state = self.samecodes[code]['state']
TypeError: 'NoneType' object is not subscriptable
stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

rotcop4u2 commented 5 years ago

I got this issue also. Try coping the new weatheralerts.py and if that doesn't correct it, try a different "sameid" that covers your area that has the same call sign.

fortepc commented 5 years ago

Getting the same issue with the current version of weatheralerts.py, trying to pull in Charlotte NC Mecklenburg County

Error while setting up platform weatheralerts
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/sensor/weatheralerts.py", line 38, in setup_platform
    add_devices([WeatherAlertsSensor(sameid)])
  File "/config/custom_components/sensor/weatheralerts.py", line 43, in __init__
    self.update()
  File "/config/custom_components/sensor/weatheralerts.py", line 47, in update
    nws = WeatherAlerts(samecodes=self._sameid)
  File "/config/deps/lib/python3.6/site-packages/weatheralerts/weather_alerts.py", line 43, in __init__
    self.scope = self.geo.getfeedscope(self.samecodes)
  File "/config/deps/lib/python3.6/site-packages/weatheralerts/geo.py", line 59, in getfeedscope
    states = self._get_states_from_samecodes(geocodes)
  File "/config/deps/lib/python3.6/site-packages/weatheralerts/geo.py", line 75, in _get_states_from_samecodes
    state = self.samecodes[code]['state']
TypeError: 'NoneType' object is not subscriptable

Not sure if my log will be useful or not..

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

fortepc commented 5 years ago

I am still having this issue.

ludeeus commented 5 years ago

Which sameid are you using @fortepc ?

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

jazzyisj commented 5 years ago

Same issue here. Have tried a couple diffrent sameid's . Using latest version of the sensor.py file (0.0.3)

CONFIG

  - platform: weatheralerts
    sameid: '026163'

LOG ERROR

2019-01-30 13:23:43 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform weatheralerts
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/weatheralerts/sensor.py", line 39, in setup_platform
    add_devices([WeatherAlertsSensor(sameid)])
  File "/config/custom_components/weatheralerts/sensor.py", line 44, in __init__
    self.update()
  File "/config/custom_components/weatheralerts/sensor.py", line 48, in update
    nws = WeatherAlerts(samecodes=self._sameid)
  File "/config/deps/lib/python3.6/site-packages/weatheralerts/weather_alerts.py", line 43, in __init__
    self.scope = self.geo.getfeedscope(self.samecodes)
  File "/config/deps/lib/python3.6/site-packages/weatheralerts/geo.py", line 59, in getfeedscope
    states = self._get_states_from_samecodes(geocodes)
  File "/config/deps/lib/python3.6/site-packages/weatheralerts/geo.py", line 75, in _get_states_from_samecodes
    state = self.samecodes[code]['state']
TypeError: 'NoneType' object is not subscriptable
ludeeus commented 5 years ago

As I just wrote in #12 this is unstable, try again, your 026163 also works