Teslemetry / homebridge

Homebridge integration for Teslemetry and Tessie
Apache License 2.0
2 stars 1 forks source link

AssertionError [ERR_ASSERTION]: Accessories must be created with a non-empty displayName. #12

Open castleyt opened 2 weeks ago

castleyt commented 2 weeks ago

Describe The Issue: Plugin starts however get the following error

[27/08/2024, 10:19:40] [Tessie] AssertionError [ERR_ASSERTION]: Accessories must be created with a non-empty displayName. at new Accessory (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:495:11) at new PlatformAccessory (/usr/lib/node_modules/homebridge/src/platformAccessory.ts:72:9) at file:///usr/lib/node_modules/homebridge-tessie/src/platform.ts:134:33 at Array.forEach () at file:///usr/lib/node_modules/homebridge-tessie/src/platform.ts:109:30 at processTicksAndRejections (node:internal/process/task_queues:95:5) { generatedMessage: false, code: 'ERR_ASSERTION', actual: undefined, expected: true, operator: '=='

To Reproduce: Every time I start

Expected behavior: Should load without issue.

Have two Teslas on the account

Logs:

{ "name": "Tessie", "accessToken": "correct token applied", "prefixName": false, "_bridge": { "username": "######", "port": 47070 }, "platform": "Tessie" }

Screenshots:

Environment:

All latest versions

Bre77 commented 2 weeks ago

I suspect if you set prefixName to be true (which you would want to do with two vehicles) it might fix this, but I'll figure out why the issue occurred in the first place.

castleyt commented 2 weeks ago

I had prefixName set to true before, same error...

[Tessie] AssertionError [ERR_ASSERTION]: Accessories must be created with a non-empty displayName. at new Accessory (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:495:11) at new PlatformAccessory (/usr/lib/node_modules/homebridge/src/platformAccessory.ts:72:9) at file:///usr/lib/node_modules/homebridge-tessie/src/platform.ts:134:33 at Array.forEach () at file:///usr/lib/node_modules/homebridge-tessie/src/platform.ts:109:30 at processTicksAndRejections (node:internal/process/task_queues:95:5) { generatedMessage: false, code: 'ERR_ASSERTION', actual: undefined, expected: true, operator: '==' }

JSON

{ "name": "Tessie", "accessToken": "#####", "prefixName": true, "_bridge": { "username": "#####", "port": 47070 }, "platform": "Tessie" }

ggulik commented 2 weeks ago

I get the same error. I've tried it with prefixName set to true and false, same error either way

[MyTesla@Vent Windows@Configured Name] Characteristic not in required or optional characteristic section for service Window. Adding anyway.
[MyTesla@Awake@Configured Name] Characteristic not in required or optional characteristic section for service Switch. Adding anyway.
[MyTesla@Homelink@Configured Name] Characteristic not in required or optional characteristic section for service GarageDoorOpener. Adding anyway.
[8/29/2024, 8:21:42 AM] [MyTesla] AssertionError [ERR_ASSERTION]: Accessories must be created with a non-empty displayName.
    at new Accessory (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:495:11)
    at new PlatformAccessory (/usr/local/lib/node_modules/homebridge/src/platformAccessory.ts:72:9)
    at file:///usr/local/lib/node_modules/homebridge-tessie/src/platform.ts:111:33
    at Array.forEach (<anonymous>)
    at file:///usr/local/lib/node_modules/homebridge-tessie/src/platform.ts:96:30
    at processTicksAndRejections (node:internal/process/task_queues:95:5) {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: undefined,
  expected: true,
  operator: '=='
}
thatsnasty commented 1 week ago

Yep same error for me.

AssertionError [ERR_ASSERTION]: Accessories must be created with a non-empty displayName.
    at new Accessory (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:495:11)
    at new PlatformAccessory (/homebridge/node_modules/homebridge/src/platformAccessory.ts:72:9)
    at file:///homebridge/node_modules/homebridge-tessie/src/platform.ts:91:33
    at Array.forEach (<anonymous>)
    at file:///homebridge/node_modules/homebridge-tessie/src/platform.ts:68:26
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
Bre77 commented 1 week ago

Ok I believe this happens if you haven't named your vehicle or energy site, 0.4.2 adds default values for both. Please let me know if this release fixes the issue or not.

