Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
c696c55
Merge pull request #1 from asedov/fix-error-handling
brutella Mar 7, 2022
ee38c2d
Update github.com/brutella/dnssd to v1.2.2
brutella Mar 7, 2022
41890c5
Run go mod tidy
brutella Mar 7, 2022
c46848d
Programmable switch event response is always null
brutella Mar 21, 2022
0e64553
Reorder imports
brutella Apr 11, 2022
7cb78d8
Made accessories code more consistent
rblenkinsopp May 13, 2022
eecd6fa
Merge pull request #5 from rblenkinsopp/refactor-accessories
brutella May 16, 2022
963e983
Change SetValueRequestFunc to returns a response
brutella Jun 7, 2022
9cf06d8
Merge remote-tracking branch 'origin/master'
brutella Jun 7, 2022
f2675ff
Fix issue where response is the old value of C
brutella Jun 21, 2022
947153d
Revert dnssd to v1.2.1
brutella Jun 21, 2022
cc1edd4
Update to dnssd v1.2.3
brutella Jul 4, 2022
d570e21
Fix connection issue when running multiple servers #8
brutella Jul 26, 2022
ec47221
Fix broken link in README.md #3
brutella Jul 26, 2022
f4baf3f
Check for optional flag in tlv8 field tag #10
brutella Aug 30, 2022
e641325
Set optional TLV8 fields
brutella Sep 28, 2022
17df293
Fix race condition
brutella Sep 28, 2022
39fd60f
Hold position always reports new values
brutella Sep 29, 2022
c3dce13
Require gopkg.in/yaml v2.2.8
brutella Sep 29, 2022
452ebee
Merge branch 'tlv8-unmarshal-bug'
brutella Sep 29, 2022
de8012d
Add accessory runtime information service and related characteristics
brutella Oct 10, 2022
532497b
Define UnitMicrogramsPerCubicMeter
brutella Oct 10, 2022
83a57e8
Fix tlv8 decoding of inline array
brutella Oct 13, 2022
684ab10
Remove unused error type
brutella Oct 13, 2022
96cc95d
Rename method
brutella Oct 13, 2022
6b2b873
Add property to specify interface at which dnssd service is announced
brutella Jan 3, 2023
341fa92
Update to latest dnssd commit in branch ifaces
brutella Jan 10, 2023
1f9daaf
Remove all pairings when no admin controller is paired anymore
brutella Jan 13, 2023
1baa43d
Use dnssd v1.2.5
brutella Jan 18, 2023
ddef50b
Add documentation to C type
brutella Jan 18, 2023
fa83abe
Make method public to check if server is paired with a client
brutella Jan 30, 2023
82274a8
Fix EOF error by making fields optional
brutella Feb 9, 2023
a5b8dc0
Bump golang.org/x/text from 0.3.7 to 0.3.8
dependabot[bot] Feb 24, 2023
8e839df
Merge pull request #22 from brutella/dependabot/go_modules/golang.org…
brutella Feb 24, 2023
bc7f201
Update dnssd to v1.2.6
brutella Mar 30, 2023
4b1951a
Ignore permissions when setting value using SetValueRequest #25
brutella Apr 13, 2023
80fc9dc
Fix permissions of db files #28
brutella Apr 24, 2023
f2425cf
Upgrade dnssd to v1.2.7
brutella Apr 27, 2023
8c2be2d
Fix emitted characteristics JSON to be compliant
geekman May 20, 2023
309448c
Fixed regression where Identify emitted "value"
geekman May 20, 2023
b1eb4cb
Merge pull request #31 from geekman/master
brutella May 22, 2023
dc6d9fb
fix tlv8.Unmarshal failure for rtp.RTPParams
0x5e Jul 28, 2023
4bda4df
Change RTPParams.Ssrc to uint32
0x5e Jul 31, 2023
0f706fa
Add RTPParams testcase
0x5e Jul 31, 2023
89393aa
Merge pull request #35 from 0x5e/patch-1
brutella Aug 7, 2023
159f576
Disable TCP keepalives to avoid constantly waking iOS devices
geekman Aug 7, 2023
fadb70c
Merge pull request #36 from geekman/master
brutella Aug 8, 2023
0491658
Add protocol information service
brutella Aug 14, 2023
4a65b6f
Check for integer value early on
brutella Aug 17, 2023
ed349f1
Format code
brutella Aug 17, 2023
655ec85
Support timed write procedure (HAP 6.7.2.4)
brutella Aug 25, 2023
b19bd2f
Implement WriteResponse characteristics
geekman Aug 27, 2023
71adbd5
Merge pull request #37 from geekman/master
brutella Aug 28, 2023
f60335d
feat: add motion and contact sensor accessories
caarlos0 Oct 19, 2023
ed802c6
Require dnssd v1.2.10
brutella Nov 6, 2023
efe5bc9
use correct content-type for /pairings
saljam Nov 15, 2023
1f7dc26
Merge pull request #46 from saljam/master
brutella Dec 6, 2023
f22e594
Merge pull request #40 from caarlos0/sensors
brutella Dec 21, 2023
fdea263
fix: wrong bytes written for conn when encrypting
ItsNotGoodName Dec 28, 2023
320443d
Merge pull request #51 from ItsNotGoodName/fix-wrong-write-count
brutella Jan 4, 2024
152c58c
Add new way of normalizing dnssd server name
brutella Feb 1, 2024
5f12655
Merge remote-tracking branch 'origin/master'
brutella Feb 1, 2024
ce6f614
Rename C.value() to C.Value()
brutella Feb 26, 2024
73c0a5c
Guard call on OnCValueUpdate by locking mutex
brutella Mar 5, 2024
53e3bde
Fix unit tests
brutella Mar 5, 2024
026c7e9
Protect access to encryptCount and decryptCount field
brutella May 10, 2024
87fbe10
Make sure that access to C.Event (now C.events) protected with a mutex
brutella May 10, 2024
69b7fac
Update dnssd to v1.2.11 #57
brutella Jul 24, 2024
b0d60f5
Update to dnssd v1.2.14
brutella Oct 22, 2024
d78dcdd
Do not override pre-defined service and characteristic ids
brutella Oct 22, 2024
ae235b3
Fix pairings handler rejecting ListPairings with "tlv8: EOF"
hughobrien Jun 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![GoDoc Widget]][GoDoc] [![Travis Widget]][Travis]

