Git Product home page Git Product logo

hap's Introduction

hap

GoDoc Widget Travis Widget

hap (previously hc) is a lightweight library to develop HomeKit accessories in Go. It abstracts the HomeKit Accessory Protocol (HAP) and makes it easy to work with services and characteristics.

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.

Here are some projects which use hap.

What is HomeKit?

HomeKit is a set of protocols and libraries from Apple. It is used by Apple's platforms to communicate with smart home appliances. A non-commercial version of the documentation is now available on the HomeKit developer website.

HomeKit is fully integrated into iOS since iOS 8. Developers can use HomeKit.framework to communicate with accessories using high-level APIs.

Home+.app

I've developed the Home+ app to control HomeKit accessories from iPhone, iPad, and Apple Watch. If you want to support hap, please purchase Home from the App Store. That would be awesome. ❤️

Migrate from hc

This library is a rewrite of hc. If you want to migrate from hc, consider the following changes.

  • Instead of hc.NewIPTransport(...) you now call hap.NewServer(...) to create a server.
  • You can create your own persistent storage by implementing the Store interface.
  • Setting the value of a characteristic can now fail. Fixes hc#163
  • You can define custom http handlers. Fixes hc#212
server.ServeMux().HandleFunc("/ping", func(res http.ResponseWriter, req *http.Request) {
    res.Write([]byte("pong"))
})
  • You can define your own public and private key (just in case) by setting the Key field of the server. Otherwise those keys are generate and stored on disk for you.
server.Key = hap.KeyPair{
	Public:  []byte{...},
	Private: []byte{...},
}

Features

Usage

In a following example a simple on/off switch is created. It can be paired with HomeKit using the Apple Home app – use the pin code 00102003.

package main

import (
	"github.com/brutella/hap"
	"github.com/brutella/hap/accessory"

	"context"
	"log"
	"os"
	"os/signal"
	"syscall"
)

func main() {
	// Create the switch accessory.
	a := accessory.NewSwitch(accessory.Info{
		Name: "Lamp",
	})

	// Store the data in the "./db" directory.
	fs := hap.NewFsStore("./db")

	// Create the hap server.
	server, err := hap.NewServer(fs, a.A)
	if err != nil {
		// stop if an error happens
		log.Panic(err)
	}

	// Setup a listener for interrupts and SIGTERM signals
	// to stop the server.
	c := make(chan os.Signal)
	signal.Notify(c, os.Interrupt)
	signal.Notify(c, syscall.SIGTERM)

	ctx, cancel := context.WithCancel(context.Background())
	go func() {
		<-c
		// Stop delivering signals.
		signal.Stop(c)
		// Cancel the context to stop the server.
		cancel() 
	}()

	// Run the server.
	server.ListenAndServe(ctx)
}

Events

The library provides callback functions, which let you know when a client updates a characteristic value. The following example shows how to get notified when the On characteristic value changes.

a.Switch.On.OnValueRemoteUpdate(func(on bool) {
    if on == true {
        log.Println("Switch is on")
    } else {
        log.Println("Switch is off")
    }
})

If you want to change the state of a switch programmatically, you call SetValue(...).

a.Switch.On.SetValue(true)

The library takes care of the rest and notifies all connected clients that the state has changed.

Multiple Accessories

When you create a server you can specify multiple accessories like this.

var a1, a2, a3 *accessory.A
s, err := hap.NewServer(fs, a1, a2, a3)

By doing so, the first accessory a1 appears as a bridge in HomeKit. When adding the accessories to HomeKit, iOS only shows the bridge accessory. Once the bridge was added, the other accessories appear automatically.

HomeKit requires that every accessory has a unique id, which must not change between system restarts. hap automatically assigns the ids for you based on the order in which the accessories are added to the server.

The best would be to specify the unique id for every accessory yourself, like this

a1.Id = 1
a2.Id = 2

Accessory Architecture

HomeKit uses a hierarchical architecture to define accessories, services and characeristics. At the root level there is an accessory. Every accessory contains services. And every service contains characteristics.

For example a lightbulb accessory contains a lightbulb service. This service contains the on characteristic.

There are predefined accessories, services and characteristics available in HomeKit. Those types are defined in the packages accessory, service, characteristic.

Contact

Matthias Hochgatterer

Website: https://hochgatterer.me

Github: https://github.com/brutella

Twitter: https://twitter.com/brutella

License

hap is available under the Apache License 2.0 license. See the LICENSE file for more info.

hap's People

Contributors

0x5e avatar asedov avatar brutella avatar caarlos0 avatar dependabot[bot] avatar geekman avatar itsnotgoodname avatar rblenkinsopp avatar saljam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hap's Issues

[Question] Windows Shutter process

Hello again,
I'm trying to build a gateway with my shutters.
I just want some clarification about the process to update / get update with a WindowsCovering device.

  1. As I understand it CurrentPosition is the actual position of the shutter. TargetPosition is the desired value when you use the Homekit UI. Is That correct?

My Actual process is the following:

  • On TargetPosition.OnValueRemoteUpdate event is received I activate the shutter.
    When I receive a confimation that the shutter reached the desired position, I SetValue on CurrentPosition.

  • If the shutter is manually positionned, I SetValue on CurrentPosition

  1. Do I need to SetValue on TargetPosition? and when?

  2. Does PositionState need to be updated as well? Or is it handeled by the protocol?

Thanks for your time

pairings.go:41: tlv8: EOF

Hello:
When I was using the latest version of development, I found that if my home app added a bridge and device, when I removed the bridge, the following message would be displayed:
INFO 2023/02/08 17:26:10 pairings.go:41: tlv8: EOF
At this point, it appears in my home application that the bridge is unbound; however, it is not the home application can no longer discover the bridge; and there is still a.pairing file in the db folder of the application directory. This issue appears after version 0.0.18
I hope you can help me answer this question.
It's a great project

Usage example from readme cannot gracefully exit the app

OS: MacOS Sonoma, MacOS Ventrura
hap v0.0.27

Calling cancel() doesn't make it gracefully exit from server.ListenAndServe(ctx).

I added some logging

	ctx, cancel := context.WithCancel(context.Background())
	go func() {
		<-c
		// Stop delivering signals.
		signal.Stop(c)
		println("stopping")
		// Cancel the context to stop the server.
		cancel()
	}()

	// Run the server.
	println("starting")
	if err = server.ListenAndServe(ctx); err != nil {
		println(err.Error())
	}
	println("stopped")

Result:

starting
^Cstopping
^C

Application exits with return value 130 after second Crtl+C.

PS: Linux is not affected

Manually setting the accessory ID causes accessory to be unresponsive

I'm working on an integration between HomeKit and KNX at home. This all works really really well and your library is a joy to work with! 🎉

I have my bridge deployed to a local k3s cluster and I'd like to make it possible to move the bridge between machines. In theory that should be possible, as you mention in the readme (https://github.com/brutella/hap#multiple-accessories). Ideally, if the state is accessible and the accessory IDs don't change I should be good.

However, as soon as I manually set an ID – even if the bridge only has a single accessory, the pairing apparently doesn't finish and the Home app lists the accessory as unresponsive. When I drop that single line setting the accessory ID, clear the local state (in ./fs) and re-add the bridge, everything works.

Do you have any idea what could be causing this? I've read about the disaster with the Home architecture change in iOS 16.2. I migrated to the new architecture a long time ago – but I also didn't have any Matter devices so it went smoothly without any issues. I've tried unplugging all of the home hubs (HomePods, an Apple TV) and only left the iPad Pro on but that didn't have any impact. I keep all the devices up to date (everything on 17.2 as of this writing).

Where should I be looking to debug this? Thank you again for this awesome project.

Some Characteristics not shown on iPhone/MacOS

I just created a Television accessory. I noticed that it has a Speaker service with Mute characteristic. But on the iPhone/MacOS, I only see a On/Off button, where did the mandatory Mute button go? Also, I tried to add a Volume to Speaker, it doesn't show too. Where did they go?

dns-sd name conflict resolution leads to space in name, causing malformed host header and failure to pair

First off: love this package! Recently I tried to re-pair an accessory. Pairing with the Home app times out. With the hkontroller example app it pairs successfully. I made a packet dump, and I found the following difference.

hkontroller sets an empty host header, whereas the Home app send Host: Incomfort_Gateway\0322._hap._tcp.local. Go's http server doesn't like that, responding with a 400 Bad Request: malformed Host header.

Now, I'm not sure who's at fault here. Btw, dns-sd -Z _hap._tcp local. returns

_hap._tcp                                       PTR     Incomfort_Gateway\0322._hap._tcp
Incomfort_Gateway\0322._hap._tcp                SRV     0 0 33133 BB804B1E71D9\0322.local. ; Replace with unicast FQDN of target host
Incomfort_Gateway\0322._hap._tcp                TXT     "c#=2" "ci=9" "ff=0" "id=BB:80:4B:1E:71:D9" "md=Incomfort Gateway" "pv=1.0" "s#=1" "sf=0" "sh=5oin+Q=="

Cannot see accessory: DNS probing gets stuck

I tried the example from the README and noticed I couldn't see the accessory in the Home App. I investigated and it turns out this code stops returning after a few iterations: https://github.com/brutella/dnssd/blob/4e37bfa22baa4db533e2e2a231db031ab00cf36d/probe.go#L174.

Also, reading from the response channel never kicks off so I assume a response is never received?

I could have opened this in the dnssd repo but I was only able to reproduce this with hap.

Dynamic device resolution

Hey @brutella 👋

First of I all would like to thank you! I just started playing around with this library and I finally added some glue code to my own library and was able to create a simple home-automation app with device auto discovery within an hour! 👏

Also the possibility to add an external data-storage is great, so I can easily run this within a container and won't have to worry about local filesystems. 👏

Nevertheless it seems like I have run into a problem:I am trying to autodetect my devices.

I am doing something like that:

devices, _ := hs100.Discover("192.168.2.0/24", configuration.Default().WithTimeout(3*time.Second))
var plugs []*accessory.A
for _, d := range devices {
     plugs = append(plugs, toPlug(d).A)
}

server, err := hap.NewServer(fs, accessory.NewBridge(accessory.Info{
     Name: "bridge",
}).A, plugs...)

...

func toPlug(d *hs100.Hs100) *accessory.Switch {
	info, err := d.GetInfo()
	if err != nil {
		panic(err)
	}
	
	result := accessory.NewSwitch(accessory.Info{
		Name:         info.Name,
		SerialNumber: info.DeviceId,
	})

	result.Switch.On.ValueRequestFunc = func(request *http.Request) (value interface{}, code int) {
		if isOn, err := d.IsOn(); err != nil {
			// please ignore the wrong return code
                        return false, -1
		} else {
			return isOn, 0
		}
	}

	result.Switch.On.OnSetRemoteValue(func(v bool) error {
		if v == true {
			return d.TurnOn()
		} else {
			return d.TurnOff()
		}
	})
	
	return result
}

This auto-creates the accessories with a consistent name + serialnumber (idempotent action). Sadly the order of the detected devices is not idempotent as there is no order and devices may be added or removed.

