From b98acc5bf2cd66ff05f448e93c76fc9c4ad82839 Mon Sep 17 00:00:00 2001 From: Hans Oischinger Date: Mon, 20 May 2024 18:03:59 +0200 Subject: [PATCH] Make Eufy Security WS port configurable --- config.yaml | 6 +++++- files/eufyp2pstream.py | 2 +- files/run.sh | 9 +++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/config.yaml b/config.yaml index 4704810..d4ca8ef 100644 --- a/config.yaml +++ b/config.yaml @@ -5,11 +5,15 @@ url: http://192.168.178.252:8123/local_eufyp2pstream arch: [amd64, aarch64, i386, armv7] # https://developers.home-assistant.io/docs/add-ons/configuration -version: 0.1-alpha.9 +version: 0.2-beta slug: eufyp2pstream init: false startup: application panel_icon: mdi:camera-wireless map: [config, media] host_network: false +options: + eufy_security_ws_port: 3000 +schema: + eufy_security_ws_port: port ports: { "63336/tcp": 63336, "63337/tcp": 63337, "63338/tcp": 63338 } diff --git a/files/eufyp2pstream.py b/files/eufyp2pstream.py index ce063de..56b62b0 100644 --- a/files/eufyp2pstream.py +++ b/files/eufyp2pstream.py @@ -346,7 +346,7 @@ async def on_message(self, message): async def init_websocket(): ws: EufySecurityWebSocket = EufySecurityWebSocket( "402f1039-eufy-security-ws", - 3000, + sys.argv[1], aiohttp.ClientSession(), c.on_open, c.on_message, diff --git a/files/run.sh b/files/run.sh index 7e47bed..83cd891 100755 --- a/files/run.sh +++ b/files/run.sh @@ -1,4 +1,9 @@ #!/bin/bash -echo "Starting EufyP2PStream" -python3 -u /eufyp2pstream.py +set +u +CONFIG_PATH=/data/options.json + +EUFY_WS_PORT=$(jq --raw-output ".eufy_security_ws_port" $CONFIG_PATH) + +echo "Starting EufyP2PStream. eufy_security_ws_port is $EUFY_WS_PORT" +python3 -u /eufyp2pstream.py $EUFY_WS_PORT echo "Exited with code $?" \ No newline at end of file