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

AttributeError: 'NoneType' object has no attribute 'text' #6

Open
kocsenc opened this issue Aug 8, 2021 · 12 comments
Open

AttributeError: 'NoneType' object has no attribute 'text' #6

kocsenc opened this issue Aug 8, 2021 · 12 comments

Comments

@kocsenc
Copy link

kocsenc commented Aug 8, 2021

I installed and try to run iotawatt HACS custom component for Home Assistant and I'm running into the following issue. @gtdiehl asked me on the issue on the other repo to open the issue here too:

Logger: custom_components.iotawatt
Source: custom_components/iotawatt/init.py:106
Integration: iotawatt
First occurred: August 2, 2021, 10:48:17 PM (2400 occurrences)
Last logged: 6:52:41 PM
Unexpected error fetching IoTaWatt data: 'NoneType' object has no attribute 'text'

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh
    self.data = await self._async_update_data()
  File "/config/custom_components/iotawatt/__init__.py", line 106, in _async_update_data
    await self.api.update()
  File "/usr/local/lib/python3.9/site-packages/iotawattpy/iotawatt.py", line 67, in update
    await self._createSensors()
  File "/usr/local/lib/python3.9/site-packages/iotawattpy/iotawatt.py", line 81, in _createSensors
    results = response.text
AttributeError: 'NoneType' object has no attribute 'text'
@jyavenard
Copy link
Contributor

I see this when the iotawatt stops responding from time to time. This indicates connectivity issue.

@kocsenc
Copy link
Author

kocsenc commented Aug 26, 2021

So I’ve updated since then and used the IP instead of the mDNS hostname and has been working fine. I want to say it’s closed but maybe the error message could be better. ¯_(ツ)_/¯

@gtdiehl
Copy link
Owner

gtdiehl commented Aug 27, 2021

I would say this is still an issue. Some sort of retry should be inplace.

@OzGav
Copy link

OzGav commented Oct 14, 2021

Any further updates on this? I am trying to get through all the errors in my logs and IotaWatt's ungraceful handling of connectivity issues is the highest on my list...? Log entries i added over here gtdiehl/iotawatt_ha#7

@RJ
Copy link

RJ commented Jun 16, 2022

I'm seeing this fairly often in home assistant too. I can hit http://iotawatt-ip/status?inputs=yes&outputs=yes fine repeatedly in my browser, and constantly pinging the iotawatt seems stable - no packet loss.

Annoying because HA shows the sensors as Unavailable until the next polling cycle when this happens.

Willing to try stuff / debug if anyone has any suggestions. thanks.

@mlepard
Copy link

mlepard commented Aug 5, 2022

I'm also seeing this issue with my newly setup IotaWatt.
Wifi connectivity shouldn't be an issue as it's pretty close to the router. RSSI shows -77 on the IotaWatt.

Running the latest August version of HA.

Did anybody find any solutions?

@lyricnz
Copy link

lyricnz commented Sep 17, 2022

I have the same error, but example.py works fine with both git-head and 0.1.0 release from PyPI

Digging...

@lyricnz
Copy link

lyricnz commented Sep 17, 2022

Added a dummy input (no CT actually connected yet). Changed logging to debug, restarted HA, and it seems to be working

logger:
    default: info
    logs:
      # homeassistant.components.automation.send_to_pvoutput: debug
      # homeassistant.components.rest_command: debug
      homeassistant.components.iotawatt: debug

output

2022-09-17 11:18:17.526 DEBUG (MainThread) [homeassistant.components.iotawatt.coordinator] Finished fetching 192.168.30.77 data in 0.525 seconds (success: True)
2022-09-17 11:18:47.528 DEBUG (MainThread) [homeassistant.components.iotawatt.coordinator] Finished fetching 192.168.30.77 data in 0.528 seconds (success: True)

@mikey0000
Copy link

I might add this bug throws the energy tracker in HA off and it stops working. I end up restarting HA after restarting iotawatt to fix it.

@skyemoor
Copy link

@mikey0000 , does that just happen once and then everything is stable, or is it an intermittent problem?

@mikey0000
Copy link

mikey0000 commented Dec 28, 2022 via email

@mikey0000
Copy link

Also got this one recently too, though this may be a HA issue

Unexpected error fetching 192.168.1.25 data: list index out of range
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/lib/python3.10/site-packages/homeassistant/components/iotawatt/coordinator.py", line 76, in _async_update_data
    await self.api.update(lastUpdate=self._last_run)
  File "/usr/lib/python3.10/site-packages/iotawattpy/iotawatt.py", line 76, in update
    await self._refreshSensors(timespan, lastUpdate)
  File "/usr/lib/python3.10/site-packages/iotawattpy/iotawatt.py", line 264, in _refreshSensors
    sensor.setValue(values[0][idx + 1])
IndexError: list index out of range

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants