homebridge-yoto 0.0.31 → 0.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/homebridge-ui/public/client.js +428 -0
- package/homebridge-ui/public/index.html +138 -0
- package/package.json +10 -1
- package/.github/dependabot.yml +0 -18
- package/.github/funding.yml +0 -4
- package/.github/workflows/release.yml +0 -41
- package/.github/workflows/tests.yml +0 -37
- package/AGENTS.md +0 -138
- package/CHANGELOG.md +0 -16
- package/CONTRIBUTING.md +0 -34
- package/NOTES.md +0 -87
- package/PLAN.md +0 -425
- package/eslint.config.js +0 -7
- package/index.test.js +0 -7
- package/logo.png +0 -0
- package/pnpm-workspace.yaml +0 -4
- package/tsconfig.json +0 -14
package/AGENTS.md
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
# Agent Development Notes
|
|
2
|
-
|
|
3
|
-
This document contains patterns, conventions, and guidelines for developing the homebridge-yoto plugin.
|
|
4
|
-
|
|
5
|
-
## Dont write summary markdown files unless asked to do so
|
|
6
|
-
|
|
7
|
-
## JSDoc Typing Patterns
|
|
8
|
-
|
|
9
|
-
### Use TypeScript-in-JavaScript (ts-in-js)
|
|
10
|
-
|
|
11
|
-
All source files use `.js` extensions with JSDoc comments for type safety. This provides type checking without TypeScript compilation overhead.
|
|
12
|
-
|
|
13
|
-
### Avoid `any` types
|
|
14
|
-
|
|
15
|
-
Always provide specific types. Use `unknown` when the type is truly unknown, then narrow it with type guards.
|
|
16
|
-
|
|
17
|
-
**Bad:**
|
|
18
|
-
```javascript
|
|
19
|
-
/**
|
|
20
|
-
* @param {any} data
|
|
21
|
-
*/
|
|
22
|
-
function processData(data) {
|
|
23
|
-
return data.value;
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
**Good:**
|
|
28
|
-
```javascript
|
|
29
|
-
/**
|
|
30
|
-
* @param {YotoDeviceStatus} status
|
|
31
|
-
* @returns {number}
|
|
32
|
-
*/
|
|
33
|
-
function getBatteryLevel(status) {
|
|
34
|
-
return status.batteryLevelPercentage;
|
|
35
|
-
}
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### Use @ts-expect-error over @ts-ignore
|
|
39
|
-
|
|
40
|
-
When you must suppress a TypeScript error, use `@ts-expect-error` with a comment explaining why. This will error if the issue is fixed, prompting cleanup.
|
|
41
|
-
|
|
42
|
-
**Bad:**
|
|
43
|
-
```javascript
|
|
44
|
-
// @ts-ignore
|
|
45
|
-
const value = accessory.context.device.unknownProperty;
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
**Good:**
|
|
49
|
-
```javascript
|
|
50
|
-
// @ts-expect-error - API may return undefined for offline devices
|
|
51
|
-
const lastSeen = accessory.context.device.lastSeenAt;
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### Use newer @import syntax in jsdoc/ts-in-js for types only
|
|
55
|
-
|
|
56
|
-
Import types using the `@import` JSDoc tag to avoid runtime imports of type-only dependencies.
|
|
57
|
-
|
|
58
|
-
```javascript
|
|
59
|
-
/** @import { API, DynamicPlatformPlugin, Logger, PlatformAccessory, PlatformConfig, Service, Characteristic } from 'homebridge' */
|
|
60
|
-
/** @import { YotoDevice, YotoDeviceStatus, YotoDeviceConfig } from './types.js' */
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* @param {Logger} log
|
|
64
|
-
* @param {PlatformConfig} config
|
|
65
|
-
* @param {API} api
|
|
66
|
-
*/
|
|
67
|
-
export function YotoPlatform(log, config, api) {
|
|
68
|
-
this.log = log;
|
|
69
|
-
this.config = config;
|
|
70
|
-
this.api = api;
|
|
71
|
-
}
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### Import Consolidation
|
|
75
|
-
|
|
76
|
-
Keep regular imports and type imports separate. Use single-line imports for types when possible.
|
|
77
|
-
|
|
78
|
-
```javascript
|
|
79
|
-
import { EventEmitter } from 'events';
|
|
80
|
-
|
|
81
|
-
/** @import { YotoDevice } from './types.js' */
|
|
82
|
-
/** @import { API, PlatformAccessory } from 'homebridge' */
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
## Event Pattern Preference
|
|
86
|
-
|
|
87
|
-
### Use Aggregate Events with Exhaustive Type Narrowing
|
|
88
|
-
|
|
89
|
-
The `yoto-nodejs-client` library should emit **only aggregate events** with `changedFields` arrays:
|
|
90
|
-
|
|
91
|
-
- `statusUpdate` - passes `(status, source, changedFields[])`
|
|
92
|
-
- `configUpdate` - passes `(config, changedFields[])`
|
|
93
|
-
- `playbackUpdate` - passes `(playback, changedFields[])`
|
|
94
|
-
|
|
95
|
-
**Do NOT create granular field events** like `volumeChanged`, `batteryLevelChanged`, etc.
|
|
96
|
-
|
|
97
|
-
### Homebridge Plugin Pattern
|
|
98
|
-
|
|
99
|
-
The plugin should use exhaustive switch statements to handle field updates:
|
|
100
|
-
|
|
101
|
-
```javascript
|
|
102
|
-
this.deviceModel.on('statusUpdate', (status, source, changedFields) => {
|
|
103
|
-
for (const field of changedFields) {
|
|
104
|
-
switch (field) {
|
|
105
|
-
case 'volume':
|
|
106
|
-
// Update volume characteristic
|
|
107
|
-
break
|
|
108
|
-
|
|
109
|
-
case 'batteryLevelPercentage':
|
|
110
|
-
// Update battery characteristic
|
|
111
|
-
break
|
|
112
|
-
|
|
113
|
-
// ... handle all fields
|
|
114
|
-
|
|
115
|
-
case 'firmwareVersion':
|
|
116
|
-
// Empty case - available but not used yet
|
|
117
|
-
break
|
|
118
|
-
|
|
119
|
-
default: {
|
|
120
|
-
// Exhaustive check - TypeScript error if field missed
|
|
121
|
-
const _exhaustive: never = field
|
|
122
|
-
break
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
})
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
**Benefits:**
|
|
130
|
-
- Fewer event listeners (3 instead of 20+)
|
|
131
|
-
- Exhaustive TypeScript checking ensures all fields handled
|
|
132
|
-
- Empty cases document available fields
|
|
133
|
-
- Easy to extend - just fill in empty cases
|
|
134
|
-
- Type-safe with proper field typing
|
|
135
|
-
|
|
136
|
-
## Changelog Management
|
|
137
|
-
|
|
138
|
-
**NEVER manually edit CHANGELOG.md**
|
package/CHANGELOG.md
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
9
|
-
|
|
10
|
-
## 0.0.31
|
|
11
|
-
|
|
12
|
-
### Commits
|
|
13
|
-
|
|
14
|
-
- init [`88b35b6`](https://github.com/bcomnes/homebridge-yoto/commit/88b35b695166c6f5c3e3ec381c4afb52940a369b)
|
|
15
|
-
- WIP [`cf0e5c8`](https://github.com/bcomnes/homebridge-yoto/commit/cf0e5c85df5984eb7fe10a2118de08990d875337)
|
|
16
|
-
- Implement against client [`27d4fae`](https://github.com/bcomnes/homebridge-yoto/commit/27d4fae930a84f12a4671d3cd129c299505e398b)
|
package/CONTRIBUTING.md
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# Contributing
|
|
2
|
-
|
|
3
|
-
## Releasing
|
|
4
|
-
|
|
5
|
-
Changelog and releasing are automated with npm scripts and actions. To create a release:
|
|
6
|
-
|
|
7
|
-
- Navigate to the Actions tab.
|
|
8
|
-
- Select the `npm bump` action.
|
|
9
|
-
- Trigger the action, specifying the semantic version bump that is needed.
|
|
10
|
-
- Changelog, GitHub release, and npm publish are handled by the action.
|
|
11
|
-
- An in-depth review of this system is documented here: [bret.io/projects/package-automation](https://bret.io/projects/package-automation/).
|
|
12
|
-
|
|
13
|
-
If for some reason this isn't working or a local release is preferred, follow these steps:
|
|
14
|
-
|
|
15
|
-
- Ensure a clean working git workspace.
|
|
16
|
-
- Run `npm version {patch, minor, major}`.
|
|
17
|
-
- This will update the version number and generate the changelog.
|
|
18
|
-
- Run `npm publish`.
|
|
19
|
-
- This will push your local git branch and tags to the default remote, perform a [gh-release](https://ghub.io/gh-release), and create an npm publication.
|
|
20
|
-
|
|
21
|
-
## Guidelines
|
|
22
|
-
|
|
23
|
-
- Patches, ideas, and changes are welcome.
|
|
24
|
-
- Fixes are almost always welcome.
|
|
25
|
-
- Features are sometimes welcome.
|
|
26
|
-
- Please open an issue to discuss the idea prior to spending lots of time on the problem.
|
|
27
|
-
- It may be rejected.
|
|
28
|
-
- If you don't want to wait for the discussion to commence and you really want to jump into the implementation work, be prepared to fork the project if the idea is respectfully declined.
|
|
29
|
-
- Try to stay within the style of the existing code.
|
|
30
|
-
- All tests must pass.
|
|
31
|
-
- Additional features or code paths must be tested.
|
|
32
|
-
- Aim for 100% test coverage.
|
|
33
|
-
- Questions are welcome. However, unless there is an official support contract established between the maintainers and the requester, support is not guaranteed.
|
|
34
|
-
- Contributors reserve the right to walk away from this project at any moment, with or without notice.
|
package/NOTES.md
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
Homebridge Notes
|
|
2
|
-
http://bee.local:8581/login
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
- Instance: https://homebridge.io
|
|
6
|
-
- Homepage: https://homebridge.io
|
|
7
|
-
- Plugin Docs: https://developers.homebridge.io/#/
|
|
8
|
-
- Wiki: https://github.com/homebridge/homebridge/wiki
|
|
9
|
-
- Homebridge package: https://github.com/homebridge/homebridge
|
|
10
|
-
- Plugins Repo: https://github.com/homebridge/plugins
|
|
11
|
-
- Plugin UI Utils: https://github.com/homebridge/plugin-ui-utils
|
|
12
|
-
- HAP Client: https://github.com/homebridge/hap-client
|
|
13
|
-
- HAP-NodeJS: https://github.com/homebridge/HAP-NodeJS
|
|
14
|
-
- HAP-NodeJS JSDocs: https://developers.homebridge.io/HAP-NodeJS/modules.html
|
|
15
|
-
- Old docs?: https://github.com/homebridge/documentation
|
|
16
|
-
- PLugin Tempalte: https://github.com/homebridge/homebridge-plugin-template
|
|
17
|
-
- Template lib helper thing: https://github.com/ebaauw/homebridge-lib
|
|
18
|
-
- Ring: https://github.com/homebridge-plugins/homebridge-meross/blob/9ea479ea94a8cfa8dce9051976fafb8308faae85/lib/platform.js#L1037
|
|
19
|
-
- Scoped Plugins (Reference) https://github.com/homebridge/plugins/wiki/Scoped-Plugins#available-plugins
|
|
20
|
-
- https://github.com/homebridge-plugins/homebridge-rainbird/blob/latest/src/platform.ts
|
|
21
|
-
- https://github.com/homebridge-plugins/homebridge-unifi-network
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
Yoto Docs:
|
|
25
|
-
- https://yoto.dev/get-started/start-here/
|
|
26
|
-
- https://yoto.dev/api/
|
|
27
|
-
- https://yoto.space/developers
|
|
28
|
-
- https://yoto.space/developers/post/home-assistant-integration-Ao9OxbsMDBqaG9I
|
|
29
|
-
- https://github.com/yotoplay/examples
|
|
30
|
-
- https://github.com/yotoplay/twine-to-yoto
|
|
31
|
-
|
|
32
|
-
MQTT
|
|
33
|
-
- MQTT: https://github.com/mqttjs/MQTT.js
|
|
34
|
-
- https://mqtt.org
|
|
35
|
-
- https://www.emqx.com/en/blog/the-easiest-guide-to-getting-started-with-mqtt
|
|
36
|
-
- https://aws.amazon.com/what-is/mqtt/
|
|
37
|
-
- https://en.wikipedia.org/wiki/MQTT
|
|
38
|
-
-
|
|
39
|
-
|
|
40
|
-
- https://github.com/ebaauw/homebridge-zp/issues/10#issuecomment-270743358
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
- Implement a improved config type, and populate it.
|
|
44
|
-
- Audit the set functions in hb, make sure the client works/helps with that.
|
|
45
|
-
- Clean up unused vars and config
|
|
46
|
-
- Audit online/offline config set methods
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
[12/26/2025, 4:05:52 PM] [homebridge-yoto] Device discovered: GGs Boombox (y29sZvOdk63vN50Qed5eH4Y0)
|
|
50
|
-
[12/26/2025, 4:05:52 PM] [homebridge-yoto] Adding new accessory: GGs Boombox
|
|
51
|
-
[12/26/2025, 4:05:52 PM] [homebridge-yoto] [Accessory] Setting up GGs Boombox
|
|
52
|
-
[GGs Boombox@GGs Boombox@Status Active] Characteristic not in required or optional characteristic section for service SmartSpeaker. Adding anyway.
|
|
53
|
-
[GGs Boombox@GGs Boombox Battery@Status Active] Characteristic not in required or optional characteristic section for service Battery. Adding anyway.
|
|
54
|
-
[12/26/2025, 4:05:52 PM] [homebridge-yoto] [Accessory] ✓ GGs Boombox ready
|
|
55
|
-
[12/26/2025, 4:05:52 PM] [homebridge-yoto] Publishing new external accessory: GGs Boombox
|
|
56
|
-
[12/26/2025, 4:05:52 PM] GGs Boombox 55FC is running on port 45125.
|
|
57
|
-
[12/26/2025, 4:05:52 PM] Please add [GGs Boombox 55FC] manually in Home app. Setup Code: 547-78-744
|
|
58
|
-
[12/26/2025, 4:05:54 PM] [homebridge-yoto] Device discovered: Gigis mini (y2JVD5AxvJEeaK1g6nvBWkej)
|
|
59
|
-
[12/26/2025, 4:05:54 PM] [homebridge-yoto] Adding new accessory: Gigis mini
|
|
60
|
-
[12/26/2025, 4:05:54 PM] [homebridge-yoto] [Accessory] Setting up Gigis mini
|
|
61
|
-
[Gigis mini@Gigis mini@Status Active] Characteristic not in required or optional characteristic section for service SmartSpeaker. Adding anyway.
|
|
62
|
-
[Gigis mini@Gigis mini Battery@Status Active] Characteristic not in required or optional characteristic section for service Battery. Adding anyway.
|
|
63
|
-
[12/26/2025, 4:05:54 PM] [homebridge-yoto] [Accessory] ✓ Gigis mini ready
|
|
64
|
-
[12/26/2025, 4:05:54 PM] [homebridge-yoto] Publishing new external accessory: Gigis mini
|
|
65
|
-
[12/26/2025, 4:05:54 PM] Gigis mini 8D02 is running on port 38987.
|
|
66
|
-
[12/26/2025, 4:05:54 PM] Please add [Gigis mini 8D02] manually in Home app. Setup Code: 547-78-744
|
|
67
|
-
[12/26/2025, 4:05:55 PM] [homebridge-yoto] Device discovered: Otto's mini (y2iYT7ItkMRWbuMzTDuGjgmS)
|
|
68
|
-
[12/26/2025, 4:05:55 PM] [homebridge-yoto] Adding new accessory: Otto's mini
|
|
69
|
-
[12/26/2025, 4:05:55 PM] [homebridge-yoto] [Accessory] Setting up Otto's mini
|
|
70
|
-
[Otto's mini @Otto's mini @Status Active] Characteristic not in required or optional characteristic section for service SmartSpeaker. Adding anyway.
|
|
71
|
-
[Otto's mini @Otto's mini Battery@Status Active] Characteristic not in required or optional characteristic section for service Battery. Adding anyway.
|
|
72
|
-
[12/26/2025, 4:05:55 PM] [homebridge-yoto] [Accessory] ✓ Otto's mini ready
|
|
73
|
-
[12/26/2025, 4:05:55 PM] [homebridge-yoto] Publishing new external accessory: Otto's mini
|
|
74
|
-
[12/26/2025, 4:05:55 PM] Otto's mini 024E is running on port 33839.
|
|
75
|
-
[12/26/2025, 4:05:55 PM] Please add [Otto's mini 024E] manually in Home app. Setup Code: 547-78-744
|
|
76
|
-
[12/26/2025, 4:05:57 PM] [homebridge-yoto] Device discovered: Ottos Boombox (y2knTzvDkKVtvnhl09z9bWfe)
|
|
77
|
-
[12/26/2025, 4:05:57 PM] [homebridge-yoto] Adding new accessory: Ottos Boombox
|
|
78
|
-
[12/26/2025, 4:05:57 PM] [homebridge-yoto] [Accessory] Setting up Ottos Boombox
|
|
79
|
-
[Ottos Boombox@Ottos Boombox@Status Active] Characteristic not in required or optional characteristic section for service SmartSpeaker. Adding anyway.
|
|
80
|
-
[Ottos Boombox@Ottos Boombox Battery@Status Active] Characteristic not in required or optional characteristic section for service Battery. Adding anyway.
|
|
81
|
-
[12/26/2025, 4:05:57 PM] [homebridge-yoto] [Accessory] ✓ Ottos Boombox ready
|
|
82
|
-
[12/26/2025, 4:05:57 PM] [homebridge-yoto] Publishing new external accessory: Ottos Boombox
|
|
83
|
-
[12/26/2025, 4:05:57 PM] [homebridge-yoto] ✓ Yoto account started with 4 device(s)
|
|
84
|
-
[12/26/2025, 4:05:57 PM] Ottos Boombox 3486 is running on port 37845.
|
|
85
|
-
[12/26/2025, 4:05:57 PM] Please add [Ottos Boombox 3486] manually in Home app. Setup Code: 547-78-744
|
|
86
|
-
[12/26/2025, 4:05:59 PM] [homebridge-yoto] This plugin generated a warning from the characteristic 'Brightness': characteristic was supplied illegal value: number 255 exceeded maximum of 100. See https://homebridge.io/w/JtMGR for more info.
|
|
87
|
-
[12/26/2025, 4:05:59 PM] [homebridge-yoto] This plugin generated a warning from the characteristic 'Brightness': characteristic was supplied illegal value: number 255 exceeded maximum of 100. See https://homebridge.io/w/JtMGR for more info.
|