When restarting the services, I have noticed that the name of the Home-App was not matching to the actor anymore. I believe that's because of the id generation of the accessories.

I tried to work my way around this by manually generating a unique accessory id before starting the server, but that feels like I am having to much knowledge of what is going on inside of hap.

Maybe you can share some thoughts about potential solutions or maybe my use-case is just unsupported.

Thanks and best regards,
Dennis

Thermostat

Hi, many thanks for this great library, it already serves me to connect my Dali lights to HomeKit. I now want to add some Thermostats that shall only be heater or off. With the Thermostat service they appear as off, heater, cooler or auto in the home app. How can I constrain the Thermostat to be heater or off only?
Many thanks for pointers in advance.

Add interfaces on dnssd service

I suggest a new configuration value of the server to the dnssd service.
The new value is a list of interface names used by dnsssd service to publish the correct ip when it exposes the hap service.

The problem, for me, is that the raspberry where I deploy the hap server has a multiple interfaces: one for the lan and the second for the iot devices. My firewall configuration blocks all the iot traffic (192.168.20.0/24) to the regular lan (192.168.1.00/24).
When the dnssd server goes up it uses all the interfaces on the device so the pairing with the iphone fails.
I suppose that when the iphone starts pairing it uses the iot lan ip, that cannot reach the lan networks.

Screenshot 2023-01-02 alle 15 28 28

The change I suggest is to add the new value to the server configuration that will be used on dnssd.Config.Ifaces into the file server.go at line 479.

No reponse and not responding

Hi, when i run an example with the hap library, there is no problem adding the device to home app. But after a while, home app will show the device "no response" or "not responding" and can not control it.

I have tried a few workarounds, including turning off the iphone's Private WLAN Address, tweaking the router, but none of them worked.

Here is my example:

package main

import (
	"fmt"
	"net/http"

	dnslog "github.com/brutella/dnssd/log"
	"github.com/brutella/hap"
	"github.com/brutella/hap/accessory"

	"context"
	"log"
	"os"
	"os/signal"
	"syscall"
)

func main() {
	dnslog.Debug.Enable()

	// Create the switch accessory.
	a := accessory.NewSwitch(accessory.Info{
		Name: "Lamp",
	})

	// Store the data in the "./db" directory.
	fs := hap.NewFsStore("./db")

	// Create the hap server.
	server, err := hap.NewServer(fs, a.A)
	if err != nil {
		// stop if an error happens
		log.Panic(err)
	}

	a.Switch.On.OnValueRemoteUpdate(func(on bool) {
		a.Switch.On.SetValue(on)
		if on == true {
			fmt.Println("Switch is on")
		} else {
			fmt.Println("Switch is off")
		}
	})

	a.Switch.On.OnValueUpdate(func(old, new bool, req *http.Request) {
		fmt.Println("OnValueUpdate")
	})

	// Setup a listener for interrupts and SIGTERM signals
	// to stop the server.
	c := make(chan os.Signal)
	signal.Notify(c, os.Interrupt)
	signal.Notify(c, syscall.SIGTERM)

	ctx, cancel := context.WithCancel(context.Background())
	go func() {
		<-c
		// Stop delivering signals.
		signal.Stop(c)
		// Cancel the context to stop the server.
		cancel()
	}()

	// Run the server.
	server.ListenAndServe(ctx)
}

Here is some debug output:

DEBUG 2022/12/02 12:11:16.185302 No response
DEBUG 2022/12/02 12:11:16.185365 No answers
DEBUG 2022/12/02 12:11:16.185422 Lamp._hap._tcp.local. tries to give response to question {_pdl-datastream._tcp.local. 12 1}
DEBUG 2022/12/02 12:11:16.185460 No response
DEBUG 2022/12/02 12:11:16.185482 No answers
DEBUG 2022/12/02 12:11:16.185512 Lamp._hap._tcp.local. tries to give response to question {_rdlink._tcp.local. 12 1}
DEBUG 2022/12/02 12:11:16.185549 No response
DEBUG 2022/12/02 12:11:16.185565 No answers
DEBUG 2022/12/02 12:11:16.185587 Lamp._hap._tcp.local. tries to give response to question {_daap._tcp.local. 12 1}
DEBUG 2022/12/02 12:11:16.185615 No response
DEBUG 2022/12/02 12:11:16.185630 No answers
DEBUG 2022/12/02 12:11:16.185651 Lamp._hap._tcp.local. tries to give response to question {_touch-remote._tcp.local. 12 1}
DEBUG 2022/12/02 12:11:16.185679 No response
DEBUG 2022/12/02 12:11:16.185708 No answers
DEBUG 2022/12/02 12:11:16.185731 Lamp._hap._tcp.local. tries to give response to question {_apple-mobdev._tcp.local. 12 1}
DEBUG 2022/12/02 12:11:16.185759 No response
DEBUG 2022/12/02 12:11:16.185774 No answers
DEBUG 2022/12/02 12:11:16.185797 Lamp._hap._tcp.local. tries to give response to question {93fa07db._sub._apple-mobdev2._tcp.local. 12 1}
DEBUG 2022/12/02 12:11:16.185826 No response
DEBUG 2022/12/02 12:11:16.185841 No answers
DEBUG 2022/12/02 12:11:16.185863 Lamp._hap._tcp.local. tries to give response to question {_apple-pairable._tcp.local. 12 1}
DEBUG 2022/12/02 12:11:16.185892 No response
DEBUG 2022/12/02 12:11:16.185907 No answers

Can't use Thermostat with custom min temperature

Hi!
When I create Thermostat accessory and set target temperature min value to 17 then I can't add it to Home app - it return error "Accessory is out of compliance". Can you help me please how to handle it?

Using a bridge causes the state of the device in the Apple home app to be out of sync

Using the bridge, the device status in the Apple home app is no longer synchronized after the state changes several times, and it needs to be controlled before it will be synchronized。

func main() {

	a := accessory.NewBridge(accessory.Info{
		Name: "Bridge",
	})

	b := accessory.NewSwitch(accessory.Info{
		Name: "Lamp",
	})

	d := accessory.NewSwitch(accessory.Info{
		Name: "Lamp1",
	})

	s, err := hap.NewServer(hap.NewFsStore("./db"), a.A, b.A, d.A)
	if err != nil {
		log.Panic(err)
	}

	// Log to console when client (e.g. iOS app) changes the value of the on characteristic
	b.Switch.On.OnValueRemoteUpdate(func(on bool) {
		if on {
			log.Println("Client changed switch to on")
		} else {
			log.Println("Client changed switch to off")
		}
	})

	s.Pin = "34679023"

	// Periodically toggle the switch's on characteristic
	go func() {
		for {
			on := !b.Switch.On.Value()
			if on {
				log.Println("Switch is on")
			} else {
				log.Println("Switch is off")
			}
			b.Switch.On.SetValue(on)
			time.Sleep(5 * time.Second)
		}
	}()

	c := make(chan os.Signal)
	signal.Notify(c, os.Interrupt)
	signal.Notify(c, syscall.SIGTERM)

	ctx, cancel := context.WithCancel(context.Background())
	go func() {
		<-c
		signal.Stop(c)
		cancel()
	}()

	s.ListenAndServe(ctx)
}

Remove the first bridge a, then the status in the Apple home app is synchronized no matter how the value is set

What causes this?

Actions connected to ProgrammableSwitchEvent not working

Thank you for the great work!

I'm building a simple MQTT -> HomeKit bridge using this library. I created a StatelessProgrammableSwitch accessory to expose a pushbutton:

acc := accessory.New(accessory.Info{
    Name: "hello",
}, accessory.TypeProgrammableSwitch)
s := service.NewStatelessProgrammableSwitch()
acc.AddS(s.S)

I can send events on this switch with the following:

s.ProgrammableSwitchEvent.SetValue(characteristic.ProgrammableSwitchEventSinglePress)

This seems to work: the home app highlights the "single press" menu item when I press the button.

However, actions connected to the button press are not working (ie nothing happens).

  • I've tried connecting to both other hap accessories or standalone items. Neither works.
  • "Test action" works, so I supposed the output plumbing is working.

Is there any missing piece that allows homekit to trigger actions based on the change of characteristic?

Problem pairing: Unable to Add Accessory (out of compliance).

Hi!

I've been using hc library for some time now - many thanks for creating and maintaining it! :)

Recently I migrated my application from hc to hap and after doing that I receive following error when I try to add new accessory to my Home:

Unable to Add Accessory
Accessory is out of compliance.

Something I newer saw before in HomeKit.

I tried to set hap.Server.MfiCompliant to true - after doing that, connecting to bridge is not finishing, after few minutes I see 'Accessory is not reachable' error.

I upgraded my Home to new architecture in iOS 16, maybe that could be the issue?
I'll appreciate any help with that issue.

Hubert

Getting access to C.setValue()?

Thanks for writing hc/hap! I'm writing a bridge using hap, similar to hkknx (I think). After creating a Service instance, for example service.NewTemperatureSensor(), I'm then storing the relevant mapped characteristic s.CurrentTemperature.C into something like a map[string]*characteristic.C to manage centrally. When I receive an update to the temperature, I would like to translate and store the value into the characteristic. I believe it's easier to switch on c.Format than to figure out if it's cast-able to a Bool or Int.

While I can set the value directly into c.Val, I lose the various functions performed by c.setValue(), such as the "type conversion", clampFloat/Int, and the firing of valUpdateFuncs which I believe is what sends notifications to clients. If I call c.SetValueRequest() it will fail in this case because the temperature characteristic is not writable.

Is trying to call c.setValue() the right thing to do here? Am I missing something? One possible solution might be to change the check in SetValueRequest to !c.IsWritable && req != nil to only block writing for remote requests.

hap does not support multiple servers/bridges

	server, err := hap.NewServer(store, newBridge.A, a...)
	if err != nil {
		// stop if an error happens
		c.log.Printf("Error creating HAP Bridge '%s'", group)
	}
	server.Pin = "111111" // fake
	c.log.Printf("Starting HAP Bridge '%s' with %d devices", group, len(a))
	ctx, _ := context.WithCancel(context.Background()) // TODO implement cancel in top
	err = server.ListenAndServe(ctx)

Multiple bridges with accessories are supported by multiple servers only. So creating a new bridge and assign it to a new server will start listening on random ports. While the bridges all appear on the Home App 'Add new device', only one bridge can be added. When trying to add a second one, the Home App waits to connect and runs into an timeout. All server appear correctly in the DNS viewer. Is there a way to have multiple bridges?

dnssd Name Conflict Resolution results in HTTP Bad Request

Actually I'm not sure if I should file this in dnssd or hap, but I think the issue is unique to hap, so it's filed here.

When dnssd detects that a hostname is in use, it then tries to pick a different name by appending a space & number "%s %d", which is probably what iOS does too:

https://github.com/brutella/dnssd/blob/8574d113aa9e847409d25d90ac0ba1e0512f601c/probe.go#L76-L86

In doing so, the hostname now contains a space and HomeKit encodes the space as \032 in the Host: header which results in an invalid hostname under HTTP, so the http parser replies with an error. Related issue #9.