thatsnasty commented 1 week ago

Same issue unfortunately.

AssertionError [ERR_ASSERTION]: Accessories must be created with a non-empty displayName.
    at new Accessory (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:495:11)
    at new PlatformAccessory (/homebridge/node_modules/homebridge/src/platformAccessory.ts:72:9)
    at file:///homebridge/node_modules/homebridge-tessie/src/platform.ts:91:33
    at Array.forEach (<anonymous>)
    at file:///homebridge/node_modules/homebridge-tessie/src/platform.ts:68:26
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
{
    "name": "Tesla",
    "accessToken": "redacted",
    "prefixName": true,
    "platform": "Tessie"
}
Bre77 commented 1 week ago

Ok thanks for the updated error log, I moved the fix to cover both places displayName is used. Please try 0.4.3 and let me know again.

ggulik commented 1 week ago

That solved the problem for me, thank you!

thatsnasty commented 1 week ago

Still not working for me on 0.4.3

AssertionError [ERR_ASSERTION]: Accessories must be created with a non-empty displayName.
    at new Accessory (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:495:11)
    at new PlatformAccessory (/homebridge/node_modules/homebridge/src/platformAccessory.ts:72:9)
    at file:///homebridge/node_modules/homebridge-tessie/src/platform.ts:92:33
    at Array.forEach (<anonymous>)
    at file:///homebridge/node_modules/homebridge-tessie/src/platform.ts:68:26
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    {
    "name": "Tessie",
    "accessToken": "redacted",
    "prefixName": true,
    "platform": "Tessie"
}
Bre77 commented 1 week ago

I'm going to push another release to fix it yet another way, but if you could turn on debug logging the log immediately before the error will tell me what your displayName is trying to be set to, which will help identify why this keeps failing.

thatsnasty commented 1 week ago

0.4.3

[9/4/2024, 1:55:44 PM] Got SIGTERM, shutting down Homebridge...
[9/4/2024, 1:55:55 PM] [Tessie] Initializing Tessie platform...
[9/4/2024, 1:55:55 PM] [Tessie] Finished initializing platform: Redacted
[9/4/2024, 1:55:55 PM] [Tessie] Executed didFinishLaunching callback
[9/4/2024, 1:55:55 PM] Publishing bridge accessory (name: Homebridge D64B, publishInfo: {
  username: '0E:62:63:CE:D6:4B',
  port: 51728,
  pincode: '***-**-***',
  category: 2,
  bind: undefined,
  mdns: undefined,
  addIdentifyingMaterial: true,
  advertiser: 'bonjour-hap'
}).
Setup Payload:
X-HM://00243X2Y2DETU
Enter this code with your HomeKit app on your iOS device to pair with Homebridge:

    ┌────────────┐     
    │ 386-08-938 │     
    └────────────┘     

[9/4/2024, 1:55:55 PM] Homebridge v1.8.4 (HAP v0.12.2) (Homebridge D64B) is running on port 51728.
[9/4/2024, 1:55:55 PM] 

NOTICE TO USERS AND PLUGIN DEVELOPERS
> Homebridge 2.0 is on the way and brings some breaking changes to existing plugins.
> Please visit the following link to learn more about the changes and how to prepare:
> https://github.com/homebridge/homebridge/wiki/Updating-To-Homebridge-v2.0

[9/4/2024, 1:55:56 PM] [Tessie] Adding new accessory: 
[9/4/2024, 1:55:56 PM] AssertionError [ERR_ASSERTION]: Accessories must be created with a non-empty displayName.
    at new Accessory (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:495:11)
    at new PlatformAccessory (/homebridge/node_modules/homebridge/src/platformAccessory.ts:72:9)
    at file:///homebridge/node_modules/homebridge-tessie/src/platform.ts:92:33
    at Array.forEach (<anonymous>)
    at file:///homebridge/node_modules/homebridge-tessie/src/platform.ts:68:26
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
[9/4/2024, 1:55:56 PM] Got SIGTERM, shutting down Homebridge...

0.4.4 appears to be working fine

