Skip to content

Commit

Permalink
Updates README, gofmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias Perlet committed Apr 23, 2019
1 parent 61ba29a commit c64664c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
37 changes: 18 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,29 +58,11 @@ Usage: ./huevent [OPTIONS]
| | lightlevel | xxxxx | Lightlevel (0 ~ dark, 20000 ~ normal, 40000 ~ very bright) |



## Build

```
git clone https://github.com/mperlet/huevent.git && cd huevent
docker run --rm -v "$PWD":/huevent:Z -w /huevent -e GOOS=linux -e GOARCH=amd64 golang:1.12.1-stretch go build huevent.go
```

## Configuration

Run `huevent -pair` to pair a local Hue Bridge.


```
# Press Hue Bridge Button before you ran these commands
BRIDGE_IP=$(curl https://www.meethue.com/api/nupnp -s | grep -E -o "([0-9]{1,3}[.]){3}[0-9]{1,3}")
USERNAME=$(curl -s -X POST -d'{"devicetype":"huevent"}' "http://$BRIDGE_IP/api" | grep -P -o '":"(.*)"' | cut -d '"' -f3)
echo "$BRIDGE_IP $USERNAME"
```

## Configfile
### Configfile

`config`: Hue Bridge IP with Token

Expand Down Expand Up @@ -116,6 +98,23 @@ hooks:
deviceFilter: []
```

### Manual Pairing

```
# Press Hue Bridge Button before you ran these commands
BRIDGE_IP=$(curl https://www.meethue.com/api/nupnp -s | grep -E -o "([0-9]{1,3}[.]){3}[0-9]{1,3}")
USERNAME=$(curl -s -X POST -d'{"devicetype":"huevent"}' "http://$BRIDGE_IP/api" | grep -P -o '":"(.*)"' | cut -d '"' -f3)
echo "$BRIDGE_IP $USERNAME"
```

## Build

```
git clone https://github.com/mperlet/huevent.git && cd huevent
docker run --rm -v "$PWD":/huevent:Z -w /huevent -e GOOS=linux -e GOARCH=amd64 golang:1.12.4-stretch go build huevent.go
```

## Examples

Expand Down
4 changes: 2 additions & 2 deletions huevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import (
"encoding/json"
"flag"
"fmt"
"gopkg.in/yaml.v2"
"io/ioutil"
"log"
"net/http"
"os"
"os/exec"
"path"
"time"
"gopkg.in/yaml.v2"
)

type config struct {
Expand Down Expand Up @@ -40,7 +40,7 @@ type HueventConfig struct {
type Hook struct {
DeviceID string `yaml:"deviceId"`
EventType string `yaml:"eventType"`
TriggerOn string `yaml:"triggerOn,omitempty"`
TriggerOn string `yaml:"triggerOn,omitempty"`
Cmd string `yaml:"cmd"`
}

Expand Down

0 comments on commit c64664c

Please sign in to comment.