There's already an attempt to avoid spaces by replacing the server/accessory name before passing it to dnssd, but in this case the spaces were added by dnssd:

hap/server.go

Lines 509 to 519 in 1a3e48c

stripped := strings.Replace(s.a.Info.Name.Value(), " ", "_", -1)
cfg := dnssd.Config{
Name: removeAccentsFromString(stripped),
Type: "_hap._tcp",
Domain: "local",
Host: strings.Replace(s.uuid, ":", "", -1), // use the id (without the colons) to get unique hostnames
Text: s.txtRecords(),
Port: s.port,
Ifaces: s.Ifaces,
}

I'm not sure that iOS will fix this issue anytime soon (or at all), so maybe hap/dnssd should try to avoid generating such names. Maybe dnssd could defer to the caller (hap, in this case) for conflict resolution strategies, where it could send back "-" + random_hex_str instead of using " %d".

tlv8: unmarshal (silent) bug

Servus,

as previously mentioned, I have been playing with hap as well and used your library to test the correctness of my implementation.

While trying to debug my tlv8 unmarshal implementation, I found a bug in the tlv8.Unmarshal function. Please find below a test which marshals a struct, unmarshals it and compare the initial and final structs.

func TestMarhsalUnmarshalDefaultVideoStreamConfiguration(t *testing.T) {
	want := rtp.DefaultVideoStreamConfiguration()
	buf, err := Marshal(want)
	if err != nil {
		t.Fatal(err)
	}

	var is rtp.VideoStreamConfiguration
	err = Unmarshal(buf, &is)
	if err != nil {
		t.Fatal(err)
	}

	if reflect.DeepEqual(is, want) == false {
		t.Fatalf("is=%+v want=%+v", is, want)
	}
}

I get the following error (as you can see the Parameters, Levels and other attributes differ):

is={Codecs:[{Type:0 Parameters:{Profiles:[] Levels:[] Packetizations:[]} Attributes:[{Width:1920 Height:1080 Framerate:30} {Width:1280 Height:720 Framerate:30} {Width:640 Height:360 Framerate:30} {Width:480 Height:270 Framerate:30} {Width:320 Height:180 Framerate:30} {Width:1280 Height:960 Framerate:30} {Width:1024 Height:768 Framerate:30} {Width:640 Height:480 Framerate:30} {Width:480 Height:360 Framerate:30} {Width:320 Height:240 Framerate:15}]}]}

want={Codecs:[{Type:0 Parameters:{Profiles:[{Id:0} {Id:1} {Id:2}] Levels:[{Level:0} {Level:1} {Level:2}] Packetizations:[{Mode:0}]} Attributes:[{Width:1920 Height:1080 Framerate:30} {Width:1280 Height:720 Framerate:30} {Width:640 Height:360 Framerate:30} {Width:480 Height:270 Framerate:30} {Width:320 Height:180 Framerate:30} {Width:1280 Height:960 Framerate:30} {Width:1024 Height:768 Framerate:30} {Width:640 Height:480 Framerate:30} {Width:480 Height:360 Framerate:30} {Width:320 Height:240 Framerate:15}]}]}

FYI, my tlv8 implementation is split in 2 steps:

  1. construct an (un)marshaller based exclusively on the reflect.Type (a nested tree of func(io.Reader, reflect.Value) error)
  2. call this (un)marshaller with the reflect.Value

This way, the first step can be cached based on the type and the whole process is a bit cleaner and faster.


I will never repeat it enough: huge thanks for your amazing work on this library!

Returning "comm failure" for 1 characteristic renders entire bridge unresponsive

I'm not sure if this behaviour is expected, but I'm trying to mark some accessories on my bridge as "no response" if they have not been seen in a while. I set a ValueRequestFunc and return JsonStatusServiceCommunicationFailure for that particular device, hoping that iOS will mark that device as not responding, but iOS ended up marking the entire bridge and all its accessories as not responding.

Test code is here:

package main

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

	haplog "github.com/brutella/hap/log"

	"context"
	"fmt"
	"net/http"
)

func main() {
	store := hap.NewFsStore("./db")
	bridge := accessory.NewBridge(accessory.Info{Name: "hap test bridge"})

	s1 := accessory.New(accessory.Info{Name: "Temp Sensor 1"}, accessory.TypeSensor)
	s1.AddS(service.NewTemperatureSensor().S)

	s2 := accessory.New(accessory.Info{Name: "Temp Sensor 2"}, accessory.TypeSensor)
	temp := service.NewTemperatureSensor()
	// return comms failure on sensor 2
	temp.CurrentTemperature.ValueRequestFunc = func(req *http.Request) (any, int) {
		return temp.CurrentTemperature.Val, hap.JsonStatusServiceCommunicationFailure
	}
	s2.AddS(temp.S)

	server, err := hap.NewServer(store, bridge.A, s1, s2)
	if err != nil {
		panic(err)
	}

	fmt.Println("pin 0010-2003")

	haplog.Debug.Enable()

	server.ListenAndServe(context.Background())
}

In Home app, it looks like this:
screenshot

When I remove the code to return comm failure, both accessories are accessible.

In trying to debug this issue I used haplog.Debug.Enable() but it doesn't seem to show any requests that iOS is making that it would know the device is no responding. Or maybe I'm just not familiar enough with the HAP protocol. I've added the log here:

$ go run t.go
pin 0010-2003
DEBUG 2023/05/15 08:26:24 server.go:228: listening at [::]:32849
DEBUG 2023/05/15 08:26:29 logger.go:161: "POST http://hap_test_bridge._hap._tcp.local/pair-verify HTTP/1.1" from :49240 - 200 140B in 2.017539ms
DEBUG 2023/05/15 08:26:29 logger.go:161: "POST http://hap_test_bridge._hap._tcp.local/pair-verify HTTP/1.1" from :49240 - 200 3B in 1.338635ms
DEBUG 2023/05/15 08:26:29 accessories.go:25: {"accessories":[{"aid":1,"services":[{"iid":1,"type":"3E","characteristics":[{"iid":2,"type":"14","perms":["pw"],"format":"bool"},{"iid":3,"type":"20","perms":["pr"],"format":"string","value":"-"},{"iid":4,"type":"21","perms":["pr"],"format":"string","value":"-"},{"iid":5,"type":"23","perms":["pr"],"format":"string","value":"hap test bridge"},{"iid":6,"type":"30","perms":["pr"],"format":"string","value":"-"},{"iid":7,"type":"52","perms":["pr"],"format":"string","value":"-"}]}]},{"aid":2,"services":[{"iid":1,"type":"3E","characteristics":[{"iid":2,"type":"14","perms":["pw"],"format":"bool"},{"iid":3,"type":"20","perms":["pr"],"format":"string","value":"-"},{"iid":4,"type":"21","perms":["pr"],"format":"string","value":"-"},{"iid":5,"type":"23","perms":["pr"],"format":"string","value":"Temp Sensor 1"},{"iid":6,"type":"30","perms":["pr"],"format":"string","value":"-"},{"iid":7,"type":"52","perms":["pr"],"format":"string","value":"-"}]},{"iid":8,"type":"8A","characteristics":[{"iid":9,"type":"11","perms":["pr","ev"],"format":"float","value":0,"unit":"celsius","maxValue":100,"minValue":0,"minStep":0.1}]}]},{"aid":3,"services":[{"iid":1,"type":"3E","characteristics":[{"iid":2,"type":"14","perms":["pw"],"format":"bool"},{"iid":3,"type":"20","perms":["pr"],"format":"string","value":"-"},{"iid":4,"type":"21","perms":["pr"],"format":"string","value":"-"},{"iid":5,"type":"23","perms":["pr"],"format":"string","value":"Temp Sensor 2"},{"iid":6,"type":"30","perms":["pr"],"format":"string","value":"-"},{"iid":7,"type":"52","perms":["pr"],"format":"string","value":"-"}]},{"iid":8,"type":"8A","characteristics":[{"iid":9,"type":"11","perms":["pr","ev"],"format":"float","unit":"celsius","maxValue":100,"minValue":0,"minStep":0.1}]}]}]}
DEBUG 2023/05/15 08:26:29 logger.go:161: "GET http://hap_test_bridge._hap._tcp.local/accessories HTTP/1.1" from :49240 - 200 1744B in 1.573594ms

I assumed that it would call GET /characteristics and that is where the ValueRequestFunc can be called, but it seems to only call GET /accessories and from that it somehow knows the bridge is unresponsive?

On a functioning bridge, it seems to call PUT /characteristics next, to register callbacks for the value changes I think.

Connection issues when using Chinese characters

package main

import (
	"fmt"
	"github.com/brutella/hap"
	"github.com/brutella/hap/accessory"
	"golang.org/x/text/secure/precis"
	"golang.org/x/text/transform"
	"golang.org/x/text/unicode/norm"
	"strings"
	"unicode"

	"context"
	"log"
	"os"
	"os/signal"
	"syscall"
)

// RemoveAccentsFromString removes accent characters from string
// From https://stackoverflow.com/a/40405242/424814
func removeAccentsFromString(v string) string {
	var loosecompare = precis.NewIdentifier(
		precis.AdditionalMapping(func() transform.Transformer {
			return transform.Chain(norm.NFD, transform.RemoveFunc(func(r rune) bool {
				return unicode.Is(unicode.Mn, r)
			}))
		}),
		precis.Norm(norm.NFC), // This is the default; be explicit though.
	)
	p, _ := loosecompare.String(v)
	return p
}

func main() {
	fmt.Println(removeAccentsFromString("智能开关"))
	// Create the switch accessory.
	a := accessory.NewSwitch(accessory.Info{
		Name:         removeAccentsFromString(strings.Replace("智能开关", " ", "", -1)),
		SerialNumber: "974588889",
	})

	// Store the data in the "./db" directory.
	fs := hap.NewFsStore("./db")

	// Create the hap server.
	server, err := hap.NewServer(fs, a.A)
	if err != nil {
		// stop if an error happens
		log.Panic(err)
	}

	server.Pin = "88889999"

	// Setup a listener for interrupts and SIGTERM signals
	// to stop the server.
	c := make(chan os.Signal)
	signal.Notify(c, os.Interrupt)
	signal.Notify(c, syscall.SIGTERM)

	ctx, cancel := context.WithCancel(context.Background())
	go func() {
		<-c
		// Stop delivering signals.
		signal.Stop(c)
		// Cancel the context to stop the server.
		cancel()
	}()

	// Run the server.
	server.ListenAndServe(ctx)
}

When attempting to connect in Chinese, there is an issue of inability to establish a connection. During pairing, a prompt indicating loss of connection is received. However, when using a non-Chinese language, the connection proceeds successfully, yet the device shows no response.

Build window fail

goroutine 18 [running]:
github.com/brutella/dnssd.(*Service).IPsAtInterface(0xc0000736b8, 0x0)
        D:/***/github.com/brutella/dnssd@v1.2.2/service.go:150 +0x3d
