Skip to content

MrEhbr/homekit

homekit

CI License codecov Made by Alexey Burmistrov

Usage

package main

import (
    "context"
    "net/http"

    "github.com/MrEhbr/homekit"
    "github.com/brutella/hc"
    "github.com/brutella/hc/accessory"
    "github.com/brutella/hc/log"
)

func main() {
    // create an accessory
    info := accessory.Info{Name: "Lamp"}
    ac := accessory.NewSwitch(info)

    t, err := homekit.NewTransport(12345, "config", "00102003", ac.Accessory)
    if err != nil {
        log.Info.Panic(err)
    }

    ctx, cancel := context.WithCancel(context.Background())

    hc.OnTermination(func() {
        cancel()
    })

    if err := t.Run(ctx); err != nil && err != http.ErrServerClosed {
        log.Info.Printf("transport Run error: %s", err)
    }
}

Using go

go get -u github.com/MrEhbr/homekit

Attribution

transport.go, config.go are forked from the github.com/brutella/hc package.

Those files are Copyright (c) 2017, Matthias Hochgatterer and subject to the conditions in LICENSE.

Any added files (such as storage.go) are subject to the conditions in the Homekit LICENSE file

License

© 2020 [Alexey Burmistrov]

Licensed under the Apache License, Version 2.0 (LICENSE). See the COPYRIGHT file for more details.

SPDX-License-Identifier: Apache-2.0

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published