`hap` (previously [hc](https://github.com/brutella/hc)) is a lightweight library to develop HomeKit accessories in Go.
It abstracts the **H**omeKit **A**ccessory **P**rotocol (HAP) and makes it easy to work with [services](service/README.md) and [characteristics](characteristic/README.md).
It abstracts the **H**omeKit **A**ccessory **P**rotocol (HAP) and makes it easy to work with [services](service/README.md) and [characteristics](characteristic).

`hap` handles the underlying communication between HomeKit accessories and clients.
You can focus on implementing the business logic for your accessory, without having to worry about the protocol.
Expand Down
1 change: 1 addition & 0 deletions accessory/air_purifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type AirPurifier struct {
func NewAirPurifier(info Info) *AirPurifier {
a := AirPurifier{}
a.A = New(info, TypeAirPurifier)

a.AirPurifier = service.NewAirPurifier()
a.AddS(a.AirPurifier.S)

Expand Down
1 change: 1 addition & 0 deletions accessory/camera.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type Camera struct {
func NewCamera(info Info) *Camera {
a := Camera{}
a.A = New(info, TypeIPCamera)

a.Control = service.NewCameraControl()
a.AddS(a.Control.S)

Expand Down
12 changes: 5 additions & 7 deletions accessory/colored_lightbulb.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ type ColoredLightbulb struct {

// NewLightbulb returns an light bulb accessory.
func NewColoredLightbulb(info Info) *ColoredLightbulb {
a := New(info, TypeLightbulb)
a := ColoredLightbulb{}
a.A = New(info, TypeLightbulb)

l := service.NewColoredLightbulb()
a.Ss = append(a.Ss, l.S)
a.Lightbulb = service.NewColoredLightbulb()
a.AddS(a.Lightbulb.S)

return &ColoredLightbulb{
A: a,
Lightbulb: l,
}
return &a
}
19 changes: 19 additions & 0 deletions accessory/contact_sensor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package accessory

import "github.com/brutella/hap/service"

type ContactSensor struct {
*A
ContactSensor *service.ContactSensor
}

// NewContactSensor implements a contact sensor.
func NewContactSensor(info Info) *ContactSensor {
a := ContactSensor{}
a.A = New(info, TypeSensor)

a.ContactSensor = service.NewContactSensor()
a.AddS(a.ContactSensor.S)

return &a
}
1 change: 1 addition & 0 deletions accessory/cooler.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type Cooler struct {
func NewCooler(info Info) *Cooler {
a := Cooler{}
a.A = New(info, TypeAirConditioner)

a.Cooler = service.NewCooler()
a.AddS(a.Cooler.S)

Expand Down
13 changes: 5 additions & 8 deletions accessory/dehumidifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@ import (

type Dehumidifier struct {
*A

Dehumidifier *service.Dehumidifier
}

// NewDehumidifier returns an outlet accessory.
func NewDehumidifier(info Info) *Dehumidifier {
a := New(info, TypeDehumidifier)
a := Dehumidifier{}
a.A = New(info, TypeDehumidifier)

d := service.NewDehumidifier()
a.Ss = append(a.Ss, d.S)
a.Dehumidifier = service.NewDehumidifier()
a.AddS(a.Dehumidifier.S)

return &Dehumidifier{
A: a,
Dehumidifier: d,
}
return &a
}
13 changes: 5 additions & 8 deletions accessory/door.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@ import (

type Door struct {
*A

Door *service.Door
}

// NewDoor returns a door accessory.
func NewDoor(info Info) *Door {
a := New(info, TypeDoor)
a := Door{}
a.A = New(info, TypeDoor)

door := service.NewDoor()
a.Ss = append(a.Ss, door.S)
a.Door = service.NewDoor()
a.AddS(a.Door.S)

return &Door{
A: a,
Door: door,
}
return &a
}
13 changes: 5 additions & 8 deletions accessory/fan.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@ import (

type Fan struct {
*A

Fan *service.Fan
}

// NewFan returns a fan accessory.
func NewFan(info Info) *Fan {
a := New(info, TypeFan)
a := Fan{}
a.A = New(info, TypeFan)

fan := service.NewFan()
a.Ss = append(a.Ss, fan.S)
a.Fan = service.NewFan()
a.AddS(a.Fan.S)

return &Fan{
A: a,
Fan: fan,
}
return &a
}
13 changes: 5 additions & 8 deletions accessory/faucet.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@ import (

type Faucet struct {
*A

Faucet *service.Faucet
}

// NewFaucet returns an outlet accessory.
func NewFaucet(info Info) *Faucet {
a := New(info, TypeFaucet)
a := Faucet{}
a.A = New(info, TypeFaucet)

faucet := service.NewFaucet()
a.Ss = append(a.Ss, faucet.S)
a.Faucet = service.NewFaucet()
a.AddS(a.Faucet.S)

return &Faucet{
A: a,
Faucet: faucet,
}
return &a
}
13 changes: 5 additions & 8 deletions accessory/garage_door_opener.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@ import (

type GarageDoorOpener struct {
*A

GarageDoorOpener *service.GarageDoorOpener
}

// NewGarageDoorOpener returns a garage door opener accessory.
func NewGarageDoorOpener(info Info) *GarageDoorOpener {
a := New(info, TypeGarageDoorOpener)
a := GarageDoorOpener{}
a.A = New(info, TypeGarageDoorOpener)

garage := service.NewGarageDoorOpener()
a.Ss = append(a.Ss, garage.S)
a.GarageDoorOpener = service.NewGarageDoorOpener()
a.AddS(a.GarageDoorOpener.S)

return &GarageDoorOpener{
A: a,
GarageDoorOpener: garage,
}
return &a
}
1 change: 1 addition & 0 deletions accessory/heater.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type Heater struct {
func NewHeater(info Info) *Heater {
a := Heater{}
a.A = New(info, TypeHeater)

a.Heater = service.NewHeater()
a.AddS(a.Heater.S)

Expand Down
13 changes: 5 additions & 8 deletions accessory/humidifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@ import (

type Humidifier struct {
*A

Humidifier *service.Humidifier
}

// NewHumidifier returns an outlet accessory.
func NewHumidifier(info Info) *Humidifier {
a := New(info, TypeHumidifier)
a := Humidifier{}
a.A = New(info, TypeHumidifier)

h := service.NewHumidifier()
a.Ss = append(a.Ss, h.S)
a.Humidifier = service.NewHumidifier()
a.AddS(a.Humidifier.S)

return &Humidifier{
A: a,
Humidifier: h,
}
return &a
}
12 changes: 5 additions & 7 deletions accessory/lightbulb.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ type Lightbulb struct {

// NewLightbulb returns an light bulb accessory.
func NewLightbulb(info Info) *Lightbulb {
a := New(info, TypeLightbulb)
a := Lightbulb{}
a.A = New(info, TypeLightbulb)

l := service.NewLightbulb()
a.AddS(l.S)
a.Lightbulb = service.NewLightbulb()
a.AddS(a.Lightbulb.S)

return &Lightbulb{
A: a,
Lightbulb: l,
}
return &a
}
19 changes: 19 additions & 0 deletions accessory/motion_sensor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package accessory

import "github.com/brutella/hap/service"

type MotionSensor struct {
*A
MotionSensor *service.MotionSensor
}

// NewMotionSensor returns a motion sensor.
func NewMotionSensor(info Info) *MotionSensor {
a := MotionSensor{}
a.A = New(info, TypeSensor)

a.MotionSensor = service.NewMotionSensor()
a.AddS(a.MotionSensor.S)

return &a
}
13 changes: 5 additions & 8 deletions accessory/outlet.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@ import (

type Outlet struct {
*A

Outlet *service.Outlet
}

// NewOutlet returns an outlet accessory.
func NewOutlet(info Info) *Outlet {
a := New(info, TypeOutlet)
a := Outlet{}
a.A = New(info, TypeOutlet)

outlet := service.NewOutlet()
a.Ss = append(a.Ss, outlet.S)
a.Outlet = service.NewOutlet()
a.AddS(a.Outlet.S)

return &Outlet{
A: a,
Outlet: outlet,
}
return &a
}
13 changes: 5 additions & 8 deletions accessory/security_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@ import (

type SecuritySystem struct {
*A

SecuritySystem *service.SecuritySystem
}

// NewSecuritySystem returns a security system accessory.
func NewSecuritySystem(info Info) *SecuritySystem {
a := New(info, TypeSecuritySystem)
a := SecuritySystem{}
a.A = New(info, TypeSecuritySystem)

garage := service.NewSecuritySystem()
a.Ss = append(a.Ss, garage.S)
a.SecuritySystem = service.NewSecuritySystem()
a.AddS(a.SecuritySystem.S)

return &SecuritySystem{
A: a,
SecuritySystem: garage,
}
return &a
}
1 change: 1 addition & 0 deletions accessory/switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type Switch struct {
func NewSwitch(info Info) *Switch {
a := Switch{}
a.A = New(info, TypeSwitch)

a.Switch = service.NewSwitch()
a.AddS(a.Switch.S)

Expand Down
5 changes: 3 additions & 2 deletions accessory/television.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ type Television struct {
func NewTelevision(info Info) *Television {
a := Television{}
a.A = New(info, TypeTelevision)
a.Television = service.NewTelevision()
a.Speaker = service.NewSpeaker()

a.Television = service.NewTelevision()
a.AddS(a.Television.S)

a.Speaker = service.NewSpeaker()
a.AddS(a.Speaker.S)

return &a
Expand Down
3 changes: 1 addition & 2 deletions accessory/thermometer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ import (

type Thermometer struct {
*A

TempSensor *service.TemperatureSensor
}

// NewTemperatureSensor returns a Thermometer which implements model.Thermometer.
func NewTemperatureSensor(info Info) *Thermometer {
a := Thermometer{}
a.A = New(info, TypeThermostat)
a.TempSensor = service.NewTemperatureSensor()

a.TempSensor = service.NewTemperatureSensor()
a.AddS(a.TempSensor.S)

return &a
Expand Down
3 changes: 1 addition & 2 deletions accessory/thermostat.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ import (

type Thermostat struct {
*A

Thermostat *service.Thermostat
}

// NewThermostat returns a Thermostat accessory.
func NewThermostat(info Info) *Thermostat {
a := Thermostat{}
a.A = New(info, TypeThermostat)
a.Thermostat = service.NewThermostat()

a.Thermostat = service.NewThermostat()
a.AddS(a.Thermostat.S)

return &a
Expand Down
1 change: 1 addition & 0 deletions accessory/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type Window struct {
func NewWindow(info Info) *Window {
a := Window{}
a.A = New(info, TypeWindow)

a.Window = service.NewWindow()
a.AddS(a.Window.S)

Expand Down
1 change: 1 addition & 0 deletions accessory/window_covering.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type WindowCovering struct {
func NewWindowCovering(info Info) *WindowCovering {
a := WindowCovering{}
a.A = New(info, TypeWindowCovering)

a.WindowCovering = service.NewWindowCovering()
a.AddS(a.WindowCovering.S)

Expand Down
Loading