github.com/brutella/dnssd.A({{0xc000212020, 0x4}, {0x6d4654, 0x9}, {0x6d3039, 0x5}, {0xc000212024, 0xc}, 0xc000206120, 0x0, ...}, ...)
        D:/***/github.com/brutella/dnssd@v1.2.2/dns.go:116 +0x39
github.com/brutella/dnssd.containsConflictingAnswers(0xc000406090, 0xc000214020)
        D:/***/github.com/brutella/dnssd@v1.2.2/responder.go:465 +0xbb
github.com/brutella/dnssd.findConflicts(0xc000406090, {0xc00040a010, 0x1, 0x1?})
        D:/***/github.com/brutella/dnssd@v1.2.2/responder.go:446 +0x9b
github.com/brutella/dnssd.(*responder).handleRequest(0xc000210000, 0xc000406090)
        D:/***/github.com/brutella/dnssd@v1.2.2/responder.go:238 +0x195
github.com/brutella/dnssd.(*responder).respond(0xc000210000, {0x775710, 0xc00022c040})
        D:/***/github.com/brutella/dnssd@v1.2.2/responder.go:203 +0x1d4
github.com/brutella/dnssd.(*responder).Respond(0xc000210000, {0x775710, 0xc00022c040})
        D:/***/github.com/brutella/dnssd@v1.2.2/responder.go:113 +0x3ef
github.com/brutella/hap.(*Server).listenAndServe.func1()
        D:/***/github.com/brutella/hap@v0.0.14/server.go:205 +0x37
created by github.com/brutella/hap.(*Server).listenAndServe
        D:/***/github.com/brutella/hap@v0.0.14/server.go:204 +0x465

Process finished with the exit code 2

Same question brutella/hc#201

Server does not appear to do any service annoucement via DNS-SD

I'm running the example in the README usage section; the server starts and is listening but does not appear to be doing any service announcement and therefore never can be paired in the Home app.

If I run dns-sd -B _hap._tcp it does not appear.

I tried the hklamp example from the previous library hc and it worked fine and did show up when running dns-sd -B _hap._tcp so I feel that I can rule out my setup/system/network.

HAP Devices are switching rooms

Hello,

I have no idea what's causing this, but after some days, my devices are switching rooms.
I move them back, but after a while it starts again, all rooms are completely messed up.
I don't have any "official" HomeKit device, so I don't know if this is only related to hap devices or not.

Anybody already noticed that as well?

MethodDeletePairing doesn't work correctly

maybe it's my problem
I have 7 users at home
adding an accessory works correctly, but if I remove the accessory, not all .pairing files are removed, after the accessory is not added again

before pairing

pi@ap2dev:~/test/EX-Switch $ ls
  configHash
  keypair
  schema
  uuid
  version
pi@ap2dev:~/test/EX-Switch $

after pairing

pi@ap2dev:~/test/EX-Switch $ ls
39383141433539452d394636462d344644332d423532432d453631373731303439364342.pairing  
31363039453845302d383830362d343935372d393746362d353842374132414241423146.pairing
44323039333344452d343032342d343230422d423636392d313234314243374639343731.pairing
35443739454338352d463336442d343634462d413436422d303430374236423145414445.pairing
44414432383334432d383641302d344142312d423442372d393834433230363234393430.pairing  
36364530414234412d383130392d343142442d414241392d444642343046423338313334.pairing
46393330423233432d463436312d343845452d384234352d433139413846364241384533.pairing  
configHash
keypair
schema
uuid
version
pi@ap2dev:~/test/EX-Switch $

after removal

pi@ap2dev:~/test/EX-Switch $ ls
31363039453845302d383830362d343935372d393746362d353842374132414241423146.pairing
44414432383334432d383641302d344142312d423442372d393834433230363234393430.pairing
39383141433539452d394636462d344644332d423532432d453631373731303439364342.pairing
46393330423233432d463436312d343845452d384234352d433139413846364241384533.pairing
configHash
keypair
schema
uuid
version
pi@ap2dev:~/test/EX-Switch $

LOG

pi@ap2dev:~/test $ ./switch
13:49:49 [ EX-Switch / Switch ] hap server create successful.
13:49:49 [ EX-Switch / Switch ] hap server starting set, address :10102, pin 13467908.
13:49:49 [HAP_DBG]listening at [::]:10102
13:50:09 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-setup HTTP/1.1" from 192.168.1.100:54313 - 200 409B in 177.522883ms
13:50:16 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-setup HTTP/1.1" from 192.168.1.100:54313 - 200 69B in 196.121612ms
13:50:16 [HAP_DBG]{"Identifier":"66E0AB4A-8109-41BD-ABA9-DFB40FB38134","PublicKey":"G7SS+jNl/tQ1jLTFMUF9leRRbm2VW+GfDpa0fWerdng=","Signature":"ASeqt7Zy3WK3/vOuPD1HofU1cCXP0l3c9mCbnHBzTjQsWb5V/GClCWpwb7sOeBBEnyAGgwgUC4+bTZn3yrIkDQ=="}
13:50:16 [HAP_DBG]ed25519 signature valid
13:50:16 [HAP_DBG]storing public key for 66E0AB4A-8109-41BD-ABA9-DFB40FB38134
13:50:17 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-setup HTTP/1.1" from 192.168.1.100:54313 - 200 140B in 1.123627018s
13:50:18 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.100:54314 - 200 140B in 20.987468ms
13:50:18 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.100:54314 - 200 3B in 9.517566ms
13:50:18 [HAP_DBG]{"accessories":[{"aid":1,"services":[{"iid":1,"type":"3E","characteristics":[{"iid":2,"type":"14","perms":["pw"],"format":"bool"},{"iid":3,"type":"20","perms":["pr"],"format":"string","value":"alpr777"},{"iid":4,"type":"21","perms":["pr"],"format":"string","value":"HAP-SW"},{"iid":5,"type":"23","perms":["pr"],"format":"string","value":"Switch"},{"iid":6,"type":"30","perms":["pr"],"format":"string","value":"EX-Switch"},{"iid":7,"type":"52","perms":["pr"],"format":"string","value":"1.2.3"}]},{"iid":8,"type":"49","characteristics":[{"iid":9,"type":"25","perms":["pr","pw","ev"],"format":"bool","value":false}]}]}]}
13:50:18 [HAP_DBG]"GET http://Switch._hap._tcp.local/accessories HTTP/1.1" from 192.168.1.100:54314 - 200 617B in 1.149214ms
13:50:18 [HAP_DBG]{"characteristics":[{"aid":1,"iid":9,"ev":true}]}
13:50:18 [HAP_DBG]"PUT http://Switch._hap._tcp.local/characteristics HTTP/1.1" from 192.168.1.100:54314 - 204 0B in 729.372µs
13:50:18 [HAP_DBG]{"characteristics":[{"aid":1,"iid":9,"ev":true}]}
13:50:18 [HAP_DBG]"PUT http://Switch._hap._tcp.local/characteristics HTTP/1.1" from 192.168.1.100:54314 - 204 0B in 294.269µs
13:50:18 [HAP_DBG]{"characteristics":[{"aid":1,"iid":3,"value":"alpr777"},{"aid":1,"iid":4,"value":"HAP-SW"},{"aid":1,"iid":6,"value":"EX-Switch"},{"aid":1,"iid":7,"value":"1.2.3"}]}
13:50:18 [HAP_DBG]"GET http://Switch._hap._tcp.local/characteristics?id=1.3,1.4,1.6,1.7 HTTP/1.1" from 192.168.1.100:54314 - 200 164B in 881.507µs
13:50:19 [HAP_DBG]send event to 192.168.1.100:54314:
EVENT/1.0 200 OK
Content-Length: 52
Content-Type: application/hap+json

