llun / hkwifioccupancy

Wifi Occupancy Sensor for HomeControl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hkwifioccupancy

Wifi Occupancy Sensor for HomeControl

Sample Code for using with HC

package main

import (
  "github.com/brutella/hc"
  "github.com/brutella/hc/accessory"
  "github.com/llun/hkwifioccupancy"
)

func main() {
  wifi := wifioccupancy.NewWifi("/tmp/presence.wifi", NewSet("MAC ADDRESS1", "MAC ADDRESS2"))

  t, err := hc.NewIPTransport(hc.Config{
    Pin:  "32191123",
  }, wifi.Accessory)
  if err != nil {
    log.Fatal(err)
  }

  hc.OnTermination(func() {
    t.Stop()
  })

  t.Start()
}

License

MIT

About

Wifi Occupancy Sensor for HomeControl


Languages

Language:Go 90.9%Language:Shell 9.1%