Skip to content

Commit

Permalink
chore: more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
WhySoBad committed Mar 28, 2024
1 parent cb667b3 commit 127df7d
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
target
.idea
.github

docs
*.md
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
FROM rust:alpine3.18 as builder
FROM rust:alpine3.19 as builder

WORKDIR /app

RUN rustup target add x86_64-unknown-linux-musl
RUN rustup target add aarch64-unknown-linux-musl

RUN apk add --no-cache musl-dev openssl-dev openssl protoc gcc
ENV OPENSSL_DIR=/usr
ENV RUSTFLAGS=-Ctarget-feature=-crt-static
ENV CARGO_BUILD_TARGET=x86_64-unknown-linux-musl
# ENV CARGO_BUILD_TARGET=x86_64-unknown-linux-musl
ENV OPENSSL_NO_VENDOR=1

RUN CARGO_BUILD_TARGET=$([ "$TARGETPLATFORM" = "arm" ] && echo "aarch64-unknown-linux-musl" || echo "x86_64-unknown-linux-musl")

COPY . .
RUN cargo build --release

Expand Down
1 change: 1 addition & 0 deletions docs/cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Cli
5 changes: 5 additions & 0 deletions docs/example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Example setup

In this section I'll describe my tapoctl setup using a raspberry pi 4b.

[TODO]
53 changes: 53 additions & 0 deletions docs/server.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Server

The binary includes a gRPC server which can be started using `tapoctl serve`. The server expects a configuration file.
By default, the configuration file is expected at `$HOME/.config/tapoctl/config.toml`. Using the `-c/--config` argument you can specify an
alternative config path.

The server has to be in the same network as the devices. Should your devices be in another network than your local network (e.g. guest or iot network)
you'll have to make sure the device on which the server is run is connected to both your local network and the guest or iot network in order for you to be
able to control the bulbs from your local network. More about this can be seen in the [example setup](/example.md) with a rasperry pi.

## Configuration

```toml
# Your tapo account credentials
[auth]
username=""
password=""

# Register a device with the name `lamp-1`
[devices.lamp-1]
type="L530" # The device type of the light bulb (L530, L520, ...)
address="10.255.255.10" # The address under which the device can be reached

port=19191 # Optional port to listen on. Default: 19191
```

>[!TIP]
> You can find the ip address of your device in the official tapo app or through a
> [arp scan](https://linux.die.net/man/1/arp-scan) on the network your device is on
>
> When you use something like a pihole and assigned a hostname to your device you can also specify the hostname
> in the `address` field
## Using docker

The server can easily be set up using the `ghcr.io/whysobad/tapoctl` docker image:

```bash
docker run --network host --volume ./config.toml:/home/tapo/.config/tapoctl/config.toml ghcr.io/whysobad/tapoctl
```

or using docker compose:

```yaml
version: '3.8'

services:
tapoctl:
image: ghcr.io/whysobad/tapoctl
network_mode: host
volumes:
- ./config:/home/tapo/.config/tapoctl/config.toml
```

0 comments on commit 127df7d

Please sign in to comment.