diff --git a/README.md b/README.md index 3314699..684a79f 100644 --- a/README.md +++ b/README.md @@ -500,6 +500,7 @@ A collection of delicious docker recipes. - [x] yourls - [x] ghcr.io/linuxserver/wireguard - [x] apache/zeppelin +- [x] koenkk/zigbee2mqtt - [x] zookeeper - [x] elkozmon/zoonavigator diff --git a/semaphore/keygen.sh b/semaphore/keygen.sh new file mode 100755 index 0000000..0be722e --- /dev/null +++ b/semaphore/keygen.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# +# https://docs.semui.co/administration-guide/api +# + +set -euo pipefail + +API_ENDPOINT=http://192.168.1.100:3000 +API_USERNAME=username +API_PASSWORD=password + +cookie=$(jq -n --arg auth $API_USERNAME --arg password $API_PASSWORD '{$auth, $password}' | curl -s -c- $API_ENDPOINT/api/auth/login -d @- -o /dev/null | awk '$6=="semaphore"{print $7}') + +if curl -s -H "Cookie: semaphore=$cookie" $API_ENDPOINT/api/user/tokens | jq -e 'length==0' > /dev/null; then + curl -s -X POST -H "Cookie: semaphore=$cookie" $API_ENDPOINT/api/user/tokens +fi + +token=$(curl -s -H "Cookie: semaphore=$cookie" $API_ENDPOINT/api/user/tokens | jq -r .[0].id) + +curl -s -H "Authorization: Bearer $token" $API_ENDPOINT/api/user/tokens | jq . diff --git a/zigbee2mqtt/README.md b/zigbee2mqtt/README.md new file mode 100644 index 0000000..0f182aa --- /dev/null +++ b/zigbee2mqtt/README.md @@ -0,0 +1,2 @@ +zigbee2mqtt +=========== diff --git a/zigbee2mqtt/data/configuration.yaml b/zigbee2mqtt/data/configuration.yaml new file mode 100644 index 0000000..806e600 --- /dev/null +++ b/zigbee2mqtt/data/configuration.yaml @@ -0,0 +1,20 @@ +# Home Assistant integration (MQTT discovery) +homeassistant: false + +# allow new devices to join +permit_join: false + +# MQTT settings +mqtt: + # MQTT base topic for zigbee2mqtt MQTT messages + base_topic: zigbee2mqtt + # MQTT server URL + server: 'mqtt://localhost' + # MQTT server authentication, uncomment if required: + # user: my_user + # password: my_password + +# Serial settings +serial: + # Location of CC2531 USB sniffer + port: /dev/ttyACM0 diff --git a/zigbee2mqtt/docker-compose.yml b/zigbee2mqtt/docker-compose.yml new file mode 100644 index 0000000..fb472db --- /dev/null +++ b/zigbee2mqtt/docker-compose.yml @@ -0,0 +1,14 @@ +version: "3.8" +services: + zigbee2mqtt: + image: koenkk/zigbee2mqtt + ports: + - "8080:8080" + volumes: + - ./data:/app/data + - /run/udev:/run/udev:ro + environment: + - TZ=Asia/Shanghai + devices: + - /dev/serial/by-id/usb-Texas_Instruments_XXXXXX:/dev/ttyACM0 + restart: unless-stopped