{"characteristics":[{"aid":1,"iid":9,"value":true}]}
13:50:19 [ EX-Switch / Switch ] acc switch update on: bool - true
13:50:19 [HAP_DBG]add pairing D20933DE-4024-420B-B669-1241BC7F9471
13:50:20 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54314 - 200 3B in 1.003771875s
13:50:20 [HAP_DBG]add pairing 5D79EC85-F36D-464F-A46B-0407B6B1EADE
13:50:21 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54314 - 200 3B in 1.003172295s
13:50:22 [HAP_DBG]add pairing DAD2834C-86A0-4AB1-B4B7-984C20624940
13:50:23 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54314 - 200 3B in 1.005519422s
13:50:23 [HAP_DBG]add pairing 981AC59E-9F6F-4FD3-B52C-E617710496CB
13:50:24 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54314 - 200 3B in 1.005829422s
13:50:24 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.165:49237 - 200 140B in 20.281534ms
13:50:24 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.165:49237 - 200 3B in 9.18189ms
13:50:24 [HAP_DBG]{"accessories":[{"aid":1,"services":[{"iid":1,"type":"3E","characteristics":[{"iid":2,"type":"14","perms":["pw"],"format":"bool"},{"iid":3,"type":"20","perms":["pr"],"format":"string","value":"alpr777"},{"iid":4,"type":"21","perms":["pr"],"format":"string","value":"HAP-SW"},{"iid":5,"type":"23","perms":["pr"],"format":"string","value":"Switch"},{"iid":6,"type":"30","perms":["pr"],"format":"string","value":"EX-Switch"},{"iid":7,"type":"52","perms":["pr"],"format":"string","value":"1.2.3"}]},{"iid":8,"type":"49","characteristics":[{"iid":9,"type":"25","perms":["pr","pw","ev"],"format":"bool","value":true}]}]}]}
13:50:24 [HAP_DBG]"GET http://Switch._hap._tcp.local/accessories HTTP/1.1" from 192.168.1.165:49237 - 200 616B in 973.277µs
13:50:25 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.178:49505 - 200 140B in 24.395215ms
13:50:25 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.149:50708 - 200 140B in 26.043959ms
13:50:26 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 8.208144ms
13:50:26 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.149:50708 - 200 3B in 9.493191ms
13:50:26 [HAP_DBG]{"accessories":[{"aid":1,"services":[{"iid":1,"type":"3E","characteristics":[{"iid":2,"type":"14","perms":["pw"],"format":"bool"},{"iid":3,"type":"20","perms":["pr"],"format":"string","value":"alpr777"},{"iid":4,"type":"21","perms":["pr"],"format":"string","value":"HAP-SW"},{"iid":5,"type":"23","perms":["pr"],"format":"string","value":"Switch"},{"iid":6,"type":"30","perms":["pr"],"format":"string","value":"EX-Switch"},{"iid":7,"type":"52","perms":["pr"],"format":"string","value":"1.2.3"}]},{"iid":8,"type":"49","characteristics":[{"iid":9,"type":"25","perms":["pr","pw","ev"],"format":"bool","value":true}]}]}]}
13:50:26 [HAP_DBG]"GET http://Switch._hap._tcp.local/accessories HTTP/1.1" from 192.168.1.178:49505 - 200 616B in 815.414µs
13:50:26 [HAP_DBG]{"accessories":[{"aid":1,"services":[{"iid":1,"type":"3E","characteristics":[{"iid":2,"type":"14","perms":["pw"],"format":"bool"},{"iid":3,"type":"20","perms":["pr"],"format":"string","value":"alpr777"},{"iid":4,"type":"21","perms":["pr"],"format":"string","value":"HAP-SW"},{"iid":5,"type":"23","perms":["pr"],"format":"string","value":"Switch"},{"iid":6,"type":"30","perms":["pr"],"format":"string","value":"EX-Switch"},{"iid":7,"type":"52","perms":["pr"],"format":"string","value":"1.2.3"}]},{"iid":8,"type":"49","characteristics":[{"iid":9,"type":"25","perms":["pr","pw","ev"],"format":"bool","value":true}]}]}]}
13:50:26 [HAP_DBG]"GET http://Switch._hap._tcp.local/accessories HTTP/1.1" from 192.168.1.149:50708 - 200 616B in 1.804055ms
13:50:28 [HAP_DBG]{"characteristics":[{"aid":1,"iid":7,"value":"1.2.3"}]}
13:50:28 [HAP_DBG]"GET http://Switch._hap._tcp.local/characteristics?id=1.7 HTTP/1.1" from 192.168.1.178:49505 - 200 55B in 290.571µs
13:50:31 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.100:54317 - 200 140B in 20.626532ms
13:50:31 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.100:54317 - 200 3B in 9.430952ms
13:50:31 [HAP_DBG]{"accessories":[{"aid":1,"services":[{"iid":1,"type":"3E","characteristics":[{"iid":2,"type":"14","perms":["pw"],"format":"bool"},{"iid":3,"type":"20","perms":["pr"],"format":"string","value":"alpr777"},{"iid":4,"type":"21","perms":["pr"],"format":"string","value":"HAP-SW"},{"iid":5,"type":"23","perms":["pr"],"format":"string","value":"Switch"},{"iid":6,"type":"30","perms":["pr"],"format":"string","value":"EX-Switch"},{"iid":7,"type":"52","perms":["pr"],"format":"string","value":"1.2.3"}]},{"iid":8,"type":"49","characteristics":[{"iid":9,"type":"25","perms":["pr","pw","ev"],"format":"bool","value":true}]}]}]}
13:50:31 [HAP_DBG]"GET http://Switch._hap._tcp.local/accessories HTTP/1.1" from 192.168.1.100:54317 - 200 616B in 893.329µs
13:50:31 [HAP_DBG]add pairing D20933DE-4024-420B-B669-1241BC7F9471
13:50:32 [HAP_DBG]{"characteristics":[{"aid":1,"iid":9,"ev":true}]}
13:50:32 [HAP_DBG]"PUT http://Switch._hap._tcp.local/characteristics HTTP/1.1" from 192.168.1.178:49505 - 204 0B in 330.572µs
13:50:32 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54317 - 200 3B in 1.004311049s
13:50:32 [HAP_DBG]{"characteristics":[{"aid":1,"iid":9,"ev":true}]}
13:50:32 [HAP_DBG]"PUT http://Switch._hap._tcp.local/characteristics HTTP/1.1" from 192.168.1.100:54317 - 204 0B in 470.624µs
13:50:32 [HAP_DBG]add pairing 5D79EC85-F36D-464F-A46B-0407B6B1EADE
13:50:33 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54317 - 200 3B in 1.004374382s
13:50:33 [HAP_DBG]add pairing DAD2834C-86A0-4AB1-B4B7-984C20624940
13:50:34 [HAP_DBG]{"characteristics":[{"aid":1,"iid":9,"value":true}]}
13:50:34 [HAP_DBG]"GET http://Switch._hap._tcp.local/characteristics?id=1.9 HTTP/1.1" from 192.168.1.178:49505 - 200 52B in 375.415µs
13:50:34 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54317 - 200 3B in 1.003785531s
13:50:34 [HAP_DBG]add pairing 981AC59E-9F6F-4FD3-B52C-E617710496CB
13:50:35 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54317 - 200 3B in 1.003373346s
13:50:35 [HAP_DBG]add pairing F930B23C-F461-48EE-8B45-C19A8F6BA8E3
13:50:36 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54317 - 200 3B in 1.005016674s
13:50:36 [HAP_DBG]add pairing 1609E8E0-8806-4957-97F6-58B7A2ABAB1F
13:50:37 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54317 - 200 3B in 1.003744231s
13:50:42 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.165:49240 - 200 140B in 24.757193ms
13:50:42 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.165:49240 - 200 3B in 12.577762ms
13:50:42 [HAP_DBG]{"accessories":[{"aid":1,"services":[{"iid":1,"type":"3E","characteristics":[{"iid":2,"type":"14","perms":["pw"],"format":"bool"},{"iid":3,"type":"20","perms":["pr"],"format":"string","value":"alpr777"},{"iid":4,"type":"21","perms":["pr"],"format":"string","value":"HAP-SW"},{"iid":5,"type":"23","perms":["pr"],"format":"string","value":"Switch"},{"iid":6,"type":"30","perms":["pr"],"format":"string","value":"EX-Switch"},{"iid":7,"type":"52","perms":["pr"],"format":"string","value":"1.2.3"}]},{"iid":8,"type":"49","characteristics":[{"iid":9,"type":"25","perms":["pr","pw","ev"],"format":"bool","value":true}]}]}]}
13:50:42 [HAP_DBG]"GET http://Switch._hap._tcp.local/accessories HTTP/1.1" from 192.168.1.165:49240 - 200 616B in 892.913µs
13:50:42 [HAP_DBG]add pairing DAD2834C-86A0-4AB1-B4B7-984C20624940
13:50:43 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49240 - 200 3B in 1.003499861s
13:50:43 [HAP_DBG]add pairing F930B23C-F461-48EE-8B45-C19A8F6BA8E3
13:50:44 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49240 - 200 3B in 1.006367507s
13:50:44 [HAP_DBG]add pairing D20933DE-4024-420B-B669-1241BC7F9471
13:50:45 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49240 - 200 3B in 1.004615952s
13:50:45 [HAP_DBG]add pairing 5D79EC85-F36D-464F-A46B-0407B6B1EADE
13:50:46 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49240 - 200 3B in 1.004510172s
13:50:46 [HAP_DBG]add pairing 981AC59E-9F6F-4FD3-B52C-E617710496CB
13:50:47 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49240 - 200 3B in 1.004366111s
13:50:47 [HAP_DBG]add pairing 1609E8E0-8806-4957-97F6-58B7A2ABAB1F
13:50:48 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49240 - 200 3B in 1.005714804s
13:50:49 [HAP_DBG]send event to 192.168.1.178:49505:
EVENT/1.0 200 OK
Content-Length: 53
Content-Type: application/hap+json

