Custom Component: IoTaWatt Energy Monitor integration

I just started putting the integration together and have a little way to go but I wanted to give users access to the code so far.

Steps to install the integration:

  • Install HACS
  • Add this repository to HACS
  • The integration is setup in the UI through ConfigurationIntegrations → Click on the Add Integration button and search for iotawatt
  • Enter a name for the device and the IP Address. See issue below about text not appearing

Entities will then be created for each Input and Output that was created on the device.

Current Limitations/Issues:

  • I didn’t take a screenshot but I did notice in my production HA server when the dialog appears there was no text to indicate which line is for the name and which is for the IP Address. The first line is for the name and the second line is for the IP Address. Closing the dialog and forcing a hard refresh from the browser (Shift-Reload) seemed to fix this
  • Integration does not support Authentication
  • Have only tested with one IoTaWatt device loaded in Home Assistant

I know people have been using the REST interface and templates but I wanted a simple way to add the IoTaWatt and hopefully be dynamic to update Home Assistant when Inputs/Outputs are added/removed/changed on the IoTaWatt device.

Any questions/suggestions/comments are welcomed and appreciated!


Very Nice! Thank you Greg.

I have just tried installing the component and was also getting the blank text issue.


However, after adding a name and ip address all of my Inputs and Outputs are now visible in HA. Nice work!

Thanks for building this!

I made a clumsy fork of the code into a new repo that can be installed with HACS

Looks like its working pretty well so far but the device registry might not be working properly since the entities aren’t editable and don’t display as children of the integration.

integrations screenshot

@panctronic I’m glad it works for you! It was quickly built as really a proof of concept. Now I need to start implementing beyond the bare minimum :tired_face: It shouldn’t be too bad but I’m still learning beyond my basic coding skills.

So to add it through HACS all someone has to do is add the Git repo to HACS?

@gregtd Basic documentation is here for being a HACS developer

With the structure in my repository (copying the iotawatt directory you created into a custom_components subdirectory) the bare minimum requirements are met. I was able to install this repository into two of my hassio installations by adding the github url as a custom repository

1 Like

Hi, installed it works great thanks.
A couple of odd issues to work out, get this message on looking at the settings

@timbailey99 Thank you!

I have added support for Authentication and Unique ID.

I really want to hide the Username/Password fields as I don’t think too many people enable Authentication for the IoTaWatt. But for now the fields are shown and are optional and can be blank

With the Unique ID being implemented you can now see the Settings tab

The updated files are located in GitHub

Thanks.I pulled down the latest files and uploaded, now I get this error, checking into it…

Logger: homeassistant.config_entries
Source: custom_components/iotawatt/
First occurred: 11:15:57 (1 occurrences)
Last logged: 11:15:57

Error setting up entry Name of the device for iotawatt
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/", line 236, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/config/custom_components/iotawatt/", line 31, in async_setup_entry["username"],
KeyError: 'username'

@timbailey99 You might have to remove and re-add the Integration

Snap, yes just about to post that’s what I did, and all working now.

Great work

1 Like

Hi Greg,

I am having same problem as Tim, but a remove/add cycle is not solving it… any other suggestion? Any setup required on iotawatt 's side?

I used the rest sensor in the past but your custom components should be definitely more practical.


Hi Guido

Do you have any Home Assistant logs?

What would make this more practical? Do you have any code changes you can make as it’s in GitHub?


Hi Greg,

See below what I can capture in the log. From my side I would not know what to modify, I am not such an advanced user…
I am running HA 0.118.4 on a Raspberry Pi 4, hassos 5.5, with SSD install.


Logger: homeassistant.config_entries
Source: custom_components/iotawatt/
First occurred: 10 January 2021, 21:46:04 (3 occurrences)
Last logged: 14:31:46

Error setting up entry IotaWatt for iotawatt
Error setting up entry iotawatt for iotawatt
Error setting up entry iota for iotawatt
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/", line 236, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/config/custom_components/iotawatt/", line 52, in async_setup_entry["username"],
KeyError: 'username'

Hello Greg,
I am also attempting to install the files, but not getting the expected results. I have 2 IoTaWatt base units monitoring 22 CTs.

Followed the instructions you listed in the first comment (i.e. - create iotawatt directory, copy files, restart, …) but the integration does not appear. I do not see anything listed in the logs. Also, using the HA Terminal, I have tried to run a “pip install iotawatttpy.” I see some files were created under the “/usr/lib/python3.8/site-packages” directory, but no integration appears. Restarted multiple times. Running the latest version.

Was wondering if I missed a step? Thank you.

I was wondering if the iotawatt integration is still being developed. I finally got the files to load in HA and configured the name and IP in settings and it was successful but no entities were created. Thank you!!

@gregtd - set this up yesterday and it works great! Any interest in getting it added to HA as a core integration? I’d be willing to help get it submitted to core if necessary :smiley:

1 Like

I just bought all the iotawatt gear, count me in for testing.

Today I restarted Home Assistant without having done any updates (I updated the Grafana plugin and Google Home integration but not HA) and the integration failed with an error. I restarted multiple times and each time it failed with:

2021-04-03 19:18:38 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry iotawatt for iotawatt
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/", line 248, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/config/custom_components/iotawatt/", line 35, in async_setup_entry
    await iotawatt.update()
  File "/usr/local/lib/python3.8/site-packages/iotawattpy/", line 45, in update
    await self._createSensors()
  File "/usr/local/lib/python3.8/site-packages/iotawattpy/", line 56, in _createSensors
    results = response.text
AttributeError: 'NoneType' object has no attribute 'text'

Does anyone have any idea what is going on?

Actually, it’s possible my IoTaWatt may have died as I can’t find it on the network.
It’s only a few months old :frowning:

For what it’s worth I found the fault to be a wifi repeater having crashed,

1 Like