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

WindowCovering not working #56

Closed
yfre opened this issue Jan 22, 2019 · 14 comments
Closed

WindowCovering not working #56

yfre opened this issue Jan 22, 2019 · 14 comments

Comments

@yfre
Copy link
Contributor

yfre commented Jan 22, 2019

WindowCovering was not working for me. I get the message "Could not add home" in the home app. commenting out following lines in WindowCoveringService solved the issue
/**
addCharacteristic(new HoldPositionCharacteristic(windowCovering));

	addCharacteristic(new ObstructionDetectedCharacteristic(() -> windowCovering.getObstructionDetected(),
			c -> windowCovering.subscribeObstructionDetected(c),
			() -> windowCovering.unsubscribeObstructionDetected()));

	if (windowCovering instanceof HorizontalTiltingWindowCovering) {
		addCharacteristic(new CurrentHorizontalTiltAngleCharacteristic(
				(HorizontalTiltingWindowCovering) windowCovering));
		addCharacteristic(new TargetHorizontalTiltAngleCharacteristic(
				(HorizontalTiltingWindowCovering) windowCovering));
	}
	if (windowCovering instanceof VerticalTiltingWindowCovering) {
		addCharacteristic(new CurrentVerticalTiltAngleCharacteristic(
				(VerticalTiltingWindowCovering) windowCovering));
		addCharacteristic(new TargetVerticalTiltAngleCharacteristic(
				(VerticalTiltingWindowCovering) windowCovering));
	}

*/

still unsure what is wrong with that characteristics.

@yfre
Copy link
Contributor Author

yfre commented Jan 22, 2019

here the json part generated for accessories that make home app to stop to work

{
"aid": 785117798,
"services": [
{
"iid": 1,
"type": "0000003E-0000-1000-8000-0026BB765291",
"characteristics": [
{
"iid": 2,
"type": "00000023-0000-1000-8000-0026BB765291",
"perms": [
"pr"
],
"format": "string",
"events": false,
"bonjour": false,
"description": "Name of the accessory",
"value": "Arbeitszimmer Rollladen",
"maxLen": 255
},
{
"iid": 3,
"type": "00000020-0000-1000-8000-0026BB765291",
"perms": [
"pr"
],
"format": "string",
"events": false,
"bonjour": false,
"description": "The name of the manufacturer",
"value": "none",
"maxLen": 255
},
{
"iid": 4,
"type": "00000021-0000-1000-8000-0026BB765291",
"perms": [
"pr"
],
"format": "string",
"events": false,
"bonjour": false,
"description": "The name of the model",
"value": "none",
"maxLen": 255
},
{
"iid": 5,
"type": "00000030-0000-1000-8000-0026BB765291",
"perms": [
"pr"
],
"format": "string",
"events": false,
"bonjour": false,
"description": "The serial number of the accessory",
"value": "none",
"maxLen": 255
},
{
"iid": 6,
"type": "00000014-0000-1000-8000-0026BB765291",
"perms": [
"pw"
],
"format": "bool",
"events": false,
"bonjour": false,
"description": "Identifies the accessory via a physical action on the accessory"
}
]
},
{
"iid": 7,
"type": "0000008C-0000-1000-8000-0026BB765291",
"characteristics": [
{
"iid": 8,
"type": "00000023-0000-1000-8000-0026BB765291",
"perms": [
"pr"
],
"format": "string",
"events": false,
"bonjour": false,
"description": "Name of the accessory",
"value": "Arbeitszimmer Rollladen",
"maxLen": 255
},
{
"iid": 9,
"type": "0000006D-0000-1000-8000-0026BB765291",
"perms": [
"pr",
"ev"
],
"format": "int",
"events": false,
"bonjour": false,
"description": "The current position",
"value": 100,
"minValue": 0,
"maxValue": 100,
"minStep": 1,
"unit": "%"
},
{
"iid": 10,
"type": "0000006F-0000-1000-8000-0026BB765291",
"perms": [
"pw"
],
"format": "bool",
"events": false,
"bonjour": false,
"description": "Whether or not to hold position",
"value": null
},
{
"iid": 11,
"type": "00000072-0000-1000-8000-0026BB765291",
"perms": [
"pr",
"ev"
],
"format": "int",
"events": false,
"bonjour": false,
"description": "The position state",
"value": 2,
"minValue": 0,
"maxValue": 2,
"minStep": 1
},
{
"iid": 12,
"type": "0000007C-0000-1000-8000-0026BB765291",
"perms": [
"pw",
"pr",
"ev"
],
"format": "int",
"events": false,
"bonjour": false,
"description": "The target position",
"value": 100,
"minValue": 0,
"maxValue": 100,
"minStep": 1,
"unit": "%"
},
{
"iid": 13,
"type": "00000024-0000-1000-8000-0026BB765291",
"perms": [
"pr",
"ev"
],
"format": "bool",
"events": false,
"bonjour": false,
"description": "An obstruction has been detected",
"value": false
}
]
}
]
}

@ghost
Copy link

ghost commented Jan 27, 2019

Same here

@timcharper
Copy link
Contributor

I'm also observing this; when I include a MockWindowCovering in the sample app, things fail horribly. It breaks the pairing and I have to delete the pairing info and start over with the sample app. It's really a catastrophic failure, and really quite weird.