{"characteristics":[{"aid":1,"iid":9,"value":false}]}
13:50:49 [ EX-Switch / Switch ] acc switch update on: bool - false
13:50:53 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.165:49241 - 200 140B in 21.212208ms
13:50:53 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.165:49241 - 200 3B in 10.620323ms
13:50:53 [HAP_DBG]{"accessories":[{"aid":1,"services":[{"iid":1,"type":"3E","characteristics":[{"iid":2,"type":"14","perms":["pw"],"format":"bool"},{"iid":3,"type":"20","perms":["pr"],"format":"string","value":"alpr777"},{"iid":4,"type":"21","perms":["pr"],"format":"string","value":"HAP-SW"},{"iid":5,"type":"23","perms":["pr"],"format":"string","value":"Switch"},{"iid":6,"type":"30","perms":["pr"],"format":"string","value":"EX-Switch"},{"iid":7,"type":"52","perms":["pr"],"format":"string","value":"1.2.3"}]},{"iid":8,"type":"49","characteristics":[{"iid":9,"type":"25","perms":["pr","pw","ev"],"format":"bool","value":false}]}]}]}
13:50:53 [HAP_DBG]"GET http://Switch._hap._tcp.local/accessories HTTP/1.1" from 192.168.1.165:49241 - 200 617B in 1.049579ms
13:50:53 [HAP_DBG]add pairing DAD2834C-86A0-4AB1-B4B7-984C20624940
13:50:54 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49241 - 200 3B in 1.004746844s
13:50:54 [HAP_DBG]add pairing F930B23C-F461-48EE-8B45-C19A8F6BA8E3
13:50:55 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49241 - 200 3B in 1.00471023s
13:50:55 [HAP_DBG]add pairing D20933DE-4024-420B-B669-1241BC7F9471
13:50:56 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49241 - 200 3B in 1.004023046s
13:50:56 [HAP_DBG]add pairing 5D79EC85-F36D-464F-A46B-0407B6B1EADE
13:50:57 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.109:52609 - 200 140B in 24.039852ms
13:50:57 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.109:52609 - 200 3B in 12.402607ms
13:50:57 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49241 - 200 3B in 1.003746954s
13:50:57 [HAP_DBG]{"accessories":[{"aid":1,"services":[{"iid":1,"type":"3E","characteristics":[{"iid":2,"type":"14","perms":["pw"],"format":"bool"},{"iid":3,"type":"20","perms":["pr"],"format":"string","value":"alpr777"},{"iid":4,"type":"21","perms":["pr"],"format":"string","value":"HAP-SW"},{"iid":5,"type":"23","perms":["pr"],"format":"string","value":"Switch"},{"iid":6,"type":"30","perms":["pr"],"format":"string","value":"EX-Switch"},{"iid":7,"type":"52","perms":["pr"],"format":"string","value":"1.2.3"}]},{"iid":8,"type":"49","characteristics":[{"iid":9,"type":"25","perms":["pr","pw","ev"],"format":"bool","value":false}]}]}]}
13:50:57 [HAP_DBG]add pairing 981AC59E-9F6F-4FD3-B52C-E617710496CB
13:50:57 [HAP_DBG]"GET http://Switch._hap._tcp.local/accessories HTTP/1.1" from 192.168.1.109:52609 - 200 617B in 1.819576ms
13:50:58 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.106:65242 - 200 140B in 20.683251ms
13:50:58 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.106:65242 - 200 3B in 11.267924ms
13:50:58 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49241 - 200 3B in 1.006996004s
13:50:58 [HAP_DBG]add pairing 1609E8E0-8806-4957-97F6-58B7A2ABAB1F
13:50:58 [HAP_DBG]{"accessories":[{"aid":1,"services":[{"iid":1,"type":"3E","characteristics":[{"iid":2,"type":"14","perms":["pw"],"format":"bool"},{"iid":3,"type":"20","perms":["pr"],"format":"string","value":"alpr777"},{"iid":4,"type":"21","perms":["pr"],"format":"string","value":"HAP-SW"},{"iid":5,"type":"23","perms":["pr"],"format":"string","value":"Switch"},{"iid":6,"type":"30","perms":["pr"],"format":"string","value":"EX-Switch"},{"iid":7,"type":"52","perms":["pr"],"format":"string","value":"1.2.3"}]},{"iid":8,"type":"49","characteristics":[{"iid":9,"type":"25","perms":["pr","pw","ev"],"format":"bool","value":false}]}]}]}
13:50:58 [HAP_DBG]"GET http://Switch._hap._tcp.local/accessories HTTP/1.1" from 192.168.1.106:65242 - 200 617B in 775.622µs
13:50:59 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.149:50714 - 200 140B in 20.845022ms
13:50:59 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.149:50714 - 200 3B in 10.960009ms
13:50:59 [HAP_DBG]{"accessories":[{"aid":1,"services":[{"iid":1,"type":"3E","characteristics":[{"iid":2,"type":"14","perms":["pw"],"format":"bool"},{"iid":3,"type":"20","perms":["pr"],"format":"string","value":"alpr777"},{"iid":4,"type":"21","perms":["pr"],"format":"string","value":"HAP-SW"},{"iid":5,"type":"23","perms":["pr"],"format":"string","value":"Switch"},{"iid":6,"type":"30","perms":["pr"],"format":"string","value":"EX-Switch"},{"iid":7,"type":"52","perms":["pr"],"format":"string","value":"1.2.3"}]},{"iid":8,"type":"49","characteristics":[{"iid":9,"type":"25","perms":["pr","pw","ev"],"format":"bool","value":false}]}]}]}
13:50:59 [HAP_DBG]"GET http://Switch._hap._tcp.local/accessories HTTP/1.1" from 192.168.1.149:50714 - 200 617B in 942.652µs
13:50:59 [HAP_DBG]add pairing DAD2834C-86A0-4AB1-B4B7-984C20624940
13:50:59 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49241 - 200 3B in 1.003373884s
13:51:00 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.149:50714 - 200 3B in 1.004543359s
13:51:00 [HAP_DBG]add pairing F930B23C-F461-48EE-8B45-C19A8F6BA8E3
13:51:01 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.149:50714 - 200 3B in 1.004306745s
13:51:01 [HAP_DBG]add pairing D20933DE-4024-420B-B669-1241BC7F9471
13:51:02 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.149:50714 - 200 3B in 1.004477892s
13:51:02 [HAP_DBG]add pairing 5D79EC85-F36D-464F-A46B-0407B6B1EADE
13:51:03 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.100:54319 - 200 140B in 20.51195ms
13:51:03 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.100:54319 - 200 3B in 9.28814ms
13:51:03 [HAP_DBG]{"accessories":[{"aid":1,"services":[{"iid":1,"type":"3E","characteristics":[{"iid":2,"type":"14","perms":["pw"],"format":"bool"},{"iid":3,"type":"20","perms":["pr"],"format":"string","value":"alpr777"},{"iid":4,"type":"21","perms":["pr"],"format":"string","value":"HAP-SW"},{"iid":5,"type":"23","perms":["pr"],"format":"string","value":"Switch"},{"iid":6,"type":"30","perms":["pr"],"format":"string","value":"EX-Switch"},{"iid":7,"type":"52","perms":["pr"],"format":"string","value":"1.2.3"}]},{"iid":8,"type":"49","characteristics":[{"iid":9,"type":"25","perms":["pr","pw","ev"],"format":"bool","value":false}]}]}]}
13:51:03 [HAP_DBG]"GET http://Switch._hap._tcp.local/accessories HTTP/1.1" from 192.168.1.100:54319 - 200 617B in 900.048µs
13:51:03 [HAP_DBG]add pairing D20933DE-4024-420B-B669-1241BC7F9471
13:51:03 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.149:50714 - 200 3B in 1.004598725s
13:51:03 [HAP_DBG]add pairing 981AC59E-9F6F-4FD3-B52C-E617710496CB
13:51:04 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54319 - 200 3B in 1.003505084s
13:51:04 [HAP_DBG]{"characteristics":[{"aid":1,"iid":9,"ev":true}]}
13:51:04 [HAP_DBG]"PUT http://Switch._hap._tcp.local/characteristics HTTP/1.1" from 192.168.1.100:54319 - 204 0B in 377.55µs
13:51:04 [HAP_DBG]add pairing 5D79EC85-F36D-464F-A46B-0407B6B1EADE
13:51:04 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.149:50714 - 200 3B in 1.005877107s
13:51:04 [HAP_DBG]add pairing 1609E8E0-8806-4957-97F6-58B7A2ABAB1F
13:51:05 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54319 - 200 3B in 1.005296119s
13:51:05 [HAP_DBG]add pairing DAD2834C-86A0-4AB1-B4B7-984C20624940
13:51:05 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.149:50714 - 200 3B in 1.00454555s
13:51:06 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54319 - 200 3B in 1.005022684s
13:51:06 [HAP_DBG]add pairing 981AC59E-9F6F-4FD3-B52C-E617710496CB
13:51:07 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54319 - 200 3B in 1.004293833s
13:51:07 [HAP_DBG]add pairing F930B23C-F461-48EE-8B45-C19A8F6BA8E3
13:51:08 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54319 - 200 3B in 1.004667842s
13:51:08 [HAP_DBG]add pairing 1609E8E0-8806-4957-97F6-58B7A2ABAB1F
13:51:09 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54319 - 200 3B in 1.004366438s
13:51:11 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.149:50717 - 200 140B in 20.612418ms
13:51:11 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.149:50717 - 200 3B in 9.927149ms
13:51:11 [HAP_DBG]{"accessories":[{"aid":1,"services":[{"iid":1,"type":"3E","characteristics":[{"iid":2,"type":"14","perms":["pw"],"format":"bool"},{"iid":3,"type":"20","perms":["pr"],"format":"string","value":"alpr777"},{"iid":4,"type":"21","perms":["pr"],"format":"string","value":"HAP-SW"},{"iid":5,"type":"23","perms":["pr"],"format":"string","value":"Switch"},{"iid":6,"type":"30","perms":["pr"],"format":"string","value":"EX-Switch"},{"iid":7,"type":"52","perms":["pr"],"format":"string","value":"1.2.3"}]},{"iid":8,"type":"49","characteristics":[{"iid":9,"type":"25","perms":["pr","pw","ev"],"format":"bool","value":false}]}]}]}
13:51:11 [HAP_DBG]"GET http://Switch._hap._tcp.local/accessories HTTP/1.1" from 192.168.1.149:50717 - 200 617B in 871.559µs
13:51:11 [HAP_DBG]add pairing DAD2834C-86A0-4AB1-B4B7-984C20624940
13:51:12 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.149:50717 - 200 3B in 1.00356785s
13:51:12 [HAP_DBG]add pairing F930B23C-F461-48EE-8B45-C19A8F6BA8E3
13:51:13 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.149:50717 - 200 3B in 1.004462117s
13:51:13 [HAP_DBG]add pairing D20933DE-4024-420B-B669-1241BC7F9471
13:51:13 [HAP_DBG]add pairing DAD2834C-86A0-4AB1-B4B7-984C20624940
13:51:14 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.149:50717 - 200 3B in 1.004790867s
13:51:14 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.004550555s
13:51:14 [HAP_DBG]add pairing 5D79EC85-F36D-464F-A46B-0407B6B1EADE
13:51:14 [HAP_DBG]add pairing F930B23C-F461-48EE-8B45-C19A8F6BA8E3
13:51:15 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.149:50717 - 200 3B in 1.004613473s
13:51:15 [HAP_DBG]add pairing 1609E8E0-8806-4957-97F6-58B7A2ABAB1F
13:51:15 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.005542219s
13:51:15 [HAP_DBG]add pairing D20933DE-4024-420B-B669-1241BC7F9471
13:51:16 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.149:50717 - 200 3B in 1.003924882s
13:51:16 [HAP_DBG]add pairing 981AC59E-9F6F-4FD3-B52C-E617710496CB
13:51:16 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.005228263s
13:51:16 [HAP_DBG]add pairing 5D79EC85-F36D-464F-A46B-0407B6B1EADE
13:51:17 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.149:50717 - 200 3B in 1.004434308s
13:51:17 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.004550922s
13:51:17 [HAP_DBG]add pairing 981AC59E-9F6F-4FD3-B52C-E617710496CB
13:51:18 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.004225612s
13:51:18 [HAP_DBG]add pairing 1609E8E0-8806-4957-97F6-58B7A2ABAB1F
13:51:19 [HAP_DBG]send event to 192.168.1.178:49505:
EVENT/1.0 200 OK
Content-Length: 52
Content-Type: application/hap+json

{"characteristics":[{"aid":1,"iid":9,"value":true}]}
13:51:19 [ EX-Switch / Switch ] acc switch update on: bool - true
13:51:19 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.006108522s
13:51:25 [HAP_DBG]add pairing DAD2834C-86A0-4AB1-B4B7-984C20624940
13:51:26 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.004719989s
13:51:26 [HAP_DBG]add pairing F930B23C-F461-48EE-8B45-C19A8F6BA8E3
13:51:27 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.004393117s
13:51:27 [HAP_DBG]{"characteristics":[{"aid":1,"iid":7,"value":"1.2.3"}]}
13:51:27 [HAP_DBG]"GET http://Switch._hap._tcp.local/characteristics?id=1.7 HTTP/1.1" from 192.168.1.178:49505 - 200 55B in 260.624µs
13:51:27 [HAP_DBG]add pairing D20933DE-4024-420B-B669-1241BC7F9471
13:51:27 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.165:49242 - 200 140B in 20.780595ms
13:51:27 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.165:49242 - 200 3B in 11.736568ms
13:51:27 [HAP_DBG]{"accessories":[{"aid":1,"services":[{"iid":1,"type":"3E","characteristics":[{"iid":2,"type":"14","perms":["pw"],"format":"bool"},{"iid":3,"type":"20","perms":["pr"],"format":"string","value":"alpr777"},{"iid":4,"type":"21","perms":["pr"],"format":"string","value":"HAP-SW"},{"iid":5,"type":"23","perms":["pr"],"format":"string","value":"Switch"},{"iid":6,"type":"30","perms":["pr"],"format":"string","value":"EX-Switch"},{"iid":7,"type":"52","perms":["pr"],"format":"string","value":"1.2.3"}]},{"iid":8,"type":"49","characteristics":[{"iid":9,"type":"25","perms":["pr","pw","ev"],"format":"bool","value":true}]}]}]}
13:51:27 [HAP_DBG]"GET http://Switch._hap._tcp.local/accessories HTTP/1.1" from 192.168.1.165:49242 - 200 616B in 1.007912ms
13:51:27 [HAP_DBG]add pairing DAD2834C-86A0-4AB1-B4B7-984C20624940
13:51:28 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.005066917s
13:51:28 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49242 - 200 3B in 1.004584992s
13:51:28 [HAP_DBG]add pairing F930B23C-F461-48EE-8B45-C19A8F6BA8E3
13:51:29 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49242 - 200 3B in 1.004111186s
13:51:29 [HAP_DBG]add pairing D20933DE-4024-420B-B669-1241BC7F9471
13:51:29 [HAP_DBG]add pairing 981AC59E-9F6F-4FD3-B52C-E617710496CB
13:51:30 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49242 - 200 3B in 1.005170755s
13:51:30 [HAP_DBG]add pairing 5D79EC85-F36D-464F-A46B-0407B6B1EADE
13:51:30 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.005846508s
13:51:30 [HAP_DBG]add pairing 5D79EC85-F36D-464F-A46B-0407B6B1EADE
13:51:31 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49242 - 200 3B in 1.004659586s
13:51:31 [HAP_DBG]add pairing 981AC59E-9F6F-4FD3-B52C-E617710496CB
13:51:31 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.004376175s
13:51:32 [HAP_DBG]add pairing 1609E8E0-8806-4957-97F6-58B7A2ABAB1F
13:51:32 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49242 - 200 3B in 1.005613687s
13:51:32 [HAP_DBG]add pairing 1609E8E0-8806-4957-97F6-58B7A2ABAB1F
13:51:33 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.005096491s
13:51:33 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49242 - 200 3B in 1.00511805s
13:51:49 [HAP_DBG]send event to 192.168.1.178:49505:
EVENT/1.0 200 OK
Content-Length: 53
Content-Type: application/hap+json

