Disclaimer: This software is at an early stage of development and may contain serious bugs that could affect system stability. Please use it at your own risk!
Integration for Unfolded Circle Remote Two to send network requests to a specified url or mac address.
Using uc-integration-api, requests and pywakeonlan.
- Send http(s) get, post, patch & put requests to a specified url
- Currently untested: Add optional parameters and arguments to the requests as explained here: https://requests.readthedocs.io/en/latest/api/#main-interface
- Send Wake on LAN magic packets to a specified mac address
- Send Wake on LAN magic packets by entering the ip address
Planned improvements are labeled with #TODO in the code
The integration exposes a media player entity for each supported request command. These entities only support the source feature. Just enter the desired url or mac address in the source field when you configure your activity/macro sequences or activity ui.
- Python 3.10 or newer
- Install Libraries:
(using a virtual environment is highly recommended)
pip3 install -r requirements.txt
python3 intg-requests/driver.py
For the mDNS advertisement to work correctly it's advised to start the integration in the host network (--net=host
). You can also set the websocket listening port with the environment variable UC_INTEGRATION_HTTP_PORT
, set the listening interface with UC_INTEGRATION_INTERFACE
or change the default debug log level with UC_LOG_LEVEL
. See available environment variables
in the Python integration library.
All data is mounted to /usr/src/app
:
docker run --net=host -n 'ucr2-integration-requests' -v './ucr2-integration-requests':'/usr/src/app/':'rw' 'python:3.11' /usr/src/app/docker-entry.sh
Note: Uploading custom integrations to the remote is not yet supported with the current firmware. The status can be tracked in this issue: #79
Unfolded Circle recommends to create a single binary file that has everything in it as python on embedded systems is a nightmare.
To do that, we need to compile it on the target architecture as pyinstaller
does not support cross compilation.
On x86-64 Linux we need Qemu to emulate the aarch64 target platform:
sudo apt install qemu binfmt-support qemu-user-static
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
Run pyinstaller:
docker run --rm --name builder \
--platform=aarch64 \
--user=$(id -u):$(id -g) \
-v "$PWD":/workspace \
docker.io/unfoldedcircle/r2-pyinstaller:3.11.6 \
bash -c \
"python -m pip install -r requirements.txt && \
pyinstaller --clean --onefile --name intg-requests intg-requests/driver.py"
On an aarch64 host platform, the build image can be run directly (and much faster):
docker run --rm --name builder \
--user=$(id -u):$(id -g) \
-v "$PWD":/workspace \
docker.io/unfoldedcircle/r2-pyinstaller:3.11.6 \
bash -c \
"python -m pip install -r requirements.txt && \
pyinstaller --clean --onefile --name intg-requests intg-requests/driver.py"
I use SemVer for versioning. For the versions available, see the tags and releases in this repository.
The major changes found in each new release are listed in the changelog and under the GitHub releases.
Contributions to add new feature, implement #TODOs from the code or improve the code quality and stability are welcome! First check whether there are other branches in this repository that maybe already include your feature. If not, please fork this repository first and then create a pull request to merge your commits and explain what you want to change or add.
This project is licensed under the GNU GENERAL PUBLIC LICENSE. See the LICENSE file for details.