Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Z-Wave relative imports #21693

Merged
merged 1 commit into from Mar 6, 2019

Conversation

Projects
None yet
3 participants
@balloob
Copy link
Member

commented Mar 5, 2019

Description:

Make all Z-Wave imports relative so it can be used as a custom component.

Was trying to repro #21579 but didn't manage.

Related issue (if applicable): #21579

@balloob balloob requested a review from home-assistant/z-wave as a code owner Mar 5, 2019

@ghost ghost assigned balloob Mar 5, 2019

@ghost ghost added the in progress label Mar 5, 2019

@balloob balloob merged commit c9b1734 into dev Mar 6, 2019

9 of 10 checks passed

Pyton 3.5 - typing,cov Pyton 3.5 - typing,cov
Details
Hound No violations found. Woof!
Python 3.5 - lints Python 3.5 - lints
Details
Python 3.5 - tests Python 3.5 - tests
Details
Python 3.6 - tests Python 3.6 - tests
Details
Python 3.7 - tests Python 3.7 - tests
Details
cla-bot Everyone involved has signed the CLA
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
coverage/coveralls Coverage remained the same at 92.759%
Details

@ghost ghost removed the in progress label Mar 6, 2019

@delete-merged-branch delete-merged-branch bot deleted the fix-zwave-relative-imports branch Mar 6, 2019

@uchagani

This comment has been minimized.

Copy link
Contributor

commented Mar 8, 2019

@balloob I tried pulling in these changes in a custom_component and I'm seeing the following errors on a brand new install:

2019-03-08 12:02:50 ERROR (MainThread) [homeassistant.loader] Unable to find platform zwave. Search path was limited to path of component: custom_components
2019-03-08 12:02:50 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform zwave.config: Platform not found.

and

2019-03-08 12:02:51 ERROR (Dummy-30) [openzwave] Error in manager callback
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/openzwave/network.py", line 950, in zwcallback
    self._handle_value_added(args)
  File "/srv/homeassistant/lib/python3.5/site-packages/openzwave/network.py", line 1480, in _handle_value_added
    'value' : self.nodes[args['nodeId']].values[args['valueId']['id']]})
  File "/srv/homeassistant/lib/python3.5/site-packages/pydispatch/dispatcher.py", line 338, in send
    **named
  File "/srv/homeassistant/lib/python3.5/site-packages/pydispatch/robustapply.py", line 55, in robustApply
    return receiver(*arguments, **named)
  File "/home/homeassistant/.homeassistant/custom_components/zwave/__init__.py", line 324, in value_added
    hass, schema, value, config, device_config, registry)
  File "/home/homeassistant/.homeassistant/custom_components/zwave/__init__.py", line 818, in __init__
    self._check_entity_ready()
  File "/home/homeassistant/.homeassistant/custom_components/zwave/__init__.py", line 908, in _check_entity_ready
    node_config=node_config, hass=self._hass)
  File "/home/homeassistant/.homeassistant/custom_components/zwave/cover.py", line 43, in get_device
    return ZwaveGarageDoorBarrier(values)
  File "/home/homeassistant/.homeassistant/custom_components/zwave/cover.py", line 122, in __init__
    ZWaveDeviceEntity.__init__(self, values, DOMAIN)
  File "/home/homeassistant/.homeassistant/custom_components/zwave/__init__.py", line 959, in __init__
    super().__init__()
TypeError: super(type, obj): obj must be an instance or subtype of type
@uchagani

This comment has been minimized.

Copy link
Contributor

commented Mar 8, 2019

ok I think I solved the 2nd error. looks like just some missing relative paths in cover.py. I'll submit a PR if that's okay with you.

@uchagani

This comment has been minimized.

Copy link
Contributor

commented Mar 8, 2019

I'm unable to fix the first error

2019-03-08 12:02:50 ERROR (MainThread) [homeassistant.loader] Unable to find platform zwave. Search path was limited to path of component: custom_components
2019-03-08 12:02:50 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform zwave.config: Platform not found.
@balloob

This comment has been minimized.

Copy link
Member Author

commented Mar 8, 2019

Ah, that error is because we failed to consolidate all zwave files. Looks like config still has a config/zwave.py.

@uchagani

This comment has been minimized.

Copy link
Contributor

commented Mar 8, 2019

to fix that, is it as simple as moving the file to the zwave directory and changing paths to relative?

@balloob

This comment has been minimized.

Copy link
Member Author

commented Mar 8, 2019

Yeah, copy config/zwave.py to custom components/zwave/config.py

@uchagani

This comment has been minimized.

Copy link
Contributor

commented Mar 8, 2019

cool i'll push up a PR In a bit that fixes both of these if that's okay with you

@balloob balloob referenced this pull request Mar 8, 2019

Merged

Change how we import config modules #21824

4 of 4 tasks complete
@uchagani

This comment has been minimized.

Copy link
Contributor

commented Mar 8, 2019

@balloob does #21824 mean we don't have to move config/zwave.py into zwave/zwave.py? or does that still need to happen?

@uchagani

This comment has been minimized.

Copy link
Contributor

commented Mar 8, 2019

@balloob I pushed PRs to fix these two errors in separate PRs incase i messed something up.

@balloob balloob referenced this pull request Mar 20, 2019

Merged

0.90.0 #22216

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.