NRCHKB / node-red-contrib-homekit-bridged

Node-RED Contribution - HomeKit Bridged : Node-RED nodes to simulate Apple HomeKit devices.
https://nrchkb.github.io
MIT License
412 stars 52 forks source link

[Bug]: Incorrect attribute error but attribute is on the list of supported attributes in the message. #456

Closed sjorge closed 2 years ago

sjorge commented 2 years ago

NRCHKB Plugin Version

1.4.3

Node JS Version

16.13.0

NPM Version

8.1.0

Node-RED Version

2.0.6

Operating System

OmniOS r151041

What happened?

When sending a update that contains LockPhysicalControls to an AirPurifier service it complains about the characteristic not being supported, but according to HAP-NodeJS it is and it's also listed in the actual error as supported.

Screen Shot 2021-11-14 at 14 46 45

The service has the follow

{
    "Active": true,
    "CurrentAirPurifierState": true,
    "TargetAirPurifierState": true,
    "LockPhysicalControls": true,
    "RotationSpeed": {
        "minValue": 0,
        "maxValue": 9
    }
}

How to reproduce?

Send a the following payload to an AirPurifier service:

{"LockPhysicalControls ":0,"Active":1,"CurrentAirPurifierState":2,"TargetAirPurifierState":1,"RotationSpeed":1}

Expected behavior:

LockPhysicalControls to be accepted for an AirPurifier service as per the definition in https://github.com/homebridge/HAP-NodeJS/blob/43c0143db22cf6c1285cdef15d70adf546a34687/src/lib/definitions/ServiceDefinitions.ts#L117

Additional comments?

No response

Relevant log output

Instead of LockPhysicalControls  try one of these characteristics: Name, Active, CurrentAirPurifierState, TargetAirPurifierState, LockPhysicalControls, RotationSpeed, LockPhysicalControls, Name, RotationSpeed, SwingMode

I'm guessing something is going wrong somewhere as LockPhysicalControls also appears twice in the error.

crxporter commented 2 years ago

Do you have a trailing space in "LockPhysicalControls "

it looks like some places you have a whitespace in there.

crxporter commented 2 years ago

Did you put it with the extra whitespace character in your characteristic properties? That could make it appear twice in the list of chars to use.

sjorge commented 2 years ago

Well that was embarrassing, especially since I spend most of yesterday looking into this error before giving up and filing a ticket.

I just delete and recreated the character properties from scratch, I was not seeing a space so it might have been some sort of random control character that snuck in.

crxporter commented 2 years ago

Well it's still interesting, I would have expected the whitespace to be removed with the regex filter which should be running on the char props... reaching out to @Shaquu to see if there's some reason the regex ignores the last character of that string?

Shaquu commented 2 years ago

@sjorge no need for embarrassment. As discussed with @crxporter error will be a little more descriptive from now on.

image