Skip to content
This repository has been archived by the owner on Sep 9, 2023. It is now read-only.

TypeError: characteristic.internalHAPRepresentation is not a function #8

Closed
miguelpereiraesousa opened this issue Mar 25, 2022 · 8 comments

Comments

@miguelpereiraesousa
Copy link

Hi,
Installing this pluggin it shows this error and Homebridge stops.
Can you help??
TypeError: characteristic.internalHAPRepresentation is not a function
at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Service.ts:648:82
at Array.map ()
at Switch.Service.internalHAPRepresentation (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Service.ts:648:45)
at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1097:54
at Array.map ()
at Accessory.internalHAPRepresentation (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1097:31)
at Bridge.Accessory.internalHAPRepresentation (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1104:36)
at Bridge. (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1213:25)
at step (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:143:27)
at Object.next (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:124:57)
at /usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:117:75
at new Promise ()
at __awaiter (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:113:16)
at Bridge.Accessory.publish (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Accessory.js:928:38)
at BridgeService.publishBridge (/usr/local/lib/node_modules/homebridge/src/bridgeService.ts:215:17)
at Server.publishBridge (/usr/local/lib/node_modules/homebridge/src/server.ts:186:24)
at /usr/local/lib/node_modules/homebridge/src/server.ts:177:24
at Server.start (/usr/local/lib/node_modules/homebridge/src/server.ts:176:5)

@abry-cz
Copy link

abry-cz commented Apr 15, 2022

Same problem here. Plese, please fix it...

@paolotremadio
Copy link
Owner

Hi, can you please provide node version, homebridge vedsion, your config as well as some details about how you’re running homebridge?

@abry-cz
Copy link

abry-cz commented Apr 15, 2022

Node: v17.9.0
Homebridge: 1.4.0

Part of my config
{
"accessory": "AutomationChromecastPlay",
"name": "Bedroom chime",
"chromecastDeviceName": "Bedroom speaker",
"mediaFile": "/usr/local/lib/node_modules/homebridge-automation-chromecast-play/media.json"
}

I run my homebridge on raspbian 10 buster.

There is also one more error in the logs:
The plugin "homebridge-automation-chromecast-play" defines 'homebridge' and/or 'hap-nodejs' in their 'dependencies' section, meaning they carry an additional copy of homebridge and hap-nodejs. This not only wastes disk space, but also can cause major incompatibility issues and thus is considered bad practice. Please inform the developer to update their plugin!

@paolotremadio
Copy link
Owner

The last bit is a very annoying warning that makes no difference so you can safely ignore it.

Regarding the rest, I've tried it on a lower version of node/homebridge and it works. The error is in the internals of homebridge so I would not know where to start to fix it (since there's been no published change to the APIs)

@abry-cz
Copy link

abry-cz commented Apr 30, 2022

There is new version of homebridge out there (1.4.1), this is from changelog:

Upgraded HAP-NodeJS to v0.10.2
Fix an issue with network interface family detection when running Node.js 18 @oznu homebridge/HAP-NodeJS#947
Fixed memory leak with HomeKit DataStreams @Supereg homebridge/HAP-NodeJS#943

With homebridge update to 1.4.1 I receive new error ... is this fixable on your side? :-)

TypeError: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined
at Object.openSync (node:fs:578:10)
at Object.readFileSync (node:fs:454:35)
at AutomationChromecastPlay.loadMedia (/usr/local/lib/node_modules/homebridge-automation-chromecast-play/index.js:100:25)
at new AutomationChromecastPlay (/usr/local/lib/node_modules/homebridge-automation-chromecast-play/index.js:28:10)
at /usr/local/lib/node_modules/homebridge/src/server.ts:352:50
at Array.forEach ()
at Server.loadAccessories (/usr/local/lib/node_modules/homebridge/src/server.ts:272:29)
at Server.start (/usr/local/lib/node_modules/homebridge/src/server.ts:164:12)

@rinky-dinky
Copy link

I'm seeing the same exact issue. I've tested on homebridge 1.2.x, 1.3.x, and 1.4.x with no success. I've also tried Node v12, v14, and v16.

@kernel0
Copy link

kernel0 commented Sep 17, 2022

"TypeError: characteristic.internalHAPRepresentation is not a function"

exactly same here!
homebridge version v1.5.0 ,
nodejs version, v16.16.0

@paolotremadio
Copy link
Owner

Continuing conversation over #9

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

No branches or pull requests

5 participants