{"characteristics":[{"aid":1,"iid":9,"value":false}]}
13:51:49 [ EX-Switch / Switch ] acc switch update on: bool - false
13:51:54 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.149:50718 - 200 140B in 20.871836ms
13:51:54 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.149:50718 - 200 3B in 10.603576ms
13:51:54 [HAP_DBG]{"accessories":[{"aid":1,"services":[{"iid":1,"type":"3E","characteristics":[{"iid":2,"type":"14","perms":["pw"],"format":"bool"},{"iid":3,"type":"20","perms":["pr"],"format":"string","value":"alpr777"},{"iid":4,"type":"21","perms":["pr"],"format":"string","value":"HAP-SW"},{"iid":5,"type":"23","perms":["pr"],"format":"string","value":"Switch"},{"iid":6,"type":"30","perms":["pr"],"format":"string","value":"EX-Switch"},{"iid":7,"type":"52","perms":["pr"],"format":"string","value":"1.2.3"}]},{"iid":8,"type":"49","characteristics":[{"iid":9,"type":"25","perms":["pr","pw","ev"],"format":"bool","value":false}]}]}]}
13:51:54 [HAP_DBG]"GET http://Switch._hap._tcp.local/accessories HTTP/1.1" from 192.168.1.149:50718 - 200 617B in 1.093869ms
13:51:54 [HAP_DBG]add pairing DAD2834C-86A0-4AB1-B4B7-984C20624940
13:51:55 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.149:50718 - 200 3B in 1.004277371s
13:51:55 [HAP_DBG]add pairing F930B23C-F461-48EE-8B45-C19A8F6BA8E3
13:51:56 [HAP_DBG]add pairing DAD2834C-86A0-4AB1-B4B7-984C20624940
13:51:56 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.149:50718 - 200 3B in 1.004096921s
13:51:56 [HAP_DBG]add pairing 5D79EC85-F36D-464F-A46B-0407B6B1EADE
13:51:57 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.004818554s
13:51:57 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.149:50718 - 200 3B in 1.004098023s
13:51:57 [HAP_DBG]add pairing F930B23C-F461-48EE-8B45-C19A8F6BA8E3
13:51:58 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.005379241s
13:51:58 [HAP_DBG]add pairing D20933DE-4024-420B-B669-1241BC7F9471
13:51:58 [HAP_DBG]add pairing D20933DE-4024-420B-B669-1241BC7F9471
13:51:59 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.149:50718 - 200 3B in 1.005165518s
13:51:59 [HAP_DBG]add pairing 981AC59E-9F6F-4FD3-B52C-E617710496CB
13:51:59 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.005210866s
13:52:00 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.149:50718 - 200 3B in 1.004590172s
13:52:00 [HAP_DBG]add pairing 1609E8E0-8806-4957-97F6-58B7A2ABAB1F
13:52:01 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.149:50718 - 200 3B in 1.004063876s
13:52:02 [HAP_DBG]add pairing 5D79EC85-F36D-464F-A46B-0407B6B1EADE
13:52:03 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.004336036s
13:52:03 [HAP_DBG]add pairing 981AC59E-9F6F-4FD3-B52C-E617710496CB
13:52:04 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.004127091s
13:52:04 [HAP_DBG]add pairing 1609E8E0-8806-4957-97F6-58B7A2ABAB1F
13:52:05 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.003744031s
13:52:19 [HAP_DBG]send event to 192.168.1.178:49505:
EVENT/1.0 200 OK
Content-Length: 52
Content-Type: application/hap+json

{"characteristics":[{"aid":1,"iid":9,"value":true}]}
13:52:19 [ EX-Switch / Switch ] acc switch update on: bool - true
13:52:28 [HAP_DBG]{"characteristics":[{"aid":1,"iid":7,"value":"1.2.3"}]}
13:52:28 [HAP_DBG]"GET http://Switch._hap._tcp.local/characteristics?id=1.7 HTTP/1.1" from 192.168.1.178:49505 - 200 55B in 240.001µs
13:52:34 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.100:54322 - 200 140B in 20.624802ms
13:52:34 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.100:54322 - 200 3B in 9.208046ms
13:52:34 [HAP_DBG]{"accessories":[{"aid":1,"services":[{"iid":1,"type":"3E","characteristics":[{"iid":2,"type":"14","perms":["pw"],"format":"bool"},{"iid":3,"type":"20","perms":["pr"],"format":"string","value":"alpr777"},{"iid":4,"type":"21","perms":["pr"],"format":"string","value":"HAP-SW"},{"iid":5,"type":"23","perms":["pr"],"format":"string","value":"Switch"},{"iid":6,"type":"30","perms":["pr"],"format":"string","value":"EX-Switch"},{"iid":7,"type":"52","perms":["pr"],"format":"string","value":"1.2.3"}]},{"iid":8,"type":"49","characteristics":[{"iid":9,"type":"25","perms":["pr","pw","ev"],"format":"bool","value":true}]}]}]}
13:52:34 [HAP_DBG]"GET http://Switch._hap._tcp.local/accessories HTTP/1.1" from 192.168.1.100:54322 - 200 616B in 927.831µs
13:52:34 [HAP_DBG]add pairing D20933DE-4024-420B-B669-1241BC7F9471
13:52:35 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54322 - 200 3B in 1.004271722s
13:52:35 [HAP_DBG]{"characteristics":[{"aid":1,"iid":9,"ev":true}]}
13:52:35 [HAP_DBG]"PUT http://Switch._hap._tcp.local/characteristics HTTP/1.1" from 192.168.1.100:54322 - 204 0B in 702.656µs
13:52:35 [HAP_DBG]add pairing 5D79EC85-F36D-464F-A46B-0407B6B1EADE
13:52:36 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54322 - 200 3B in 1.004545008s
13:52:36 [HAP_DBG]add pairing DAD2834C-86A0-4AB1-B4B7-984C20624940
13:52:37 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54322 - 200 3B in 1.004138819s
13:52:38 [HAP_DBG]add pairing 981AC59E-9F6F-4FD3-B52C-E617710496CB
13:52:39 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54322 - 200 3B in 1.009426788s
13:52:39 [HAP_DBG]add pairing F930B23C-F461-48EE-8B45-C19A8F6BA8E3
13:52:40 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54322 - 200 3B in 1.003739272s
13:52:40 [HAP_DBG]add pairing 1609E8E0-8806-4957-97F6-58B7A2ABAB1F
13:52:41 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54322 - 200 3B in 1.004919204s
13:52:49 [HAP_DBG]send event to 192.168.1.178:49505:
EVENT/1.0 200 OK
Content-Length: 53
Content-Type: application/hap+json

{"characteristics":[{"aid":1,"iid":9,"value":false}]}
13:52:49 [ EX-Switch / Switch ] acc switch update on: bool - false
13:53:01 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.165:49243 - 200 140B in 24.10494ms
13:53:01 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.165:49243 - 200 3B in 12.60908ms
13:53:01 [HAP_DBG]{"accessories":[{"aid":1,"services":[{"iid":1,"type":"3E","characteristics":[{"iid":2,"type":"14","perms":["pw"],"format":"bool"},{"iid":3,"type":"20","perms":["pr"],"format":"string","value":"alpr777"},{"iid":4,"type":"21","perms":["pr"],"format":"string","value":"HAP-SW"},{"iid":5,"type":"23","perms":["pr"],"format":"string","value":"Switch"},{"iid":6,"type":"30","perms":["pr"],"format":"string","value":"EX-Switch"},{"iid":7,"type":"52","perms":["pr"],"format":"string","value":"1.2.3"}]},{"iid":8,"type":"49","characteristics":[{"iid":9,"type":"25","perms":["pr","pw","ev"],"format":"bool","value":false}]}]}]}
13:53:01 [HAP_DBG]"GET http://Switch._hap._tcp.local/accessories HTTP/1.1" from 192.168.1.165:49243 - 200 617B in 895.503µs
13:53:01 [HAP_DBG]add pairing DAD2834C-86A0-4AB1-B4B7-984C20624940
13:53:02 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49243 - 200 3B in 1.003770701s
13:53:02 [HAP_DBG]add pairing F930B23C-F461-48EE-8B45-C19A8F6BA8E3
13:53:03 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49243 - 200 3B in 1.004338995s
13:53:03 [HAP_DBG]add pairing D20933DE-4024-420B-B669-1241BC7F9471
13:53:04 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49243 - 200 3B in 1.004997391s
13:53:04 [HAP_DBG]add pairing 5D79EC85-F36D-464F-A46B-0407B6B1EADE
13:53:05 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49243 - 200 3B in 1.004219409s
13:53:05 [HAP_DBG]add pairing 1609E8E0-8806-4957-97F6-58B7A2ABAB1F
13:53:06 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49243 - 200 3B in 1.003822089s
13:53:06 [HAP_DBG]add pairing 981AC59E-9F6F-4FD3-B52C-E617710496CB
13:53:07 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.165:49243 - 200 3B in 1.00435103s
13:53:19 [HAP_DBG]send event to 192.168.1.178:49505:
EVENT/1.0 200 OK
Content-Length: 52
Content-Type: application/hap+json

