WattBox Integration

Works better for a single host. Accurately reflects the status of the Wattbox switch. However, when I add a second host, we have problems. What would you like me to try?

If you can turn on the debug logs, if they arenā€™t on.

logger:
  default: info
  logs:
    custom_components.wattbox: debug

You should at least be able to see some log events happening from updates and such. If you can flip a switch back and forth on each of them that would be good too. And if its easier you can hit me up on Discord (Bedon292#4199)

And HACS appears to work for me for it once I got it up and running.

Go to Settings, custom repository: https://github.com/eseglem/hass-wattbox / Integration.

And then its available in integrations.

I have multiple as well but only use one with HA currently. I have an AV company so if you need one at cost lest me know.

Working with hacs and the errors are gone from the log!

Hereā€™s initialization:

2020-05-11 05:19:24 DEBUG (MainThread) [custom_components.wattbox] {'wattbox100': <pywattbox.wattbox.WattBox object at 0x7fe40b6b8750>, 'wattbox101': <pywattbox.wattbox.WattBox object at 0x7fe409675f50>}
2020-05-11 05:19:24 INFO (MainThread) [homeassistant.setup] Setup of domain wattbox took 1.0 seconds.

This is typical of events being logged:

2020-05-11 05:24:25 DEBUG (MainThread) [custom_components.wattbox.switch] Turning Off: Wattbox (http://192.168.3.100:80): WB-700-IPV-12 - Oppo Blu-Ray (7): True
2020-05-11 05:24:26 DEBUG (MainThread) [custom_components.wattbox] Updated: Wattbox (http://192.168.3.100:80): WB-700-IPV-12
2020-05-11 05:24:26 DEBUG (MainThread) [custom_components.wattbox] Updated: Wattbox (http://192.168.3.101:80): WB-700-IPV-12
2020-05-11 05:24:33 DEBUG (MainThread) [custom_components.wattbox] Updated: Wattbox (http://192.168.3.100:80): WB-700-IPV-12
2020-05-11 05:24:33 DEBUG (MainThread) [custom_components.wattbox] Updated: Wattbox (http://192.168.3.101:80): WB-700-IPV-12
2020-05-11 05:24:35 DEBUG (MainThread) [custom_components.wattbox] Updated: Wattbox (http://192.168.3.100:80): WB-700-IPV-12
2020-05-11 05:24:35 DEBUG (MainThread) [custom_components.wattbox] Updated: Wattbox (http://192.168.3.101:80): WB-700-IPV-12
2020-05-11 05:24:49 INFO (MainThread) [engineio.client] Sending packet PING data None
2020-05-11 05:24:49 INFO (MainThread) [engineio.client] Received packet PONG data None
2020-05-11 05:25:01 DEBUG (MainThread) [custom_components.wattbox.switch] Turning Off: Wattbox (http://192.168.3.101:80): WB-700-IPV-12 - SAT 2 (4): True
2020-05-11 05:25:02 DEBUG (MainThread) [custom_components.wattbox.switch] Turning Off: Wattbox (http://192.168.3.101:80): WB-700-IPV-12 - SAT 3 (5): True
2020-05-11 05:25:02 DEBUG (MainThread) [custom_components.wattbox] Updated: Wattbox (http://192.168.3.100:80): WB-700-IPV-12
2020-05-11 05:25:03 DEBUG (MainThread) [custom_components.wattbox] Updated: Wattbox (http://192.168.3.101:80): WB-700-IPV-12
2020-05-11 05:25:03 DEBUG (MainThread) [custom_components.wattbox.switch] Turning Off: Wattbox (http://192.168.3.101:80): WB-700-IPV-12 - SAT 4 (6): True
2020-05-11 05:25:04 DEBUG (MainThread) [custom_components.wattbox] Updated: Wattbox (http://192.168.3.100:80): WB-700-IPV-12
2020-05-11 05:25:04 DEBUG (MainThread) [custom_components.wattbox] Updated: Wattbox (http://192.168.3.101:80): WB-700-IPV-12
2020-05-11 05:25:05 DEBUG (MainThread) [custom_components.wattbox] Updated: Wattbox (http://192.168.3.100:80): WB-700-IPV-12
2020-05-11 05:25:05 DEBUG (MainThread) [custom_components.wattbox] Updated: Wattbox (http://192.168.3.101:80): WB-700-IPV-12

The correct host/switch is being recognized, but the switch returns to On within a few seconds. Switches do not effect the status on the Wattbox, but Wattbox status Off/On is reflected temporarily. Host continue to be linked.

Got it in HACS now. Iā€™ll wait to try it out.

I have a PR in to get the integration into the default repo for HACS as well. Just waiting on a couple more reviews.

I also think I am onto something. I have added a crazy amount of logs locally. And just added mine a second time. Its not really great at seeing whats up, since they are the same thing, so the linking is logical. But seeing something weird in the API itself. So that certainly could be an issue. I will see what I can do to address it and push out an update.

@GaryK Ok, yeah pretty sure I got it fixed now. When I finally found the issue it was completely obvious and something I was looking right over the whole time. I added even more debug logging just in case. You will want to turn the logging down if it is working.

If you have it running in HACS and it isnā€™t offering the update yet. You can go to the top right of the integration in the three dots and ā€˜Update Information.ā€™

Updated through HACS without problems. Functioning much better now. Hosts are no longer linked. However, communications between the Wattbox web server and HA remain problematic. Switch activation from HA is reflected on the Wattbox web page. Not true the other way. I have conflicting states for the Master switch. One Off, one On.

Iā€™ll generate a log file for you tomorrow and post it to discord. Lots of progress on this. Thank you.

I would expect that, some delay if you make a state change in the web server it could take some time to update. Unless you take an action within HA, it could be another ~30s before it updates. This integration just periodically polls the API on the wattbox, and I am not sure the logic on how often it does so.

Ah, no I think I know whats up now. Did some initial testing just now and the data is being updated, but the states in HA are not. It did eventually update while I wrote this. Should be an easy update to update sooner. Though the polling may still be slow.

As for the master switch. I could have the logic wrong for it, but will try to summarize behavior. If you go into the configuration menu on the wattbox, all the outlets have the Master Switch column. The logic should only care about the ones which are enabled. On mine two are disabled 1 and 12. So if ALL (2-11) are ON then Master is ON. If ANY are OFF, then Master if OFF. That may not make sense, but it is what made sense to me. I will look into seeing if there is some sort of other switch I can make it.

I played with the Master Switch settings and you are correct. Disabled switches do not effect the Master Switch setting. The integration works as it should. Switch update behavior is instantaneous HA -> Wattbox, but delayed Wattbox -> HA. Iā€™m seeing the same thing here. Iā€™ll hold off on sending you a log file.

Did some major refactoring and cleanup.
Added scan_interval: 00:00:10 as a config setting. Defaults to 30s, example is 10s. This is how often it will hit the API.
Then did some signal stuff to make it more responsive. The UI will update right at the next scan interval.

I set the scan interval at 5s, hit the switch in the wattbox ui, watched the debug logs and immediately UI was updated as soon as that next scan hit. It is so much nicer now.

Still thinking about how to make the master switch better.

1 Like

Can the master switch just call a reset instead of a power off? I know thatā€™s configurable in the wattbox itself or have an option to set certain plugs to only reset? So they never actually stay powered off.

Well, some good news, and some bad news. It appears scanning is working as expected on Host#2. However, scanning of Host#1 isnā€™t happening.

New code:

2020-05-13 05:53:38 DEBUG (MainThread) [custom_components.wattbox] Updated: Wattbox (http://192.168.3.101:80): WB-700-IPV-12
2020-05-13 05:53:39 DEBUG (MainThread) [custom_components.wattbox] Updated: Wattbox (http://192.168.3.101:80): WB-700-IPV-12
2020-05-13 05:53:49 DEBUG (MainThread) [custom_components.wattbox] Updated: Wattbox (http://192.168.3.101:80): WB-700-IPV-12
2020-05-13 05:53:50 DEBUG (MainThread) [custom_components.wattbox] Updated: Wattbox (http://192.168.3.101:80): WB-700-IPV-12

Yesterdayā€™s code:

2020-05-13 05:59:17 DEBUG (MainThread) [custom_components.wattbox] Updated: Wattbox (http://192.168.3.100:80): WB-700-IPV-12
2020-05-13 05:59:17 DEBUG (MainThread) [custom_components.wattbox] Updated: Wattbox (http://192.168.3.101:80): WB-700-IPV-12
2020-05-13 05:59:47 DEBUG (MainThread) [custom_components.wattbox] Updated: Wattbox (http://192.168.3.100:80): WB-700-IPV-12
2020-05-13 05:59:47 DEBUG (MainThread) [custom_components.wattbox] Updated: Wattbox (http://192.168.3.101:80): WB-700-IPV-12
2020-05-13 05:59:49 DEBUG (MainThread) [custom_components.wattbox] Updated: Wattbox (http://192.168.3.100:80): WB-700-IPV-12
2020-05-13 05:59:49 DEBUG (MainThread) [custom_components.wattbox] Updated: Wattbox (http://192.168.3.101:80): WB-700-IPV-12

Actions on Host#2 occur as described with the exception of the HA switch momentarily toggling before it settles into the correct state. Host#1 HA switch also toggles, but doesnā€™t reach the correct state. Host#1 still effects Wattbox switch status.

Seems to be in much better shape now. And it is now available in the default repo for HACS!

Still thinking about the Master Switch behavior. HA doesnā€™t appear to have a stateless switch type that would make it nice. Where you can just always send the command for on or off at any time. Still thinking about how I could implement something like that.

Any more issues please feel free to submit bugs on github or reach out on discord. https://github.com/eseglem/hass-wattbox

@eseglem The latest implementation is definitely working better. However, I got a new unit (the WB-800-IPVM-12) with a UPS and Iā€™m not getting all of the entities populating. No outlets are showing, and no power values. Is there any info I can give you to help get these things in place? Thanks.

Well, I see the problem. The new unit (800 series) has a new API, so the previous integration no longer works. Hereā€™s the document for the new Integration Protocol: https://www.snapav.com/wcsstore/ExtendedSitesCatalogAssetStore/attachments/documents/PowerManagement/ProtocolsAndDrivers/SnapAV_Wattbox_API_V1.9.pdf

@flippedcracker Interesting. It looks like there should still be a local web interface. The bottom of page 9: https://www.snapav.com/wcsstore/ExtendedSitesCatalogAssetStore/attachments/documents/PowerManagement/ManualsAndGuides/WB-800-IPVM-12_QSG.pdf
That is what I used to control the 700. Based on https://www.snapav.com/wcsstore/ExtendedSitesCatalogAssetStore/attachments/documents/PowerManagement/SupportDocuments/WattBox.WB10.API.v3.0.pdf

Any chance that web interface is the same as the older ones? Or is it totally new?

Unfortunately it doesnā€™t look like there is the new method of connecting on the 700s, so not able to experiment with it any. The only port open on the box is port 80. And sadly not even close to the same protocols. So what I have at https://github.com/eseglem/pywattbox/ is not super relevant. I think it would be possible to make something work so that they both have the same python interface as far as Home Assistant is concerned, but the actual connecting to the box would be different.

@eseglem There is a local web interface. Totally different than the 700 (well, I have the 300, but I think itā€™s similar). Iā€™m totally willing to work with you to get something connected, but understand if itā€™s beyond the scope. Bummer that they changed it so much.