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

Integrations crash if UC_INTEGRATION_HTTP_PORT ENV var is not set #3

Closed
zehnm opened this issue Oct 18, 2023 · 0 comments · Fixed by #5
Closed

Integrations crash if UC_INTEGRATION_HTTP_PORT ENV var is not set #3

zehnm opened this issue Oct 18, 2023 · 0 comments · Fixed by #5
Assignees
Labels
bug Something isn't working

Comments

@zehnm
Copy link
Contributor

zehnm commented Oct 18, 2023

Integrations crash if UC_INTEGRATION_HTTP_PORT is not set:

  File "/Users/mzehnder/projects/personal/yio-remote/aitatoi/integration-denonavr/venv/lib/python3.11/site-packages/ucapi/api.py", line 67, in init
    self.driverInfo["driver_url"] = self.getDriverUrl(
                                    ^^^^^^^^^^^^^^^^^^
  File "/Users/mzehnder/projects/personal/yio-remote/aitatoi/integration-denonavr/venv/lib/python3.11/site-packages/ucapi/api.py", line 108, in getDriverUrl
    return "ws://" + self._interface + ":" + port
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
TypeError: can only concatenate str (not "NoneType") to str

Expected: no runtime error, defined error and exit code if a required setting is missing.
There should also be a default port if the integration doesn't overwrite it. AFAIK the Node library has a default port set.

@zehnm zehnm added the bug Something isn't working label Oct 18, 2023
zehnm added a commit that referenced this issue Oct 29, 2023
Publish service with local hostname.
Cleanup interface and port handling.

Fixes #2
Fixes #3
@zehnm zehnm self-assigned this Oct 29, 2023
@zehnm zehnm closed this as completed in #5 Oct 31, 2023
zehnm added a commit that referenced this issue Oct 31, 2023
refactor: entity command handler on the base Entity
  This will simplify the client command handling significantly:
- configured entity is passed as argument
- basic error checking is done in the library
- websocket stays hidden
- command acknowledgment is implemented in the library

refactor: driver setup process
  Don't expose websocket or request ids. Setup flow is controlled by new data classes:
- Return object is the next step in the setup flow.
- The client should not have to know or call driver_setup_error, request_driver_setup_user_input, etc.

fix: mDNS service publishing
- Publish service with local hostname.
- Cleanup interface and port handling.

refactor: logging
- Remove logging.basicConfig() calls.
  Must be done by client.
- Make logging instances private.
- Move entity creation log statement to base class.

fix: improve websocket handling
- best effort in broadcast_ws_event
- add more type information
- add docstrings

fix: config_dir_path is always set
- Use ENV var UC_CONFIG_HOME for configuration directory, fallback to HOME directory or local path.

Prepare project for public release:
- add CONTRIBUTING.md
- add CHANGELOG.md
- add a minimal example
- enhance README

Closes #1
Fixes #2
Fixes #3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant