homebridge-powerview-universal 4.3.2

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.
@@ -0,0 +1,113 @@
1
+ import type { API, Characteristic, DynamicPlatformPlugin, Logging, PlatformAccessory, Service } from 'homebridge';
2
+ import { type HubCapabilities } from './hubCapabilities.js';
3
+ import { HubPosition, type PowerViewShade } from './powerviewHub.js';
4
+ import { type CharacteristicCallback } from './platformAccessory.js';
5
+ import { type PositionMap } from './shadeUtils.js';
6
+ import { ShadeKind, type PowerViewPlatformConfig, type SceneContext, type ShadeContext } from './settings.js';
7
+ export declare class PowerViewPlatform implements DynamicPlatformPlugin {
8
+ readonly log: Logging;
9
+ readonly api: API;
10
+ readonly Service: typeof Service;
11
+ readonly Characteristic: typeof Characteristic;
12
+ readonly accessories: Map<number, PlatformAccessory<ShadeContext>>;
13
+ private readonly handlers;
14
+ hubVersion?: string;
15
+ hubCapabilities?: HubCapabilities;
16
+ private hubName?;
17
+ private readonly hub;
18
+ private readonly batteryPoll;
19
+ private readonly quietHours;
20
+ private readonly syncPositionsOnStart;
21
+ private readonly exposeScenes;
22
+ private readonly refreshShades;
23
+ private readonly pollShadesForUpdate;
24
+ private readonly strictErrors;
25
+ private readonly forceRollerShades;
26
+ private readonly forceTopBottomShades;
27
+ private readonly forceHorizontalShades;
28
+ private readonly forceVerticalShades;
29
+ private readonly lastPositions;
30
+ /** Consecutive shade lists a known shade has been missing from. */
31
+ private readonly missingFromList;
32
+ private readonly positionsOmittedLogged;
33
+ private readonly unsupportedCapabilityLogged;
34
+ /** Shades with a background refresh already in flight, so reads don't pile up. */
35
+ private readonly pendingRefresh;
36
+ /** When each shade last had a background read, so bursts don't stack up. */
37
+ private readonly lastBackgroundRefresh;
38
+ /** Travel timers per shade/position, so a re-target cancels the old arrival. */
39
+ private readonly travelTimers;
40
+ readonly sceneAccessories: Map<number, PlatformAccessory<SceneContext>>;
41
+ private readonly batteryRefreshDisabled;
42
+ private readonly posKindErrorLogged;
43
+ private batteryPollTimer?;
44
+ private shadePollTimer?;
45
+ private shuttingDown;
46
+ constructor(log: Logging, config: PowerViewPlatformConfig, api: API);
47
+ private onLaunch;
48
+ cachePositions(shadeId: number, positions: PositionMap | null): void;
49
+ getCachedPosition(shadeId: number, position: HubPosition): number | undefined;
50
+ shadeType(shade: PowerViewShade): ShadeKind;
51
+ private warnUnsupportedCapabilityOnce;
52
+ configureAccessory(accessory: PlatformAccessory): void;
53
+ private ensureWindowCoveringCategory;
54
+ private registerHandler;
55
+ private addShadeAccessory;
56
+ private updateShadeAccessory;
57
+ private removeShadeAccessory;
58
+ updateShades(): Promise<void>;
59
+ private pollShades;
60
+ /**
61
+ * Re-reads positions once at startup for shades the hub has no position for.
62
+ *
63
+ * The hub only holds a position for a while after a set or refresh, and a
64
+ * shade moved by remote is never reported at all — so without this, a
65
+ * restored cache would be served to HomeKit indefinitely with nothing ever
66
+ * correcting it. Startup is the one moment where an RF wake per shade buys
67
+ * accuracy without recurring cost; quiet hours guard the unattended restart.
68
+ */
69
+ private syncPositionsAtStartup;
70
+ stopShade(shadeId: number): Promise<void>;
71
+ private scheduleBatteryPoll;
72
+ private pollBatteryLevels;
73
+ updateHubInfo(): Promise<void>;
74
+ private updateShade;
75
+ getPosition(shadeId: number, position: HubPosition, callback: CharacteristicCallback): Promise<void>;
76
+ /**
77
+ * Refreshes a shade off the HomeKit read path, deduped per shade and rate
78
+ * limited per shade.
79
+ *
80
+ * `refresh` is the expensive kind: it wakes the motor over RF, takes seconds,
81
+ * and is what used to move shades at 05:54. It is only justified when the hub
82
+ * has no position at all. Servicing an ordinary read uses the cheap cached
83
+ * read, which never touches the radio.
84
+ */
85
+ private scheduleBackgroundRefresh;
86
+ private resolvePositionValue;
87
+ private updatePosition;
88
+ setPosition(shadeId: number, position: HubPosition, value: number, callback: (error: Error | null) => void): Promise<void>;
89
+ /**
90
+ * Publishes one stateless switch per hub scene.
91
+ *
92
+ * A scene is the only way to move a group together: it is a single call the
93
+ * hub expands itself, so every motor gets its RF command at once. Driving the
94
+ * same shades individually costs one serialised write each and they visibly
95
+ * stagger.
96
+ */
97
+ updateScenes(): Promise<void>;
98
+ private addSceneAccessory;
99
+ private wireSceneSwitch;
100
+ /**
101
+ * Marks the shade arrived once its estimated travel has elapsed.
102
+ *
103
+ * Estimated rather than polled: this hub reports no positions on a cached
104
+ * read, so confirming arrival would mean an RF round-trip that wakes the motor
105
+ * again the moment it stopped. The startup sync and any later refresh correct
106
+ * the value if the shade did not make it.
107
+ */
108
+ private scheduleArrival;
109
+ jogShade(shadeId: number): Promise<Partial<Record<HubPosition, number>> | null>;
110
+ jogShadeOnIdentify(shadeId: number): Promise<void>;
111
+ private notePositionsOmittedOnce;
112
+ warnPositionKindErrorOnce(shadeId: number): void;
113
+ }