Skip to content

llun/hkwifioccupancy

Repository files navigation

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published