Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Create Thermostat Accessory #126

Closed
jtsiros opened this issue Aug 24, 2018 · 6 comments
Closed

Cannot Create Thermostat Accessory #126

jtsiros opened this issue Aug 24, 2018 · 6 comments

Comments

@jtsiros
Copy link

jtsiros commented Aug 24, 2018

Hello,

I'm attempting to create a thermostat accessory, and for some reason, The Home app returns "Couldn't connect to this accessory." error.

here is my initialization code:

info := accessory.Info{
		Name:         "Nest",
		Manufacturer: "Nest Labs Inc",
	}
	acc := accessory.NewThermostat(
		info,
		75.0,
		75.0,
		75.0,
		1.0,
	)
	config := hc.Config{Pin: *pin, Port: *port}
	tp, err := hc.NewIPTransport(config, acc.Accessory)
	if err != nil {
		log.Info.Panicln(err.Error())
	}
	hc.OnTermination(func() {
		<-tp.Stop()
	})
	tp.Start()

Here is an excerpt from the logs:

DEBUG 2018/08/23 20:19:48 signature is valid
DEBUG 2018/08/23 20:19:48 Setup secure session
DEBUG 2018/08/23 20:19:48 192.168.7.28:64933 GET /accessories
DEBUG 2018/08/23 20:19:48 {"accessories":[{"aid":1,"services":[{"iid":1,"type":"3E","characteristics":[{"iid":2,"type":"14","perms":["pw"],"format":"bool"},{"iid":3,"type":"20","perms":["pr"],"value":"Nest Labs Inc","format":"string"},{"iid":4,"type":"21","perms":["pr"],"value":"undefined","format":"string"},{"iid":5,"type":"23","perms":["pr"],"value":"Nest","format":"string"},{"iid":6,"type":"30","perms":["pr"],"value":"undefined","format":"string"},{"iid":7,"type":"52","perms":["pr"],"value":"","format":"string"}]},{"iid":8,"type":"4A","characteristics":[{"iid":9,"type":"F","perms":["pr","ev"],"value":0,"format":"uint8"},{"iid":10,"type":"33","perms":["pr","pw","ev"],"value":0,"format":"uint8"},{"iid":11,"type":"11","perms":["pr","ev"],"value":0,"format":"float","unit":"celsius","maxValue":0,"minValue":0,"minStep":1},{"iid":12,"type":"35","perms":["pr","pw","ev"],"value":10,"format":"float","unit":"celsius","maxValue":0,"minValue":0,"minStep":1},{"iid":13,"type":"36","perms":["pr","pw","ev"],"value":0,"format":"uint8"}]}]}]}
DEBUG 2018/08/23 20:19:48 192.168.7.28:64933 POST /pairings
DEBUG 2018/08/23 20:19:48 ->     Method: Delete
DEBUG 2018/08/23 20:19:48 -> Permission: 0
DEBUG 2018/08/23 20:19:48 ->   Username: 1A9D0022-5D0F-4812-9514-7F1DE6DC2DFB
DEBUG 2018/08/23 20:19:48 ->       LTPK: []
DEBUG 2018/08/23 20:19:48 Remove LTPK for client '1A9D0022-5D0F-4812-9514-7F1DE6DC2DFB'
DEBUG 2018/08/23 20:19:48 Event: unpaired with device
DEBUG 2018/08/23 20:19:49 Close connection and remove session

I've been able to successfully run a LightSwitch accessory without any issues.

@rcarmo
Copy link

rcarmo commented Aug 24, 2018

I'm also looking into something similar, and wondering if the (as yet un-merged) #118 might help.

@brutella
Copy link
Owner

From the log I can see that the client successfully connected and paired with the accessories. But then it immediately unpairs with the accessories. Probably the data of the accessory is invalid.

Maybe a min and max temperature of 75° is invalid. Have you tried to use 70° for min and 75° for max?

@jtsiros
Copy link
Author

jtsiros commented Aug 28, 2018

@brutella Yes, I've tried 70 for min and 80 for max. Same result (logs):

DEBUG 2018/08/27 23:46:33 signature is valid
DEBUG 2018/08/27 23:46:33 Setup secure session
DEBUG 2018/08/27 23:46:33 192.168.7.28:53979 GET /accessories
DEBUG 2018/08/27 23:46:33 {"accessories":[{"aid":1,"services":[{"iid":1,"type":"3E","characteristics":[{"iid":2,"type":"14","perms":["pw"],"format":"bool"},{"iid":3,"type":"20","perms":["pr"],"value":"Nest Labs Inc","format":"string"},{"iid":4,"type":"21","perms":["pr"],"value":"undefined","format":"string"},{"iid":5,"type":"23","perms":["pr"],"value":"Nest","format":"string"},{"iid":6,"type":"30","perms":["pr"],"value":"undefined","format":"string"},{"iid":7,"type":"52","perms":["pr"],"value":"","format":"string"}]},{"iid":8,"type":"4A","characteristics":[{"iid":9,"type":"F","perms":["pr","ev"],"value":0,"format":"uint8"},{"iid":10,"type":"33","perms":["pr","pw","ev"],"value":0,"format":"uint8"},{"iid":11,"type":"11","perms":["pr","ev"],"value":75,"format":"float","unit":"celsius","maxValue":80,"minValue":70,"minStep":1},{"iid":12,"type":"35","perms":["pr","pw","ev"],"value":38,"format":"float","unit":"celsius","maxValue":80,"minValue":70,"minStep":1},{"iid":13,"type":"36","perms":["pr","pw","ev"],"value":0,"format":"uint8"}]}]}]}
DEBUG 2018/08/27 23:46:33 192.168.7.28:53979 POST /pairings
DEBUG 2018/08/27 23:46:33 ->     Method: Delete
DEBUG 2018/08/27 23:46:33 -> Permission: 0
DEBUG 2018/08/27 23:46:33 ->   Username: 1A9D0022-5D0F-4812-9514-7F1DE6DC2DFB
DEBUG 2018/08/27 23:46:33 ->       LTPK: []
DEBUG 2018/08/27 23:46:33 Remove LTPK for client '1A9D0022-5D0F-4812-9514-7F1DE6DC2DFB'
DEBUG 2018/08/27 23:46:33 Event: unpaired with device
DEBUG 2018/08/27 23:46:34 Close connection and remove session

@jtsiros
Copy link
Author

jtsiros commented Jan 10, 2019

Any suggestions on what the issue could be?

@brutella
Copy link
Owner

brutella commented May 7, 2019

Can somebody please try with hc v1.1.0?

@bjanders
Copy link

I just tried it, and it works without issues.

@jtsiros, note that the units are degrees Celsius (according to the HAP specs).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants