brutella/hap

create a custom service with UUID

freedreamer82 opened this issue · 2 comments

is possible to create a custom service setting the UUID ?

M.

Yes, you can do that by using a custom characteristic/service type. If you just want to associated a uuid with an accessory, you can just use a custom characteristic like this.

func NewUUID(value string) *characteristic.C {
	uuid := characteristic.NewString(CharacteristicTypeUUID)
	uuid.Permissions = []string{characteristic.PermissionRead, characteristic.PermissionHidden}
	uuid.Description = "ID"
	uuid.SetValue(value)
	return uuid.C
}

uuid := NewUUID("1234")
a := accessory.New(accessory.Info{...}, accessory.TypeOutlet)
a.Info.AddC(uuid)

thanks,
great work!

M.