bhyve-home-assistant icon indicating copy to clipboard operation
bhyve-home-assistant copied to clipboard

B-hyve integration doesn't work correct with unnamed devices or zones

Open ObiWanCanOweMe opened this issue 1 year ago • 10 comments

Describe the bug The integration is unable to create any switch entities

Expected behaviour At least one switch entity should be created for my zone

BHyve devices

Orbit 21004 B-hyve Smart Hose Faucet Timer with Wi-Fi Hub](https://www.amazon.com/dp/B0758NR8DJ)
HT25-0000 by Orbit BHyve
Firmware: 0041
Hardware: HT25-0000

Logs

2022-07-16 17:39:46 ERROR (MainThread) [homeassistant.components.switch] Error while setting up bhyve platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/bhyve/switch.py", line 178, in async_setup_entry
    BHyveProgramSwitch(
  File "/config/custom_components/bhyve/switch.py", line 224, in __init__
    device_name = device.get("name")
AttributeError: 'NoneType' object has no attribute 'get'

Step 1: Enable debugging.

I enabled the logger but could not find the following in the logs:

DEBUG (MainThread) [custom_components.bhyve] Devices:
DEBUG (MainThread) [custom_components.bhyve] Programs:

ObiWanCanOweMe avatar Jul 16 '22 21:07 ObiWanCanOweMe

@ObiWanCanOweMe can you upload the device diagnostics file? Go to the device page and click the ... link:

Screen Shot 2022-07-20 at 10 17 16 am

sebr avatar Jul 20 '22 00:07 sebr

I believe I have same issue l, no switches crafted, with a new four port B-hyve.

julianwould avatar Jul 24 '22 03:07 julianwould

I believe I have same issue l, no switches crafted, with a new four port B-hyve.

@julianwould Can you please upload diagnostics? Instructions are in an earlier comment. Thx

sebr avatar Jul 24 '22 03:07 sebr

Yessir, diagnostics attached, appreciate the help!

config_entry-bhyve-a2afcc8dd1b80ef0e85f8d5a7fafd54d.json.txt

julianwould avatar Jul 24 '22 12:07 julianwould

All working now, it was hub/timer connection issue. Resolved by updating firmware. Thanks @sebr

julianwould avatar Jul 24 '22 21:07 julianwould

@ObiWanCanOweMe how did you go with this?

sebr avatar Jul 25 '22 09:07 sebr

Sorry for the delay in my response, here's the diagnostic:

config_entry-bhyve-a7d026a896becfaa4ca243c42b773011.json.txt

I checked for firmware updates but all my devices are on latest.

ObiWanCanOweMe avatar Jul 30 '22 20:07 ObiWanCanOweMe

@ObiWanCanOweMe sorry for the delay on this, but I had a look and it appears that your "Spare" sprinkler has a zone which doesn't have a name. To resolve the issue you probably just need to give it a name, but it would also be helpful to understand how you got into this state so I can try reproduce and improve the integration to handle this edge case.

        "zones": [
          {
            "station": 1,
            "name": "",
            "num_sprinklers": 0,
            "catch_cup_volumes": [],
            "catch_cup_run_time": 0,
            "smart_watering_enabled": false
          }
        ]

sebr avatar Aug 30 '22 11:08 sebr

Amazing, I removed the "Spare" sprinkler, restarted HA, and that fixed it! Long story short, thought I lost the sprinkler unit over the winter and bought a replacement. Once I got the replacement I found the original one (of course). I renamed the original to "Spare" and removed it from the zone.

ObiWanCanOweMe avatar Aug 30 '22 16:08 ObiWanCanOweMe

Fixed in #195

sebr avatar May 27 '23 13:05 sebr