IoTaWatt Stopped Working in HA and Integration Now Fails

I have had an IoTaWatt Home Assistant installation operating fine for a couple of months. A few days ago the IoTaWatt stopped getting data so all the values show “Unavailable”.
No changes occurred in HA or the IotaWatt in that time period. The RSSI is -59dB and the IP is fixed.
I can see the IoTaWatt device with the ioTawatt.local command on my network and all looks good there.
In HA in the IoTaWatt Integration box it says "Retrying setup: ‘NoneType’ object has no attribute ‘status_code’ ".
If I uninstall the IoTaWatt Integration and try to reinstall it I get “Unexpected error” message in the IoTaWatt host box for HA.
I have a second IoTaWatt which I have not installed yet but did set it up and when I try to install this in HA as in integration I get the same message “Unexpected error”.
I have rebooted HA, restarted HA, power cycled the IoTaWatt, and rebooted the IoTaWatt multiple times again to no avail. I restored HA from a backup still with the same negative results.

My HA core and supervisor are versions 2022.3.3.

This seems like an issue with the IoTaWatt HA Integration as it will not complete the installation of a new IoTaWatt or if I uninstall the current installation it will not complete a reinstall of that device.
Currently no data can be received from a previously install IoTaWatt.
It seems like the IoTaWatt Integration is broken.

Any help or ideas appreciated.

Thanks

Nothing in the HA logs?

Is the iotawatt clock set correctly?

Have a read of this issue, it has some debugging tips:

1 Like

These reoccur in the log.

Log Entries

2022-03-12 09:02:16 ERROR (MainThread) [iotawattpy.connection] Err: [Errno -2] Name does not resolve
2022-03-12 09:02:16 ERROR (MainThread) [homeassistant.components.iotawatt.coordinator] Unexpected error fetching iotaup.local data: 'NoneType' object has no attribute 'status_code'
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 "/usr/src/homeassistant/homeassistant/components/iotawatt/coordinator.py", line 67, in _async_update_data
is_authenticated = await api.connect()
File "/usr/local/lib/python3.9/site-packages/iotawattpy/iotawatt.py", line 48, in connect
if results.status_code == httpx.codes.OK:
AttributeError: 'NoneType' object has no attribute 'status_code'

It is saying the name does not resolve but it does if I put it in a browser it finds it without issue.

Thanks

There is some discrepancy, here

Is the iotawatt clock set correctly?

Yes it is I did check that

Name does not resolve
error fetching iotaup.local

There is some discrepancy, here

Yes there is something odd
.
I just tried the HA Integration and I used the IP address of the IoTaWatt and now it did find it.
I had tried that before and it did not work but I did restore from a backup after that attempt.
So for some reason HA is not resolving the iotawatt.local address when it did before but the direct IP is working.
As previously stated browsers can resolve the iotawatt.local without issue.

Not sure how to troubleshoot the name resolution issue but at least the IP allows it to work.
Any suggestions on how to troubleshoot the iotawatt.local not resolving?

Thanks

You had iotaup.local in your setup, for whatever reason

Did you actually try with ioTawatt.local?

koyingChris B

You had iotaup.local in your setup, for whatever reason

Did you actually try with ioTawatt.local?

I had renamed the device because ultimately I will have more than one but yes I did try the original name to no avail.

It seems like the .local addressing is shaky in HA since it seems to be the only thing that cannot resolve it.
During my troubleshooting and debug I had rebooted all routers to try and rule that out but that still did not correct the .local addressing issue.
Only the direct IP address works in HA now although the .local did up until a few days ago.

Thanks

I think there might be a DNS issue with the latest supervisor release. There’s certainly plenty else wrong with it.

My advice would be to assign static or DHCP reserved IP addresses and use them for all your IoT devices.

Is this on supervised or HAOS?
Iirc, there is a new dependency on systemd-resolved for supervised, so something definitely changed here…

Normally I use an assigned IP address on all my devices but this originally was the one exception.
Now as I previously stated I moved the IoTaWatt to its assigned IP address in the HA Integration and it is working fine so it is more of academic interest as to why it stopped working with the local address this week as it had been working with the local address for many months.

I am using HAOS running under VirtualBox in Windows.

Just has the same problem on a Pi4. Seems that mdns has stopped working. Can’t connect to any of my esphome devices now, either.

I just hit this too upgrading from 2022.2.2 to 2022.3.6 and the supervised OS to 7.5.
I didn’t notice any breaking change comments in the release notes.

Ok, I’m confused how to work around the mdns problem. Where can I update the iotawatt address to the numerical ip address?
I’ve typically used iotawatt.local.
I don’t have any iotawatt host name or address specified I configuration.yaml. I don’t see any host name type entry in the integration gui settings either. I don’t have to delete and read the integration do I ?

Have you found the way? I am in the same situation, I went around in all config files but cannot find any ip address to change. My iotawatt changed IP after a reboot and my stupid modem does not allow me to reserve a fix IP.

Thanks
Guido

Found it: the ip address is within the core.config_entries file that can be found in /config/.storage

:wink:

2 Likes

I think the problem is related to timeouts in httpx as used by the client library. Sometimes iotawatt takes more than the default 5s. Will debug this…

1 Like

I just encountered this issue today. I upgraded from HA OS 9.0 to 9.3 and 2022.9.x to 2022.10.5 and am now getting the error Retrying setup: 'NoneType' object has no attribute 'status_code'. I am running local DNS with my pihole.

Edit - not sure how upgrading broke it, but there was an issue with my DHCP/DNS setup that I got sorted out. All is well for me now.

Similar issue to this one. I’m helping a friend who has two Iotawatts installed. One works fine (installed some time ago), yesterday we installed the new one and this gives this error in the log:

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

Could this be related to the second Iotawatt?

I experienced this exact same problem and I don’t know how to resolve. Looking for some help.

The integration loaded OK to begin with, then a day later it died, all the sensors became unavailable.

I don’t know why it died. My Iotawatt communicates just fine via it’s own system, has good Wi-Fi signal (RSSI of -55 give or take).

So I deleted it and tried reloading but it refuses to load the integration.

Screen Shot 2023-03-23 at 11.46.06 am

or if I enter the static IP address assigned to the unit instead of http://iotawatt.local I get the same thing.

HA log shows this:

Unexpected exception
11:43:56 AM – (ERROR) IoTaWatt - message first occurred at March 22, 2023 at 9:12:25 PM and shows up 5 times
Err: [Errno -2] Name does not resolve
11:43:56 AM – (ERROR) components/iotawatt/config_flow.py - message first occurred at March 22, 2023 at 9:12:25 PM and shows up 5 times

Any thoughts on how to get this working?

Thanks.