[9/4/2024, 1:56:33 PM] [Tessie] Initializing Tessie platform...
[9/4/2024, 1:56:33 PM] [Tessie] Finished initializing platform: redacted
[9/4/2024, 1:56:33 PM] [Tessie] Executed didFinishLaunching callback
[9/4/2024, 1:56:33 PM] Publishing bridge accessory (name: Homebridge D64B, publishInfo: {
  username: '0E:62:63:CE:D6:4B',
  port: 51728,
  pincode: '***-**-***',
  category: 2,
  bind: undefined,
  mdns: undefined,
  addIdentifyingMaterial: true,
  advertiser: 'bonjour-hap'
}).
Setup Payload:
X-HM://00243X2Y2DETU
Enter this code with your HomeKit app on your iOS device to pair with Homebridge:

    ┌────────────┐     
    │ 386-08-938 │     
    └────────────┘     

[9/4/2024, 1:56:34 PM] Homebridge v1.8.4 (HAP v0.12.2) (Homebridge D64B) is running on port 51728.
[9/4/2024, 1:56:34 PM] 

NOTICE TO USERS AND PLUGIN DEVELOPERS
> Homebridge 2.0 is on the way and brings some breaking changes to existing plugins.
> Please visit the following link to learn more about the changes and how to prepare:
> https://github.com/homebridge/homebridge/wiki/Updating-To-Homebridge-v2.0

[9/4/2024, 1:56:36 PM] [Tessie] Adding new accessory: Tesla
[Tesla@Battery@Configured Name] Characteristic not in required or optional characteristic section for service Battery. Adding anyway.
[9/4/2024, 1:56:36 PM] [Tessie] Configured name changing to Tesla Battery
[Tesla@Climate@Configured Name] Characteristic not in required or optional characteristic section for service Thermostat. Adding anyway.
[9/4/2024, 1:56:36 PM] [Tessie] Configured name changing to Tesla Climate
[Tesla@Charge Current@Configured Name] Characteristic not in required or optional characteristic section for service Lightbulb. Adding anyway.
[9/4/2024, 1:56:36 PM] [Tessie] Configured name changing to Tesla Charge Current
[Tesla@Charge Limit@Configured Name] Characteristic not in required or optional characteristic section for service Lightbulb. Adding anyway.
[9/4/2024, 1:56:36 PM] [Tessie] Configured name changing to Tesla Charge Limit
[Tesla@Charge Port@Configured Name] Characteristic not in required or optional characteristic section for service LockMechanism. Adding anyway.
[9/4/2024, 1:56:36 PM] [Tessie] Configured name changing to Tesla Charge Port
[Tesla@Charge@Configured Name] Characteristic not in required or optional characteristic section for service Switch. Adding anyway.
[9/4/2024, 1:56:36 PM] [Tessie] Configured name changing to Tesla Charge
[Tesla@Defrost@Configured Name] Characteristic not in required or optional characteristic section for service Switch. Adding anyway.
[9/4/2024, 1:56:36 PM] [Tessie] Configured name changing to Tesla Defrost
[Tesla@Frunk@Configured Name] Characteristic not in required or optional characteristic section for service Door. Adding anyway.
[9/4/2024, 1:56:36 PM] [Tessie] Configured name changing to Tesla Frunk
[Tesla@Trunk@Configured Name] Characteristic not in required or optional characteristic section for service Door. Adding anyway.
[9/4/2024, 1:56:36 PM] [Tessie] Configured name changing to Tesla Trunk
[Tesla@Lock@Configured Name] Characteristic not in required or optional characteristic section for service LockMechanism. Adding anyway.
[9/4/2024, 1:56:36 PM] [Tessie] Configured name changing to Tesla Lock
[Tesla@Sentry@Configured Name] Characteristic not in required or optional characteristic section for service SecuritySystem. Adding anyway.
[9/4/2024, 1:56:36 PM] [Tessie] Configured name changing to Tesla Sentry
[Tesla@Vent Windows@Configured Name] Characteristic not in required or optional characteristic section for service Window. Adding anyway.
[9/4/2024, 1:56:36 PM] [Tessie] Configured name changing to Tesla Vent Windows
[Tesla@Awake@Configured Name] Characteristic not in required or optional characteristic section for service Switch. Adding anyway.
[9/4/2024, 1:56:36 PM] [Tessie] Configured name changing to Tesla Awake
castleyt commented 1 week ago

working for me... thanks