unfoldedcircle / integration-python-library Goto Github PK
View Code? Open in Web Editor NEWPython API wrapper for the Unfolded Circle Integration API
License: Mozilla Public License 2.0
Python API wrapper for the Unfolded Circle Integration API
License: Mozilla Public License 2.0
At the moment one has to use the ucapi.configured_entities.update_attributes
method to change an entity attribute.
With the new entity command handler, this is a bit akward. The received entity object should allow direct attribute updates, which also trigger a change event. Directly modifying an attribute on the received entity will not trigger any events.
Proposed changes:
update_attribute
method to the entity class
update_attributes
method, or design a single method which allows both.This could then be used in a command handler:
async def switch_cmd_handler(
entity: ucapi.Switch, cmd_id: str, _params: dict[str, Any] | None
) -> ucapi.StatusCodes:
print(f"Got {entity.id} command request: {cmd_id}")
state = None
if cmd_id == switch.Commands.ON:
# implement ON logic...
state = switch.States.ON
elif cmd_id == switch.Commands.OFF:
# implement OFF logic...
state = switch.States.OFF
if state:
entity.update_attribute(switch.Attributes.STATE, state)
return ucapi.StatusCodes.OK
The UC_INTEGRATION_INTERFACE environment variable is an optional setting to configure the listening interface.
Current behaviour is that if it is not set, the WebSocket listening doesn't work.
Expected: optional env var, if not set use 0.0.0.0
The separate backing lists for available and configured entities makes it more difficult for the integrations to properly manage entity states and attributes.
Furthermore, the get_available_entities
should return all entities, no matter if the Remote Two has subscribed to certain entities or not. (This probably needs some clarifications in the WebSocket Integration-API as well).
There should only be one backing list with either additional attributes or metadata holding the subscription state.
/opt/homebrew/lib/python3.11/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!
********************************************************************************
Please avoid running ``setup.py`` directly.
Instead, use pypa/build, pypa/installer or other
standards-based tools.
See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
********************************************************************************
!!
Where's the wheelfile.whl
mentionend in the README pip3 install /path/to/wheelfile.whl
?
As long as this library isn't published, can't it be referenced with a relative path in requirements.txt
of an integration?
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.
Some integrations send base64 encoded images in the media_image_url
field. This causes excessive logging and needs to be filtered out.
This may a be a daft question... how would I listen to the WsMessages.GET_AVAILABLE_ENTITIES
so that I can rebuild the list of available entities? This message seems to be issued when the Reload
link is clicked in the Web Configurator.
What I'm trying to achieve... As I iterate through building the integration I will be adding new entities (mainly buttons) and quite possibly removing them too. I'm looking for a way to effectively be able to build those entities for both a new setup and for an existing setup. In addition any buttons I remove should also be removed (or at the very list flagged for removal).
I hope this makes sense.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.