diff --git a/dn b/dn new file mode 100755 index 0000000..37bab36 --- /dev/null +++ b/dn @@ -0,0 +1,15 @@ +#!/bin/bash +# +# take system services down +# +dn() { + docker compose -f $1/docker-compose.yml down +} + +if [ $1 ] +then + dn $1 +else + dn "florida/homebridge" + dn "florida/samba" +fi diff --git a/florida/homebridge/cgate/Dockerfile b/florida/homebridge/cgate/Dockerfile new file mode 100644 index 0000000..bf328d3 --- /dev/null +++ b/florida/homebridge/cgate/Dockerfile @@ -0,0 +1,22 @@ +# build cgate for arm +ARG CVER=2.11.4_3251 + +FROM arm32v7/openjdk:11.0.1-jre +ARG CVER +WORKDIR / +RUN apt-get -y install curl +RUN curl -kO https://updates.clipsal.com/ClipsalSoftwareDownload/mainsite/cis/technical/CGate/cgate-${CVER}.zip && \ + unzip cgate-${CVER}.zip && \ + rm -f cgate-${CVER}.zip && \ + rm -f cgate/tag/* \ + rm -f cgate/config/* \ + rm -f cgate/logs/* + +EXPOSE 20023 +EXPOSE 20024 +EXPOSE 20025 +EXPOSE 20026 +EXPOSE 20123 + +WORKDIR /cgate +CMD ["java", "-jar", "cgate.jar"] \ No newline at end of file diff --git a/florida/homebridge/config/231108-config.bak b/florida/homebridge/config/231108-config.bak new file mode 100644 index 0000000..34a4a44 --- /dev/null +++ b/florida/homebridge/config/231108-config.bak @@ -0,0 +1,484 @@ +{ + "bridge": { + "name": "Homebridge", + "username": "CC:22:3D:E3:CE:31", + "port": 51826, + "pin": "031-45-150", + "manufacturer": "@nfarina", + "model": "Homebridge", + "serialNumber": "0.4.20", + "advertiser": "avahi" + }, + "description": "Florida Road", + "platforms": [ + { + "platform": "AnekolHarmonyHub", + "name": "HarmonyHub", + "host": "192.168.1.30", + "port": "8282", + "verboseLog": false, + "hubs": [ + { + "label": "Harmony", + "slug": "16913279", + "devices": [ + "Bose Amp", + "Samsung TV" + ] + } + ] + }, + { + "platform": "homebridge-cbus.CBus", + "name": "CBus", + "client_ip_address": "127.0.0.1", + "client_controlport": 20023, + "client_cbusname": "FLORIDA", + "client_network": 254, + "client_application": 56, + "platform_export": "florida.json", + "client_debug": false, + "accessories": [ + { + "type": "dimmer", + "id": 1, + "name": "Kitchen Island" + }, + { + "type": "dimmer", + "id": 2, + "name": "Kitchen Bench" + }, + { + "type": "dimmer", + "id": 3, + "name": "Kitchen West" + }, + { + "type": "light", + "id": 4, + "name": "Kitchen Appliances" + }, + { + "type": "dimmer", + "id": 5, + "name": "Sitting Pendants" + }, + { + "type": "light", + "id": 6, + "name": "Sitting Wall" + }, + { + "type": "dimmer", + "id": 7, + "name": "Living North" + }, + { + "type": "dimmer", + "id": 8, + "name": "Living Centre" + }, + { + "type": "dimmer", + "id": 9, + "name": "Living South" + }, + { + "type": "dimmer", + "id": 10, + "name": "Living Lamp South" + }, + { + "type": "dimmer", + "id": 11, + "name": "Living Lamp North" + }, + { + "type": "light", + "id": 12, + "name": "BBQ" + }, + { + "type": "dimmer", + "id": 13, + "name": "Balcony" + }, + { + "type": "light", + "id": 14, + "name": "Foyer" + }, + { + "type": "dimmer", + "id": 16, + "name": "Foyer Lamp" + }, + { + "type": "dimmer", + "id": 17, + "name": "Bed 1/Bed 2 Hall" + }, + { + "type": "light", + "id": 18, + "name": "Outside Front" + }, + { + "type": "dimmer", + "id": 19, + "name": "Bath 2" + }, + { + "type": "light", + "id": 20, + "name": "Bath 2 Exhaust" + }, + { + "type": "dimmer", + "id": 21, + "name": "Bed 2" + }, + { + "type": "dimmer", + "id": 22, + "name": "Bed 2 Robe" + }, + { + "type": "dimmer", + "id": 24, + "name": "Bath 1" + }, + { + "type": "light", + "id": 25, + "name": "Bath 1 Exhaust" + }, + { + "type": "dimmer", + "id": 26, + "name": "Bed 1" + }, + { + "type": "dimmer", + "id": 27, + "name": "Bed 1 Robe" + }, + { + "type": "dimmer", + "id": 28, + "name": "Bed 1 Bedhead South" + }, + { + "type": "dimmer", + "id": 29, + "name": "Bed 1 Bedhead North" + }, + { + "type": "dimmer", + "id": 30, + "name": "Rumpus" + }, + { + "type": "dimmer", + "id": 31, + "name": "Games" + }, + { + "type": "light", + "id": 32, + "name": "Deck Lower North" + }, + { + "type": "light", + "id": 33, + "name": "Deck Lower South" + }, + { + "type": "dimmer", + "id": 34, + "name": "Bed 3" + }, + { + "type": "dimmer", + "id": 35, + "name": "Bed 4" + }, + { + "type": "dimmer", + "id": 36, + "name": "Bed 3/Bed 4 Hall" + }, + { + "type": "light", + "id": 37, + "name": "Garage Hall" + }, + { + "type": "dimmer", + "id": 38, + "name": "Bath 3" + }, + { + "type": "light", + "id": 39, + "name": "Bath 3 Exhaust" + }, + { + "type": "light", + "id": 40, + "name": "Laundry" + }, + { + "type": "light", + "id": 41, + "name": "Outside Laundry" + }, + { + "type": "switch", + "id": 42, + "name": "Garage Door", + "activeDuration": "0.25s" + }, + { + "type": "light", + "id": 43, + "name": "Garage" + }, + { + "type": "light", + "id": 44, + "name": "Garden Rear" + }, + { + "type": "dimmer", + "id": 46, + "name": "Bed 4 Bed" + }, + { + "type": "dimmer", + "id": 47, + "name": "Games South" + }, + { + "type": "switch", + "id": 48, + "name": "Front Door", + "activeDuration": "10.0s" + }, + { + "type": "light", + "id": 49, + "name": "Outside Garage" + }, + { + "type": "fan", + "id": 50, + "name": "Dining Fan" + }, + { + "type": "fan", + "id": 51, + "name": "Living Fan South" + }, + { + "type": "fan", + "id": 52, + "name": "Living Fan North" + }, + { + "type": "fan", + "id": 53, + "name": "Bed 1 Fan" + }, + { + "type": "fan", + "id": 54, + "name": "Bed 2 Fan" + }, + { + "type": "fan", + "id": 55, + "name": "Bed 3 Fan" + }, + { + "type": "fan", + "id": 56, + "name": "Bed 4 Fan" + }, + { + "type": "fan", + "id": 57, + "name": "Rumpus Fan" + }, + { + "type": "fan", + "id": 58, + "name": "Games Fan" + }, + { + "type": "shutter", + "id": 62, + "name": "Awning Upper" + }, + { + "type": "shutter", + "id": 63, + "name": "Awning Lower" + }, + { + "type": "light", + "id": 64, + "name": "Outside Side North" + } + ] + }, + { + "name": "Config", + "port": 8581, + "auth": "form", + "theme": "auto", + "tempUnits": "c", + "lang": "auto", + "platform": "config", + "scheduledBackupDisable": true + }, + { + "name": "Ness", + "host": "192.168.1.2", + "port": 2401, + "keypadCode": "7691", + "verboseLog": false, + "excludeModes": [ + "Home" + ], + "outputs": [ + { + "id": 1, + "label": "Garage Door - Internal" + }, + { + "id": 2, + "label": "Garage Door - External" + }, + { + "id": 3, + "label": "Foyer Entry Door" + } + ], + "zones": [ + { + "id": 1, + "label": "Foyer", + "type": "motion" + }, + { + "id": 2, + "label": "Garage", + "type": "motion" + }, + { + "id": 3, + "label": "Bed 1/2 Hall", + "type": "motion" + }, + { + "id": 4, + "label": "Rumpus", + "type": "motion" + }, + { + "id": 5, + "label": "Bed 1", + "type": "motion" + }, + { + "id": 6, + "label": "Bed 2", + "type": "motion" + }, + { + "id": 7, + "label": "Bed 3", + "type": "motion" + }, + { + "id": 8, + "label": "Bed 4", + "type": "motion" + }, + { + "id": 9, + "label": "Living", + "type": "motion" + }, + { + "id": 10, + "label": "Sitting", + "type": "motion" + } + ], + "platform": "NessD16x" + }, + { + "name": "CameraUI", + "port": 8081, + "atHomeSwitch": true, + "logLevel": "info", + "mqtt": { + "active": false, + "tls": false, + "port": 1883 + }, + "http": { + "active": false, + "port": 7272, + "localhttp": false + }, + "smtp": { + "active": false, + "port": 2727, + "space_replace": "+" + }, + "ftp": { + "active": false, + "useFile": false, + "port": 5050 + }, + "ssl": { + "active": false + }, + "options": { + "videoProcessor": "/usr/lib/node_modules/homebridge-camera-ui/node_modules/ffmpeg-for-homebridge/ffmpeg" + }, + "cameras": [ + { + "name": "Foyer", + "motion": true, + "motionTimeout": 15, + "unbridge": true, + "hsv": true, + "prebuffering": true, + "prebufferLength": 4, + "videoConfig": { + "source": "-i rtsp://admin:Collictai1@192.168.1.15:88/videoMain", + "subSource": "-i rtsp://admin:Collictai1@192.168.1.15:88/videoSub", + "stillImageSource": "-i rtsp://admin:Collictai1@192.168.1.15:88/videoMain", + "vcodec": "copy", + "acodec": "libfdk_aac", + "audio": false + }, + "smtp": { + "email": "Foyer" + }, + "videoanalysis": { + "active": true + }, + "mqtt": {} + } + ], + "platform": "CameraUI" + } + ], + "accessories": [] +} \ No newline at end of file diff --git a/florida/homebridge/docker-compose.yml b/florida/homebridge/docker-compose.yml new file mode 100644 index 0000000..7aa2345 --- /dev/null +++ b/florida/homebridge/docker-compose.yml @@ -0,0 +1,49 @@ +version: '3' +name: florida_homebridge +services: + cgate: + container_name: florida_homebridge_cgate + build: ./cgate + network_mode: host + # ports: + # - 20023:20023 + # - 20024:20024 + # - 20025:20025 + # - 20026:20026 + # - 20123:20123 + volumes: + - cgate_config:/cgate/config + - cgate_tag:/cgate/tag + - cgate_logs:/cgate/logs + restart: unless-stopped + harmony: + container_name: florida_homebridge_harmony + build: ./harmony + network_mode: host + # ports: + # - 8282:8282 + restart: unless-stopped + server: + container_name: florida_homebridge_server + build: ./server + network_mode: host + restart: always + volumes: + - homebridge:/homebridge + # make UI updates persistent + - homebridge_opt:/opt + - ./server/plugins:/tmp/plugins + depends_on: + - cgate + - harmony + logging: + driver: json-file + options: + max-size: "10mb" + +volumes: + cgate_config: + cgate_tag: + cgate_logs: + homebridge: + homebridge_opt: diff --git a/florida/homebridge/harmony/Dockerfile b/florida/homebridge/harmony/Dockerfile new file mode 100644 index 0000000..213e67e --- /dev/null +++ b/florida/homebridge/harmony/Dockerfile @@ -0,0 +1,13 @@ +# build harmony-api +FROM jonmaddox/harmony-api as harmony +FROM node:20.19.3 as node +RUN mkdir -p /app +COPY --from=harmony /usr/src/app /app +WORKDIR /app +RUN /bin/rm -rf node_modules +RUN apt-get -y update && apt-get -y install npm +RUN npm install +COPY config/config.json /config/config.json +ENV CONFIG_DIR /config +EXPOSE 8282 +CMD [ "npm", "start" ] diff --git a/florida/homebridge/harmony/config/config.json b/florida/homebridge/harmony/config/config.json new file mode 100644 index 0000000..e752983 --- /dev/null +++ b/florida/homebridge/harmony/config/config.json @@ -0,0 +1,11 @@ +{ + "enableHTTPserver": true, + "mqtt_host": "mqtt://127.0.0.1", + "topic_namespace": "harmony-api", + "mqtt_options": { + "port": 1883, + "username": "someuser", + "password": "somepassword", + "rejectUnauthorized": false + } +} \ No newline at end of file diff --git a/florida/homebridge/harmony/config/package.json b/florida/homebridge/harmony/config/package.json new file mode 100644 index 0000000..cb31e27 --- /dev/null +++ b/florida/homebridge/harmony/config/package.json @@ -0,0 +1,26 @@ +{ + "name": "harmony-api", + "version": "2.3.5", + "description": "A simple server providing a RESTful and MQTT based service for controlling and monitoring Harmony Hubs.", + "scripts": { + "start": "node app.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/maddox/harmony-api" + }, + "author": "Jon Maddox ", + "license": "MIT", + "bugs": { + "url": "https://github.com/maddox/harmony-api/issues" + }, + "dependencies": { + "express": "^4.12.4", + "morgan": "^1.6.1", + "body-parser": "^1.12.4", + "harmonyhubjs-client": "^1.1.0", + "harmonyhubjs-discover": "^1.0.2", + "parameterize": "^0.0.7", + "mqtt": "^1.4.1" + } +} \ No newline at end of file diff --git a/florida/homebridge/server/Dockerfile b/florida/homebridge/server/Dockerfile new file mode 100644 index 0000000..c486de5 --- /dev/null +++ b/florida/homebridge/server/Dockerfile @@ -0,0 +1,10 @@ +# build homebridge +FROM homebridge/homebridge:latest +RUN apt-get -y update && apt-get -y install telnet nmap ed nano lsof + +# custom init will copy local plugins to homebridge +COPY init /tmp/init +RUN chmod a+x /tmp/init + +ENTRYPOINT ["/tmp/init"] + diff --git a/florida/homebridge/server/code/homebridge-anekol-echonet-lite b/florida/homebridge/server/code/homebridge-anekol-echonet-lite new file mode 160000 index 0000000..b8c8fca --- /dev/null +++ b/florida/homebridge/server/code/homebridge-anekol-echonet-lite @@ -0,0 +1 @@ +Subproject commit b8c8fcafc4e35c9bec14ef5f6354561788d85ea2 diff --git a/florida/homebridge/server/code/homebridge-echonet-lite-eolia b/florida/homebridge/server/code/homebridge-echonet-lite-eolia new file mode 160000 index 0000000..200eca1 --- /dev/null +++ b/florida/homebridge/server/code/homebridge-echonet-lite-eolia @@ -0,0 +1 @@ +Subproject commit 200eca100b50709aa9a89a1d7c8d743611b3b895 diff --git a/florida/homebridge/server/code/homebridge-plugin-template b/florida/homebridge/server/code/homebridge-plugin-template new file mode 160000 index 0000000..6b24bc5 --- /dev/null +++ b/florida/homebridge/server/code/homebridge-plugin-template @@ -0,0 +1 @@ +Subproject commit 6b24bc54164500a4bd8576191cf435bd2315ac33 diff --git a/florida/homebridge/server/init b/florida/homebridge/server/init new file mode 100644 index 0000000..fba440e --- /dev/null +++ b/florida/homebridge/server/init @@ -0,0 +1,9 @@ +#!/bin/bash +# +# Homebridge needs to move plugins around during updates so plugins can't be mounted directly +echo \n\n\n======================================================================\n\n\n +cp -r /tmp/plugins/* /homebridge/node_modules +ls -l /homebridge/node_modules +echo \n\n\n======================================================================\n\n\n + +exec /init diff --git a/florida/homebridge/server/plugins/homebridge-anekol-harmony-hub b/florida/homebridge/server/plugins/homebridge-anekol-harmony-hub new file mode 160000 index 0000000..1a2f7fe --- /dev/null +++ b/florida/homebridge/server/plugins/homebridge-anekol-harmony-hub @@ -0,0 +1 @@ +Subproject commit 1a2f7fe8990bc96a4cd04edcc67fe686e2ba388f diff --git a/florida/samba/docker-compose.yml b/florida/samba/docker-compose.yml new file mode 100644 index 0000000..e86166c --- /dev/null +++ b/florida/samba/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.3' +name: florida_samba +services: + samba: + container_name: florida_samba + # https://github.com/awlx/samba-timemachine + image: awlnx/samba-timemachine:latest + ports: + # use 10445 is there are conflicts with macOS system samba server + # but then will have to specifically add :10465 to any server spec + # for time machone to find + # - 10445:445 + - 465:465 + environment: + USER: timemachine + PASS: Collictai1 + USERID: 1002 + GROUPID: 1002 + volumes: + - /backups/timemachine:/backups:rw + restart: unless-stopped + tty: true diff --git a/up b/up new file mode 100755 index 0000000..b6bc4f2 --- /dev/null +++ b/up @@ -0,0 +1,24 @@ + #!/bin/bash +# +# bring system services up +# +SYS=/srv/sys +cd $SYS + +up() { + #ensure updated image + DIR=$1 + shift; + docker compose -f $DIR/docker-compose.yml build --pull + # docker compose -f $1/docker-compose.yml up -d --force-recreate + # docker compose --remove-orphans --progress=plain -f $DIR/docker-compose.yml up -d + docker compose -f $DIR/docker-compose.yml up -d +} + +if [ $1 ] +then + up $1 +else + up "florida/samba" + up "florida/homebridge" +fi