WattBox Integration

So, I’ve finally gotten around to installing this. I’m also seeing that the switches are linked between multiple units. Interesting behavior I’ve seen: While on the dev-states page, the names set in the wattbox configuration are shown but are linked. The interesting part is that while sitting on that page, I’ve seen the names change from one device to the other, and back. Meaning the names showing were from one device, then something updated and they all switched to the second device, and after an undetermined amount of time, switched back. Not sure what that means, just something I saw.

Sorry, been super busy the last couple weeks, haven’t gotten much time to look at this. I honestly cannot think of a reason for this happening. Looked over the code a few times even. Somewhere they have to be getting flip-flopped but I cannot figure out where or how. I am kind of at a loss as to what to do next.

Getting this error recently:

2019-07-18 16:45:36 ERROR (MainThread) [homeassistant.setup] Error during setup of component wattbox
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 153, in _async_setup_component
    hass, processed_config)
  File "/config/custom_components/wattbox/__init__.py", line 69, in async_setup
    from pywattbox import WattBox
ModuleNotFoundError: No module named 'pywattbox'

Any ideas?

How do you install this? I placed items in the custom_components folder but i get a error

It’s broken. We’re all hoping someone will fix it.

Got it running for a single host on Hassio/HA 0.101.2. Use the following **manifest.json**

{
  "domain": "wattbox",
  "name": "hass-wattbox",
  "documentation": "https://github.com/eseglem/hass-wattbox",
  "dependencies": [],
  "codeowners": [],
  "requirements": [
    "pywattbox>=0.2.0"
  ]
}
2 Likes

Garyk you added a file named manifest.json and put that info in? Also file directory look ok?

image

Yes. Add the above manifest.json file to the wattbox directory. Other than dates, my files are dated one day later, directory structure looks good.

I am getting the error.


image

I got it! had to comment out config. Reboot, enable config. Reboot again. Everything is prefect now. Thank you!!!

updated to 0.109.0 and am getting I/O errors

Log Details (WARNING)
Logger: homeassistant.util.async_
Source: util/async_.py:120
First occurred: 11:50:42 AM (34 occurrences)
Last logged: 12:05:42 PM

Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for wattbox doing I/O at custom_components/wattbox/__init__.py, line 90: hass.data[DOMAIN_DATA][name] = WattBox(host, port, username, password)
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for xboxone doing I/O at custom_components/xboxone/media_player.py, line 94: return requests.get(full_url, *args, **kwargs)
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for wattbox doing I/O at custom_components/wattbox/__init__.py, line 108: hass.data[DOMAIN_DATA][name].update()

Let’s hope @eseglem will make the necessary changes for 109.

Sorry, haven’t touched HA in a while. But will look into it. If anyone else is any good at these integrations I definitely wouldn’t mind some assistance.

@eseglem Thank you. I know there is a developer channel on discord that may be of help.

Going through a bunch of stuff to update to the latest formats and hopefully work with HACS as well. I think I have what I need to at least get it to stop with the warning. I still want to update pywattbox to be async, but that still messes with my head.

I am still trying to comb through the code and figure out why it acts weird with two of them. I have to be messing up a variable or something, I don’t know where though.

Wish I had a second one to play with and debug. But not something I really have a need for at this point.

I’m here to test multiple hosts when you’re ready.

Pushed v0.2.1 to github. It appears to be working again with no more warnings in 109.

I just wrapped the sync calls in their executor function for the time being. I will need to go back to update the actual library to be async, but this at least will help things out a bit. Also updated to BinarySensorEntity and SwithEntity instead of Devices like they were before, which also threw some warnings.

Added a couple more debug logs. Not sure they will be enough, but might lead somewhere on the issue with multiple.

I also added in the .devcontainer stuff from the latest blueprint. So depending on how comfortable you are with VSCode and Containers, that should be an option to test with. Its how I got to where it is now.

It may be usable with HACS, but haven’t tested that part yet. Just included the file so far. So if anyone uses that and wants to test, that would be cool too.

Edit: Potential bug in v0.2.0. Made a fix, and changed the update function to hopefully perform better for multiple.

I’m seeing this on 109.6:

2020-05-10 14:16:48 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform wattbox.binary_sensor: Platform not found (cannot import name 'BinarySensorEntity' from 'homeassistant.components.binary_sensor' (/usr/src/homeassistant/homeassistant/components/binary_sensor/__init__.py)).
2020-05-10 14:16:48 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform wattbox.switch: Platform not found (cannot import name 'SwitchEntity' from 'homeassistant.components.switch' (/usr/src/homeassistant/homeassistant/components/switch/__init__.py)).

config:

wattbox:
- host: !secret wattbox100_ip
  username: !secret it_user
  password: !secret it_psswd
  name: wattbox100
  resources:
  - current_value
  - power_value
  - voltage_value

The resource sensors do appear in the states listing.

On HACS, this error occurs when attempting to add your repository:

**Exception:** HacsException
**Message:** GitHub returned 404 for https://api.github.com/repos/repos/eseglem/hass-wattbox
Could not add this repository, make sure it is compliant with HACS.

Jumped the gun on that one I think. Was dev’ing against the latest dev version and addressed some deprecation warnings from it, apparently breaking 109 in the process. Think I rolled those changes back. Let me know if that works a little better @GaryK

Not sure on the HACS part. Looking into it now, thanks for trying at least.