@timcharper
Copy link
Contributor

Seems like one of the characteristics is misconfigured; I've stripped it back to the required characteristics, and it works;

timcharper@97de9aa

@jrburk
Copy link

jrburk commented Feb 5, 2019

Seems like one of the characteristics is misconfigured; I've stripped it back to the required characteristics, and it works;

timcharper@97de9aa

Hmm, can you post your code here. I think I have the minimal code, but the problem still exists.

@yfre
Copy link
Contributor Author

yfre commented Feb 6, 2019

Seems like one of the characteristics is misconfigured; I've stripped it back to the required characteristics, and it works;
timcharper@97de9aa

Hmm, can you post your code here. I think I have the minimal code, but the problem still exists.

in class WindowCoveringService i commented out following lines
/*
addCharacteristic(new HoldPositionCharacteristic(windowCovering));
addCharacteristic(new ObstructionDetectedCharacteristic(() -> windowCovering.getObstructionDetected(),
c -> windowCovering.subscribeObstructionDetected(c),
() -> windowCovering.unsubscribeObstructionDetected()));

if (windowCovering instanceof HorizontalTiltingWindowCovering) {
addCharacteristic(new CurrentHorizontalTiltAngleCharacteristic((HorizontalTiltingWindowCovering) windowCovering));
addCharacteristic(new TargetHorizontalTiltAngleCharacteristic((HorizontalTiltingWindowCovering) windowCovering));
}
if (windowCovering instanceof VerticalTiltingWindowCovering) {
addCharacteristic(new CurrentVerticalTiltAngleCharacteristic((VerticalTiltingWindowCovering) windowCovering));
addCharacteristic(new TargetVerticalTiltAngleCharacteristic((VerticalTiltingWindowCovering) windowCovering));
}
*/

@jrburk
Copy link

jrburk commented Feb 6, 2019

Thank you. Now it's working for me too...

timcharper added a commit to timcharper/HAP-Java that referenced this issue Feb 18, 2019
Including HoldPositionCharacteristic causes the pairing to become corrupted, to
the extend that the windowcovering accessory must be removed and the brige
pairing cleared and paired anew.

It isn't clear why this optional characteristic causes such spectacular
failure, but it definitely does.

Resolves hap-java#56
timcharper added a commit to timcharper/HAP-Java that referenced this issue Feb 18, 2019
The pattern for most accessories is to require only the required
characteristics, and then allow the specification of optional characteristics
via the inclusion of interfaces. This pattern was not followed with
WindowCovering. Worse, for reasons currently not understood, the inclusion of
the HoldPositionCharacteristic causes the homekit pairing with the bridge to be
completely unresponsive. (See issue hap-java#56)

Change is made in a backwards compatible way, so that existing implementations
that depend on WindowCovering as implemented will continue to function

Addresses hap-java#56
timcharper added a commit to timcharper/HAP-Java that referenced this issue Feb 18, 2019
The pattern for most accessories is to require only the required
characteristics, and then allow the specification of optional characteristics
via the inclusion of interfaces. This pattern was not followed with
WindowCovering. Worse, for reasons currently not understood, the inclusion of
the HoldPositionCharacteristic causes the homekit pairing with the bridge to be
completely unresponsive. (See issue hap-java#56)

Change is made in a backwards compatible way, so that existing implementations
that depend on WindowCovering as implemented will continue to function

Addresses hap-java#56
timcharper added a commit to timcharper/HAP-Java that referenced this issue Feb 18, 2019
The pattern for most accessories is to require only the required
characteristics, and then allow the specification of optional characteristics
via the inclusion of interfaces. This pattern was not followed with
WindowCovering. Worse, for reasons currently not understood, the inclusion of
the HoldPositionCharacteristic causes the homekit pairing with the bridge to be
completely unresponsive. (See issue hap-java#56)

Change is made in a backwards compatible way, so that existing implementations
that depend on WindowCovering as implemented will continue to function

Addresses hap-java#56
@timcharper
Copy link
Contributor

I've narrowed it down to HoldPositionCharacteristic, FYI

@timcharper
Copy link
Contributor

@jrburk I still have no idea why HoldPositionCharacteristic is causing this. The latest release will use BasicWindowCovering, in the meantime.

@sobeos
Copy link
Contributor

sobeos commented Jul 25, 2019

Any news on window coverings? I have horizontal tilting window coverings. HorizontalTiltingWindowCovering extends WindowCovering. WindowCovering is deprecated.

@sobeos
Copy link
Contributor

sobeos commented Jan 2, 2020

I still have no idea why HoldPositionCharacteristic is causing this.

Problem is that the characteristic is write only.
Homekit complains:
"Non-readable characteristics must not contain 'value' key".
The problem is in BaseCharacteristic -> makeBuilder

@sobeos
Copy link
Contributor

sobeos commented Jan 2, 2020

Looks like
if (isReadable) {
setJsonValue(builder, value);
}
is fixing the problem.

@timcharper
Copy link
Contributor

Great find! Would you mind opening up a pull request?

sobeos pushed a commit to sobeos/HAP-Java that referenced this issue Jan 4, 2020
@yfre
Copy link
Contributor Author

yfre commented Jun 10, 2020

fixed in #101

@ccutrer ccutrer closed this as completed Jun 23, 2020
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

5 participants