ONVIF/HomeKit: all-digit serial numbers stored as number, HAP warns "number instead of string"

Open Beginner friendly
#2,145 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
backend

Research direction

Start with onvif/src/main.ts at lines 57 and 485, then inspect homekit/src/info.ts at line 13 and the onvif dependency behavior described for lib/utils.js:35. Trace how serialNumber reaches HomeKit and ensure all-digit serials remain strings, then verify the warning no longer occurs when adding the described Tapo cameras.

Written by the indexing model from the issue text.

Description

Describe the bug

ONVIF cameras with all-digit serial numbers log this in the HomeKit plugin on every start:

[Tapo C200@@Serial Number] characteristic was supplied illegal value: number instead of string, supplying illegal values will throw errors in the future

onvif@0.7.4 linerase() (lib/utils.js:35) runs parseFloat on numeric-looking strings. onvif/src/main.ts:57 and :485 copy onvifInfo.serialNumber into info unchanged, and homekit/src/info.ts:13 passes it to Characteristic.SerialNumber. Serials with hex letters stay strings:

"74619699" -> 74619699 number
"7461fb29" -> "7461fb29" string

To Reproduce

Add a Tapo C200/C110 with an all-digit serial via ONVIF and expose it to HomeKit.

Expected behavior

serialNumber stays a string, e.g. onvifInfo.serialNumber?.toString() in the ONVIF plugin or String(...) in info.ts.

Server

  • OS: Debian 12 LXC
  • Installation Method: Docker, server 0.147.0, onvif 0.1.31, homekit 1.2.65

Hardware Model

  • Device: Tapo C200 (fw 1.9.1), Tapo C110 (fw 1.5.4)

Client

  • Software: Home app
Dominant language
TypeScript
Stars
6k
Forks
399
Avg merge
12h 1m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from koush/scrypted

All issues in koush/scrypted

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.