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

Custom characteristic #148

Closed
XciD opened this issue Oct 15, 2019 · 3 comments
Closed

Custom characteristic #148

XciD opened this issue Oct 15, 2019 · 3 comments

Comments

@XciD
Copy link

XciD commented Oct 15, 2019

Hello,

I'm trying to define a custom characteristic like here in nodejs:

const TypeChangeTrack = "00000047-0000-1000-8000-656261617577"

type ChangeTrack struct {
	*characteristic.Int
}

func NewChangeTrack() *ChangeTrack {
	char := characteristic.NewInt(TypeChangeTrack)
	char.Format = characteristic.FormatInt32
	char.Perms = []string{characteristic.PermRead, characteristic.PermWrite, characteristic.PermEvents}
	char.SetMinValue(-1)
	char.SetMaxValue(1)
	char.SetStepValue(1)
	char.Description = "Track Change"

	return &ChangeTrack{char}
}

When I add this characteristic, Home+4 report: No Response
Any pointer ?

Thanks for your project

@brutella
Copy link
Owner

It should work if you set a default value.

char.SetValue(0)

@XciD
Copy link
Author

XciD commented Oct 16, 2019

Same, not working

192.168.1.249:51641 GET /accessories
{
	"accessories": [{
		"aid": 1,
		"services": [{
			"iid": 1,
			"type": "3E",
			"characteristics": [{
				"iid": 2,
				"type": "14",
				"perms": ["pw"],
				"format": "bool"
			}, {
				"iid": 3,
				"type": "20",
				"perms": ["pr"],
				"value": "Spotify",
				"format": "string"
			}, {
				"iid": 4,
				"type": "21",
				"perms": ["pr"],
				"value": "undefined",
				"format": "string"
			}, {
				"iid": 5,
				"type": "23",
				"perms": ["pr"],
				"value": "Spotify",
				"format": "string"
			}, {
				"iid": 6,
				"type": "30",
				"perms": ["pr"],
				"value": "undefined",
				"format": "string"
			}, {
				"iid": 7,
				"type": "52",
				"perms": ["pr"],
				"value": "undefined",
				"format": "string"
			}]
		}, {
			"iid": 8,
			"type": "49",
			"characteristics": [{
				"iid": 9,
				"type": "25",
				"perms": ["pr", "pw", "ev"],
				"value": false,
				"format": "bool"
			}]
		}, {
			"iid": 10,
			"type": "113",
			"characteristics": [{
				"iid": 11,
				"type": "11A",
				"perms": ["pr", "pw", "ev"],
				"value": false,
				"format": "bool"
			}, {
				"iid": 12,
				"type": "00000047-0000-1000-8000-656261617577",
				"perms": ["pr", "pw", "ev"],
				"description": "Track Change",
				"value": 0,
				"format": "int32",
				"maxValue": 1,
				"minValue": -1,
				"minStep": 1
			}, {
				"iid": 13,
				"type": "119",
				"perms": ["pr", "pw", "ev"],
				"value": 0,
				"format": "uint8",
				"unit": "percentage",
				"maxValue": 100,
				"minValue": 0,
				"minStep": 1
			}]
		}]
	}]
}

@brutella
Copy link
Owner

brutella commented Mar 2, 2022

Is this still an issue?

@XciD XciD closed this as completed Mar 2, 2022
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

2 participants