{"characteristics":[{"aid":1,"iid":9,"value":true}]}
13:53:19 [ EX-Switch / Switch ] acc switch update on: bool - true
13:53:29 [HAP_DBG]add pairing F930B23C-F461-48EE-8B45-C19A8F6BA8E3
13:53:30 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.004011799s
13:53:30 [HAP_DBG]add pairing DAD2834C-86A0-4AB1-B4B7-984C20624940
13:53:31 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.003778728s
13:53:31 [HAP_DBG]{"characteristics":[{"aid":1,"iid":7,"value":"1.2.3"}]}
13:53:31 [HAP_DBG]"GET http://Switch._hap._tcp.local/characteristics?id=1.7 HTTP/1.1" from 192.168.1.178:49505 - 200 55B in 242.662µs
13:53:31 [HAP_DBG]add pairing D20933DE-4024-420B-B669-1241BC7F9471
13:53:32 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.005071522s
13:53:33 [HAP_DBG]add pairing 5D79EC85-F36D-464F-A46B-0407B6B1EADE
13:53:33 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.100:54323 - 200 140B in 20.763558ms
13:53:33 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.100:54323 - 200 3B in 10.578137ms
13:53:33 [HAP_DBG]{"accessories":[{"aid":1,"services":[{"iid":1,"type":"3E","characteristics":[{"iid":2,"type":"14","perms":["pw"],"format":"bool"},{"iid":3,"type":"20","perms":["pr"],"format":"string","value":"alpr777"},{"iid":4,"type":"21","perms":["pr"],"format":"string","value":"HAP-SW"},{"iid":5,"type":"23","perms":["pr"],"format":"string","value":"Switch"},{"iid":6,"type":"30","perms":["pr"],"format":"string","value":"EX-Switch"},{"iid":7,"type":"52","perms":["pr"],"format":"string","value":"1.2.3"}]},{"iid":8,"type":"49","characteristics":[{"iid":9,"type":"25","perms":["pr","pw","ev"],"format":"bool","value":true}]}]}]}
13:53:33 [HAP_DBG]"GET http://Switch._hap._tcp.local/accessories HTTP/1.1" from 192.168.1.100:54323 - 200 616B in 1.068356ms
13:53:33 [HAP_DBG]{"characteristics":[{"aid":1,"iid":9,"ev":false}]}
13:53:33 [HAP_DBG]"PUT http://Switch._hap._tcp.local/characteristics HTTP/1.1" from 192.168.1.100:54323 - 204 0B in 987.52µs
13:53:34 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.005147635s
13:53:34 [HAP_DBG]{"characteristics":[{"aid":1,"iid":9,"ev":false}]}
13:53:34 [HAP_DBG]"PUT http://Switch._hap._tcp.local/characteristics HTTP/1.1" from 192.168.1.178:49505 - 204 0B in 327.351µs
13:53:34 [HAP_DBG]add pairing 981AC59E-9F6F-4FD3-B52C-E617710496CB
13:53:35 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.003825046s
13:53:35 [HAP_DBG]add pairing 1609E8E0-8806-4957-97F6-58B7A2ABAB1F
13:53:36 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.178:49505 - 200 3B in 1.004645945s
13:53:49 [ EX-Switch / Switch ] acc switch update on: bool - false
13:54:19 [ EX-Switch / Switch ] acc switch update on: bool - true
13:54:31 [HAP_DBG]{"characteristics":[{"aid":1,"iid":7,"value":"1.2.3"}]}
13:54:31 [HAP_DBG]"GET http://Switch._hap._tcp.local/characteristics?id=1.7 HTTP/1.1" from 192.168.1.178:49505 - 200 55B in 332.348µs
13:54:34 [HAP_DBG]{"characteristics":[{"aid":1,"iid":9,"ev":true}]}
13:54:34 [HAP_DBG]"PUT http://Switch._hap._tcp.local/characteristics HTTP/1.1" from 192.168.1.178:49505 - 204 0B in 366.15µs
13:54:35 [HAP_DBG]{"characteristics":[{"aid":1,"iid":9,"value":true}]}
13:54:35 [HAP_DBG]"GET http://Switch._hap._tcp.local/characteristics?id=1.9 HTTP/1.1" from 192.168.1.178:49505 - 200 52B in 234.951µs
13:54:35 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.100:54329 - 200 140B in 20.638585ms
13:54:35 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.100:54329 - 200 3B in 10.552315ms
13:54:35 [HAP_DBG]{"accessories":[{"aid":1,"services":[{"iid":1,"type":"3E","characteristics":[{"iid":2,"type":"14","perms":["pw"],"format":"bool"},{"iid":3,"type":"20","perms":["pr"],"format":"string","value":"alpr777"},{"iid":4,"type":"21","perms":["pr"],"format":"string","value":"HAP-SW"},{"iid":5,"type":"23","perms":["pr"],"format":"string","value":"Switch"},{"iid":6,"type":"30","perms":["pr"],"format":"string","value":"EX-Switch"},{"iid":7,"type":"52","perms":["pr"],"format":"string","value":"1.2.3"}]},{"iid":8,"type":"49","characteristics":[{"iid":9,"type":"25","perms":["pr","pw","ev"],"format":"bool","value":true}]}]}]}
13:54:35 [HAP_DBG]"GET http://Switch._hap._tcp.local/accessories HTTP/1.1" from 192.168.1.100:54329 - 200 616B in 1.256161ms
13:54:35 [HAP_DBG]{"characteristics":[{"aid":1,"iid":9,"ev":true}]}
13:54:35 [HAP_DBG]"PUT http://Switch._hap._tcp.local/characteristics HTTP/1.1" from 192.168.1.100:54329 - 204 0B in 375.89µs
13:54:35 [HAP_DBG]{"characteristics":[{"aid":1,"iid":9,"ev":true}]}
13:54:35 [HAP_DBG]"PUT http://Switch._hap._tcp.local/characteristics HTTP/1.1" from 192.168.1.100:54329 - 204 0B in 383.338µs
13:54:40 [HAP_DBG]delete pairing D20933DE-4024-420B-B669-1241BC7F9471
13:54:40 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.100:54332 - 200 140B in 20.536704ms
13:54:40 [HAP_INFO]request from 192.168.1.100:54332 not authorized
13:54:40 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54332 - 400 17B in 893.917µs
13:54:40 [HAP_INFO]request from 192.168.1.100:54332 not authorized
13:54:40 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54332 - 400 17B in 424.171µs
13:54:40 [HAP_INFO]request from 192.168.1.100:54332 not authorized
13:54:40 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54332 - 400 17B in 143.647µs
13:54:40 [HAP_INFO]request from 192.168.1.100:54332 not authorized
13:54:40 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54332 - 400 17B in 164.95µs
13:54:40 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.100:54332 - 200 3B in 9.260736ms
13:54:40 [HAP_DBG]delete pairing 5D79EC85-F36D-464F-A46B-0407B6B1EADE
13:54:41 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54329 - 200 3B in 1.005979679s
13:54:41 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54332 - 200 3B in 1.006042603s
13:54:41 [HAP_DBG]delete pairing 66E0AB4A-8109-41BD-ABA9-DFB40FB38134
13:54:41 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.149:50721 - 200 140B in 20.549577ms
13:54:41 [HAP_INFO]not paired with 66E0AB4A-8109-41BD-ABA9-DFB40FB38134 yet
13:54:41 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.149:50721 - 200 6B in 499.223µs
13:54:42 [HAP_DBG]Closing connection to 192.168.1.178:49505
13:54:42 [HAP_DBG]Closing connection to 192.168.1.100:54332
13:54:42 [HAP_DBG]"POST http://Switch._hap._tcp.local/pairings HTTP/1.1" from 192.168.1.100:54332 - 200 3B in 1.007157167s
13:54:42 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.178:49508 - 200 140B in 21.850683ms
13:54:43 [HAP_INFO]not paired with 66E0AB4A-8109-41BD-ABA9-DFB40FB38134 yet
13:54:43 [HAP_DBG]"POST http://Switch._hap._tcp.local/pair-verify HTTP/1.1" from 192.168.1.178:49508 - 200 6B in 520.974µs
13:54:49 [ EX-Switch / Switch ] acc switch update on: bool - false

accessory pair failed if name is unicode

nas := accessory.NewSwitch(accessory.Info{
		Name:         "服务器",
		SerialNumber: "052AC-26AAM3",
		Manufacturer: "Apple",
		Model:        "AB",
	})

iphone will stuck when add accessory name use unicode unless the name is ascii charset

[Question] Code for alarm device

Hello,
I'm thinking of doing a homekit bridge for my alarm.
Is it possible with the homekit protocol (and hap) to ask for a code, to disarm the alarm?
Is there a way to secure a service?

Thanks

Not paired with {id}. Access blocks by another connected cloud id to my house.

When attempting to access my home setup, which was configured through the Home app, I encounter the error "not paired with {id}". During the accessory setup, I did receive a dialog window granting access. How can I handle this to avoid the mentioned error? Also, I'm unsure if this protocol is fully supported by the library. Interestingly, when dealing with a single cloud ID (4 devices), there are no problems; however, when I added my spouse, all devices added through your library are in a "not responding" state. Any insights on how to address this would be appreciated.

Upgrading from HC to HAP

Hello!

First I would like to thank you for the amazing work on this library, it's really fun to play with Go and Homekit accessories!

I'm trying to migrate from HC to HAP in the most idiomatic way, but I'm not sure to understand what's the equivalent of OnValueRemoteGet of a characteristic in HAP, to allow Homekit to update the current real value of the characteristic (in my case, it's an air conditioner controlled via a remote API in the cloud, which I can also control using a remote)

If someone could help me on that, it would really help me!

Thank you :)

Thermostat need a struct value for current humidity.

  • Provide an option to set current humidity. (same as current room temperature)
  • Provide a function to update humidity on remote update from the device.

Please let me know if this feature to be supported.

I can try contribute as well, with your guidance.

Person detection and facial recognition characteristics

Hi, I have an Aqara G4 doorbell. It is HomeKit compatible, and I can both view the camera stream in the Home app as well as get notified when a person is detected, as well as a face recognized. This must mean that the camera publishes these characteristics to HomeKit.

I have been able to view the camera stream using go2rtc

Is it possible to get the person detection and facial recognition characteristics using hap? I don't see any relevant services or characteristics in the code.

Accessory not showing up for pairing

I am quite new to this library and am just trying the very basic example provided in the Readme

package main

import (
"github.com/brutella/hap"
"github.com/brutella/hap/accessory"

"context"
"log"
"os"
"os/signal"
"syscall"

)

func main() {
// Create the switch accessory.
a := accessory.NewSwitch(accessory.Info{
Name: "Lamp",
})

// Store the data in the "./db" directory.
fs := hap.NewFsStore("./db")

// Create the hap server.
server, err := hap.NewServer(fs, a.A)
if err != nil {
	// stop if an error happens
	log.Panic(err)
}

// Setup a listener for interrupts and SIGTERM signals
// to stop the server.
c := make(chan os.Signal)
signal.Notify(c, os.Interrupt)
signal.Notify(c, syscall.SIGTERM)

ctx, cancel := context.WithCancel(context.Background())
go func() {
	<-c
	// Stop delivering signals.
	signal.Stop(c)
	// Cancel the context to stop the server.
	cancel() 
}()

// Run the server.
server.ListenAndServe(ctx)

}

The code runs without any errors in the console, but i dont see any accessory waiting to be paired in the Home app?

I am running the code on macOS if that matters. What am i doing wrong?

P.S. After i run "go run main.go" - macOS prompts me if i would allow the program to accept incoming connections, so i guess the server is properly started, but still nothing appears in the Home app. Even if i try to enter the code manually - nothing happens

Safer file & dir permissions for FsStore

Currently the permissions used in fs.go for directories are 0755 and files are at 0666. This would allow everyone to read, and also to write to (!!), the created files and directories, which is undesirable, especially since it contains the encryption/pairing keys.

A safer default for the directories would be 0750 and for files it would be 0640. This would allow the user running the hap process to read & write to these files, only read access for the group, and nobody else.

[Question] on update events

Hello,

I would like some clarifications about the update events:
Whats the difference between: OnValueRemoteUpdate, OnValueUpdate and OnSetRemoteValue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.