@homebridge-plugins/homebridge-eufy-security 0.0.1

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.
Files changed (185) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/FUNDING.yml +1 -0
  3. package/LICENSE +176 -0
  4. package/README.md +67 -0
  5. package/config.schema.json +6 -0
  6. package/dist/accessories/AutoSyncStationAccessory.js +156 -0
  7. package/dist/accessories/AutoSyncStationAccessory.js.map +1 -0
  8. package/dist/accessories/BaseAccessory.js +247 -0
  9. package/dist/accessories/BaseAccessory.js.map +1 -0
  10. package/dist/accessories/CameraAccessory.js +431 -0
  11. package/dist/accessories/CameraAccessory.js.map +1 -0
  12. package/dist/accessories/Device.js +67 -0
  13. package/dist/accessories/Device.js.map +1 -0
  14. package/dist/accessories/EntrySensorAccessory.js +48 -0
  15. package/dist/accessories/EntrySensorAccessory.js.map +1 -0
  16. package/dist/accessories/LockAccessory.js +142 -0
  17. package/dist/accessories/LockAccessory.js.map +1 -0
  18. package/dist/accessories/MotionSensorAccessory.js +48 -0
  19. package/dist/accessories/MotionSensorAccessory.js.map +1 -0
  20. package/dist/accessories/SmartDropAccessory.js +145 -0
  21. package/dist/accessories/SmartDropAccessory.js.map +1 -0
  22. package/dist/accessories/StationAccessory.js +371 -0
  23. package/dist/accessories/StationAccessory.js.map +1 -0
  24. package/dist/config.js +25 -0
  25. package/dist/config.js.map +1 -0
  26. package/dist/controller/LocalLivestreamManager.js +116 -0
  27. package/dist/controller/LocalLivestreamManager.js.map +1 -0
  28. package/dist/controller/recordingDelegate.js +208 -0
  29. package/dist/controller/recordingDelegate.js.map +1 -0
  30. package/dist/controller/snapshotDelegate.js +345 -0
  31. package/dist/controller/snapshotDelegate.js.map +1 -0
  32. package/dist/controller/streamingDelegate.js +345 -0
  33. package/dist/controller/streamingDelegate.js.map +1 -0
  34. package/dist/index.js +11 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/interfaces.js +2 -0
  37. package/dist/interfaces.js.map +1 -0
  38. package/dist/media/Snapshot-Unavailable.png +0 -0
  39. package/dist/media/Snapshot-Unavailable.xcf +0 -0
  40. package/dist/media/Snapshot-black.png +0 -0
  41. package/dist/media/camera-disabled.png +0 -0
  42. package/dist/media/camera-offline.png +0 -0
  43. package/dist/media/media/Snapshot-Unavailable.png +0 -0
  44. package/dist/media/media/Snapshot-Unavailable.xcf +0 -0
  45. package/dist/media/media/Snapshot-black.png +0 -0
  46. package/dist/media/media/camera-disabled.png +0 -0
  47. package/dist/media/media/camera-offline.png +0 -0
  48. package/dist/platform.js +716 -0
  49. package/dist/platform.js.map +1 -0
  50. package/dist/settings.js +38 -0
  51. package/dist/settings.js.map +1 -0
  52. package/dist/utils/Talkback.js +92 -0
  53. package/dist/utils/Talkback.js.map +1 -0
  54. package/dist/utils/accessoriesStore.js +206 -0
  55. package/dist/utils/accessoriesStore.js.map +1 -0
  56. package/dist/utils/configTypes.js +35 -0
  57. package/dist/utils/configTypes.js.map +1 -0
  58. package/dist/utils/ffmpeg.js +843 -0
  59. package/dist/utils/ffmpeg.js.map +1 -0
  60. package/dist/utils/interfaces.js +8 -0
  61. package/dist/utils/interfaces.js.map +1 -0
  62. package/dist/utils/utils.js +44 -0
  63. package/dist/utils/utils.js.map +1 -0
  64. package/dist/version.js +2 -0
  65. package/dist/version.js.map +1 -0
  66. package/eslint.config.mjs +18 -0
  67. package/homebridge-eufy-security.png +0 -0
  68. package/homebridge-ui/public/app.js +225 -0
  69. package/homebridge-ui/public/assets/devices/4g_lte_starlight_large.jpg +0 -0
  70. package/homebridge-ui/public/assets/devices/BATTERY_DOORBELL_C30.png +0 -0
  71. package/homebridge-ui/public/assets/devices/BATTERY_DOORBELL_C31.png +0 -0
  72. package/homebridge-ui/public/assets/devices/batterydoorbell1080p_large.jpg +0 -0
  73. package/homebridge-ui/public/assets/devices/batterydoorbell2kdual_large.jpg +0 -0
  74. package/homebridge-ui/public/assets/devices/batterydoorbell_e340_large.png +0 -0
  75. package/homebridge-ui/public/assets/devices/eufy-security-client.png +0 -0
  76. package/homebridge-ui/public/assets/devices/eufycam2_large.png +0 -0
  77. package/homebridge-ui/public/assets/devices/eufycam2c_large.jpg +0 -0
  78. package/homebridge-ui/public/assets/devices/eufycam2cpro_large.jpg +0 -0
  79. package/homebridge-ui/public/assets/devices/eufycam2pro_large.jpg +0 -0
  80. package/homebridge-ui/public/assets/devices/eufycam3_large.jpg +0 -0
  81. package/homebridge-ui/public/assets/devices/eufycam3c_large.jpg +0 -0
  82. package/homebridge-ui/public/assets/devices/eufycam3pro_large.png +0 -0
  83. package/homebridge-ui/public/assets/devices/eufycam_large.jpg +0 -0
  84. package/homebridge-ui/public/assets/devices/eufycame330_large.jpg +0 -0
  85. package/homebridge-ui/public/assets/devices/floodlight2_large.jpg +0 -0
  86. package/homebridge-ui/public/assets/devices/floodlight2pro_large.jpg +0 -0
  87. package/homebridge-ui/public/assets/devices/floodlight_large.jpg +0 -0
  88. package/homebridge-ui/public/assets/devices/floodlightcame340_large.jpg +0 -0
  89. package/homebridge-ui/public/assets/devices/garage_camera_t8452_large.jpg +0 -0
  90. package/homebridge-ui/public/assets/devices/homebase2_large.png +0 -0
  91. package/homebridge-ui/public/assets/devices/homebase3_large.png +0 -0
  92. package/homebridge-ui/public/assets/devices/homebase_large.jpg +0 -0
  93. package/homebridge-ui/public/assets/devices/homebasemini_large.jpg +0 -0
  94. package/homebridge-ui/public/assets/devices/indoorcamC210_large.png +0 -0
  95. package/homebridge-ui/public/assets/devices/indoorcamC220_large.png +0 -0
  96. package/homebridge-ui/public/assets/devices/indoorcamE30_large.png +0 -0
  97. package/homebridge-ui/public/assets/devices/indoorcamc120_large.png +0 -0
  98. package/homebridge-ui/public/assets/devices/indoorcammini_large.jpg +0 -0
  99. package/homebridge-ui/public/assets/devices/indoorcamp24_large.png +0 -0
  100. package/homebridge-ui/public/assets/devices/indoorcams350_large.jpg +0 -0
  101. package/homebridge-ui/public/assets/devices/keypad_large.png +0 -0
  102. package/homebridge-ui/public/assets/devices/minibase_chime_T8023_large.jpg +0 -0
  103. package/homebridge-ui/public/assets/devices/motionsensor_large.png +0 -0
  104. package/homebridge-ui/public/assets/devices/sensor_large.png +0 -0
  105. package/homebridge-ui/public/assets/devices/smartdrop_t8790_large.png +0 -0
  106. package/homebridge-ui/public/assets/devices/smartlock_t8500_large.png +0 -0
  107. package/homebridge-ui/public/assets/devices/smartlock_t8500_wifibridge_large.jpg +0 -0
  108. package/homebridge-ui/public/assets/devices/smartlock_t8503_large.png +0 -0
  109. package/homebridge-ui/public/assets/devices/smartlock_t8504_large.jpg +0 -0
  110. package/homebridge-ui/public/assets/devices/smartlock_t8510P_t8520P_large.png +0 -0
  111. package/homebridge-ui/public/assets/devices/smartlock_touch_and_wifi_t8502_large.png +0 -0
  112. package/homebridge-ui/public/assets/devices/smartlock_touch_and_wifi_t8506_large.png +0 -0
  113. package/homebridge-ui/public/assets/devices/smartlock_touch_and_wifi_t8520_large.png +0 -0
  114. package/homebridge-ui/public/assets/devices/smartlock_touch_t8510_large.png +0 -0
  115. package/homebridge-ui/public/assets/devices/smartlock_touch_t8510_wifibridge_large.jpg +0 -0
  116. package/homebridge-ui/public/assets/devices/smartlock_video_t8530_large.png +0 -0
  117. package/homebridge-ui/public/assets/devices/smartlockwifibridge_t8021_large.jpg +0 -0
  118. package/homebridge-ui/public/assets/devices/smartsafe_s10_t7400_large.png +0 -0
  119. package/homebridge-ui/public/assets/devices/smartsafe_s12_t7401_large.png +0 -0
  120. package/homebridge-ui/public/assets/devices/smarttrack_card_t87B2_large.png +0 -0
  121. package/homebridge-ui/public/assets/devices/smarttrack_link_t87B0_large.png +0 -0
  122. package/homebridge-ui/public/assets/devices/solocamc210_large.jpg +0 -0
  123. package/homebridge-ui/public/assets/devices/solocamc35_large.png +0 -0
  124. package/homebridge-ui/public/assets/devices/solocame20_large.jpg +0 -0
  125. package/homebridge-ui/public/assets/devices/solocame30_large.png +0 -0
  126. package/homebridge-ui/public/assets/devices/solocame40_large.jpg +0 -0
  127. package/homebridge-ui/public/assets/devices/solocaml20_large.jpg +0 -0
  128. package/homebridge-ui/public/assets/devices/solocams220_large.jpg +0 -0
  129. package/homebridge-ui/public/assets/devices/solocams340_large.png +0 -0
  130. package/homebridge-ui/public/assets/devices/solocams40_large.jpg +0 -0
  131. package/homebridge-ui/public/assets/devices/soloindoorcamc24_large.jpg +0 -0
  132. package/homebridge-ui/public/assets/devices/solooutdoorcamc22_large.png +0 -0
  133. package/homebridge-ui/public/assets/devices/solooutdoorcamc24_large.jpg +0 -0
  134. package/homebridge-ui/public/assets/devices/unknown.png +0 -0
  135. package/homebridge-ui/public/assets/devices/walllight_s100_large.jpg +0 -0
  136. package/homebridge-ui/public/assets/devices/walllight_s120_large.jpg +0 -0
  137. package/homebridge-ui/public/assets/devices/wireddoorbell1080p_large.jpg +0 -0
  138. package/homebridge-ui/public/assets/devices/wireddoorbell2k_large.png +0 -0
  139. package/homebridge-ui/public/assets/devices/wireddoorbelldual_large.jpg +0 -0
  140. package/homebridge-ui/public/assets/icons/attach.svg +1 -0
  141. package/homebridge-ui/public/assets/icons/battery_0.svg +1 -0
  142. package/homebridge-ui/public/assets/icons/battery_1.svg +1 -0
  143. package/homebridge-ui/public/assets/icons/battery_2.svg +1 -0
  144. package/homebridge-ui/public/assets/icons/battery_3.svg +1 -0
  145. package/homebridge-ui/public/assets/icons/battery_4.svg +1 -0
  146. package/homebridge-ui/public/assets/icons/battery_5.svg +1 -0
  147. package/homebridge-ui/public/assets/icons/battery_6.svg +1 -0
  148. package/homebridge-ui/public/assets/icons/bolt.svg +1 -0
  149. package/homebridge-ui/public/assets/icons/bug-report.svg +1 -0
  150. package/homebridge-ui/public/assets/icons/copy.svg +1 -0
  151. package/homebridge-ui/public/assets/icons/delete.svg +1 -0
  152. package/homebridge-ui/public/assets/icons/download.svg +1 -0
  153. package/homebridge-ui/public/assets/icons/info.svg +1 -0
  154. package/homebridge-ui/public/assets/icons/inventory.svg +1 -0
  155. package/homebridge-ui/public/assets/icons/refresh.svg +1 -0
  156. package/homebridge-ui/public/assets/icons/satellite_alt.svg +1 -0
  157. package/homebridge-ui/public/assets/icons/settings.svg +1 -0
  158. package/homebridge-ui/public/assets/icons/settings_backup_restore.svg +1 -0
  159. package/homebridge-ui/public/assets/icons/solar_power.svg +1 -0
  160. package/homebridge-ui/public/assets/icons/warning.svg +1 -0
  161. package/homebridge-ui/public/components/device-card.js +162 -0
  162. package/homebridge-ui/public/components/guard-modes.js +88 -0
  163. package/homebridge-ui/public/components/number-input.js +121 -0
  164. package/homebridge-ui/public/components/select.js +73 -0
  165. package/homebridge-ui/public/components/toggle.js +68 -0
  166. package/homebridge-ui/public/index.html +27 -0
  167. package/homebridge-ui/public/services/api.js +214 -0
  168. package/homebridge-ui/public/services/config.js +144 -0
  169. package/homebridge-ui/public/style.css +775 -0
  170. package/homebridge-ui/public/utils/countries.js +73 -0
  171. package/homebridge-ui/public/utils/device-images.js +89 -0
  172. package/homebridge-ui/public/utils/helpers.js +87 -0
  173. package/homebridge-ui/public/views/dashboard.js +226 -0
  174. package/homebridge-ui/public/views/device-detail.js +610 -0
  175. package/homebridge-ui/public/views/diagnostics.js +296 -0
  176. package/homebridge-ui/public/views/login.js +636 -0
  177. package/homebridge-ui/public/views/settings.js +192 -0
  178. package/homebridge-ui/public/views/unsupported-detail.js +296 -0
  179. package/homebridge-ui/server.js +1327 -0
  180. package/media/Snapshot-Unavailable.png +0 -0
  181. package/media/Snapshot-Unavailable.xcf +0 -0
  182. package/media/Snapshot-black.png +0 -0
  183. package/media/camera-disabled.png +0 -0
  184. package/media/camera-offline.png +0 -0
  185. package/package.json +64 -0
@@ -0,0 +1,431 @@
1
+ import { DeviceAccessory } from './Device.js';
2
+ // @ts-ignore
3
+ import { PropertyName, CommandName } from 'eufy-security-client';
4
+ import { DEFAULT_CAMERACONFIG_VALUES } from '../utils/configTypes.js';
5
+ import { CHAR, SERV } from '../utils/utils.js';
6
+ import { StreamingDelegate } from '../controller/streamingDelegate.js';
7
+ import { RecordingDelegate } from '../controller/recordingDelegate.js';
8
+ /**
9
+ * Platform Accessory
10
+ * An instance of this class is created for each accessory your platform registers
11
+ * Each accessory may expose multiple services of different service types.
12
+ */
13
+ export class CameraAccessory extends DeviceAccessory {
14
+ // Define the object variable to hold the boolean and timestamp
15
+ cameraStatus;
16
+ notificationTimeout = null;
17
+ cameraConfig;
18
+ hardwareTranscoding = true;
19
+ hardwareDecoding = true;
20
+ timeshift = false;
21
+ hksvRecording = true;
22
+ HksvErrors = 0;
23
+ isOnline = true;
24
+ rtsp_url = '';
25
+ metadata;
26
+ standalone = false;
27
+ // List of event types
28
+ eventTypesToHandle = [
29
+ 'motion detected',
30
+ 'person detected',
31
+ 'pet detected',
32
+ 'vehicle detected',
33
+ 'sound detected',
34
+ 'crying detected',
35
+ 'dog detected',
36
+ 'stranger person detected',
37
+ ];
38
+ streamingDelegate = null;
39
+ recordingDelegate = null;
40
+ resolutions = [
41
+ [320, 180, 30],
42
+ [320, 240, 15], // Apple Watch requires this configuration
43
+ [320, 240, 30],
44
+ [480, 270, 30],
45
+ [480, 360, 30],
46
+ [640, 360, 30],
47
+ [640, 480, 30],
48
+ [1280, 720, 30],
49
+ [1280, 960, 30],
50
+ [1920, 1080, 30],
51
+ [1600, 1200, 30],
52
+ ];
53
+ constructor(platform, accessory, device) {
54
+ super(platform, accessory, device);
55
+ this.cameraConfig = {};
56
+ this.cameraStatus = { isEnabled: false, timestamp: 0 }; // Initialize the cameraStatus object
57
+ this.log.debug(`Constructed Camera`);
58
+ this.cameraConfig = this.getCameraConfig();
59
+ this.standalone = device.getSerial() === device.getStationSerial();
60
+ this.log.debug(`Is standalone?`, this.standalone);
61
+ if (this.cameraConfig.enableCamera) {
62
+ this.log.debug(`has a camera: Setting up camera.`);
63
+ this.setupCamera();
64
+ }
65
+ else {
66
+ this.log.debug(`has a motion sensor: Setting up motion.`);
67
+ this.setupMotionFunction();
68
+ }
69
+ this.initSensorService();
70
+ this.setupEnableButton();
71
+ this.setupMotionButton();
72
+ this.setupLightButton();
73
+ this.setupChimeButton();
74
+ this.pruneUnusedServices();
75
+ }
76
+ setupCamera() {
77
+ try {
78
+ this.cameraFunction();
79
+ }
80
+ catch (error) {
81
+ this.log.error(`while happending CameraFunction ${error}`);
82
+ }
83
+ try {
84
+ this.configureVideoStream();
85
+ }
86
+ catch (error) {
87
+ this.log.error(`while happending Delegate ${error}`);
88
+ }
89
+ }
90
+ setupButtonService(serviceName, configValue, PropertyName, serviceType) {
91
+ try {
92
+ this.log.debug(`${serviceName} config:`, configValue);
93
+ if (configValue && this.device.hasProperty(PropertyName)) {
94
+ this.log.debug(`has a ${PropertyName}, so append ${serviceType}${serviceName} characteristic to it.`);
95
+ this.setupSwitchService(serviceName, serviceType, PropertyName);
96
+ }
97
+ else {
98
+ this.log.debug(`Looks like not compatible with ${PropertyName} or this has been disabled within configuration`);
99
+ }
100
+ }
101
+ catch (error) {
102
+ this.log.error(`raise error to check and attach ${serviceType}${serviceName}.`, error);
103
+ throw error;
104
+ }
105
+ }
106
+ setupSwitchService(serviceName, serviceType, propertyName) {
107
+ const platformServiceMapping = {
108
+ switch: SERV.Switch,
109
+ lightbulb: SERV.Lightbulb,
110
+ outlet: SERV.Outlet,
111
+ };
112
+ this.registerCharacteristic({
113
+ serviceType: platformServiceMapping[serviceType] || SERV.Switch,
114
+ characteristicType: CHAR.On,
115
+ name: this.accessory.displayName + ' ' + serviceName,
116
+ serviceSubType: serviceName,
117
+ getValue: (data, characteristic) => this.getCameraPropertyValue(characteristic, propertyName),
118
+ setValue: (value, characteristic) => this.setCameraPropertyValue(characteristic, propertyName, value),
119
+ });
120
+ }
121
+ async setupEnableButton() {
122
+ this.setupButtonService('Enabled', this.cameraConfig.enableButton, PropertyName.DeviceEnabled, 'switch');
123
+ }
124
+ async setupMotionButton() {
125
+ this.setupButtonService('Motion', this.cameraConfig.motionButton, PropertyName.DeviceMotionDetection, 'switch');
126
+ }
127
+ async setupLightButton() {
128
+ this.setupButtonService('Light', this.cameraConfig.lightButton, PropertyName.DeviceLight, 'lightbulb');
129
+ }
130
+ async setupChimeButton() {
131
+ this.setupButtonService('IndoorChime', this.cameraConfig.indoorChimeButton, PropertyName.DeviceChimeIndoor, 'switch');
132
+ }
133
+ /**
134
+ * Get the configuration for a camera device.
135
+ *
136
+ * - Combines default settings with those from the platform config.
137
+ * - Validates certain settings like talkback capability.
138
+ *
139
+ * @returns {CameraConfig} The finalized camera configuration.
140
+ */
141
+ getCameraConfig() {
142
+ // Find the specific camera config from the platform based on its serial number
143
+ const foundConfig = this.platform.config.cameras?.find(e => e.serialNumber === this.device.getSerial()) ?? {};
144
+ // Combine default and specific configurations
145
+ const config = {
146
+ ...DEFAULT_CAMERACONFIG_VALUES,
147
+ ...foundConfig,
148
+ name: this.accessory.displayName,
149
+ };
150
+ // Initialize videoConfig if it's undefined
151
+ if (!config.videoConfig) {
152
+ config.videoConfig = {};
153
+ }
154
+ config.videoConfig.debug = config.videoConfig?.debug ?? true;
155
+ // Validate talkback setting
156
+ if (config.talkback && !this.device.hasCommand(CommandName.DeviceStartTalkback)) {
157
+ this.log.warn('Talkback for this device is not supported!');
158
+ config.talkback = false;
159
+ }
160
+ // Validate talkback with rtsp setting
161
+ if (config.talkback && config.rtsp) {
162
+ this.log.warn('Talkback cannot be used with rtsp option. Ignoring talkback setting.');
163
+ config.talkback = false;
164
+ }
165
+ this.log.debug(`config is`, config);
166
+ return config;
167
+ }
168
+ cameraFunction() {
169
+ // Fire snapshot when motion detected
170
+ this.registerCharacteristic({
171
+ serviceType: SERV.MotionSensor,
172
+ characteristicType: CHAR.MotionDetected,
173
+ getValue: () => this.device.getPropertyValue(PropertyName.DeviceMotionDetected),
174
+ onValue: (service, characteristic) => {
175
+ this.eventTypesToHandle.forEach(eventType => {
176
+ this.device.on(eventType, (device, state) => {
177
+ this.log.info(`MOTION DETECTED (${eventType})': ${state}`);
178
+ characteristic.updateValue(state);
179
+ });
180
+ });
181
+ },
182
+ });
183
+ // if (this.device.hasProperty('speaker')) {
184
+ // this.registerCharacteristic({
185
+ // serviceType: SERV.Speaker,
186
+ // characteristicType: CHAR.Mute,
187
+ // serviceSubType: 'speaker_mute',
188
+ // getValue: (data, characteristic) =>
189
+ // this.getCameraPropertyValue(characteristic, PropertyName.DeviceSpeaker),
190
+ // setValue: (value, characteristic) =>
191
+ // this.setCameraPropertyValue(characteristic, PropertyName.DeviceSpeaker, value),
192
+ // });
193
+ // }
194
+ // if (this.device.hasProperty('speakerVolume')) {
195
+ // this.registerCharacteristic({
196
+ // serviceType: SERV.Speaker,
197
+ // characteristicType: CHAR.Volume,
198
+ // serviceSubType: 'speaker_volume',
199
+ // getValue: (data, characteristic) =>
200
+ // this.getCameraPropertyValue(characteristic, PropertyName.DeviceSpeakerVolume),
201
+ // setValue: (value, characteristic) =>
202
+ // this.setCameraPropertyValue(characteristic, PropertyName.DeviceSpeakerVolume, value),
203
+ // });
204
+ // }
205
+ // if (this.device.hasProperty('microphone')) {
206
+ // this.registerCharacteristic({
207
+ // serviceType: SERV.Microphone,
208
+ // characteristicType: CHAR.Mute,
209
+ // serviceSubType: 'mic_mute',
210
+ // getValue: (data, characteristic) =>
211
+ // this.getCameraPropertyValue(characteristic, PropertyName.DeviceMicrophone),
212
+ // setValue: (value, characteristic) =>
213
+ // this.setCameraPropertyValue(characteristic, PropertyName.DeviceMicrophone, value),
214
+ // });
215
+ // }
216
+ if (this.device.isDoorbell()) {
217
+ this.registerCharacteristic({
218
+ serviceType: SERV.Doorbell,
219
+ characteristicType: CHAR.ProgrammableSwitchEvent,
220
+ onValue: (service, characteristic) => {
221
+ this.device.on('rings', () => this.onDeviceRingsPushNotification(characteristic));
222
+ },
223
+ });
224
+ }
225
+ }
226
+ // This private function sets up the motion sensor characteristics for the accessory.
227
+ setupMotionFunction() {
228
+ // Register the motion sensor characteristic for detecting motion.
229
+ this.registerCharacteristic({
230
+ serviceType: SERV.MotionSensor,
231
+ characteristicType: CHAR.MotionDetected,
232
+ getValue: () => this.device.getPropertyValue(PropertyName.DeviceMotionDetected),
233
+ onMultipleValue: this.eventTypesToHandle,
234
+ });
235
+ // If the camera is disabled, flag the motion sensor as tampered.
236
+ // This is done because the motion sensor won't work until the camera is enabled again.
237
+ this.registerCharacteristic({
238
+ serviceType: SERV.MotionSensor,
239
+ characteristicType: CHAR.StatusTampered,
240
+ getValue: () => {
241
+ const tampered = this.device.getPropertyValue(PropertyName.DeviceEnabled);
242
+ this.log.debug(`TAMPERED? ${!tampered}`);
243
+ return tampered
244
+ ? CHAR.StatusTampered.NOT_TAMPERED
245
+ : CHAR.StatusTampered.TAMPERED;
246
+ },
247
+ });
248
+ if (this.device.isDoorbell()) {
249
+ this.registerCharacteristic({
250
+ serviceType: SERV.Doorbell,
251
+ characteristicType: CHAR.ProgrammableSwitchEvent,
252
+ onValue: (service, characteristic) => {
253
+ this.device.on('rings', () => this.onDeviceRingsPushNotification(characteristic));
254
+ },
255
+ });
256
+ }
257
+ }
258
+ getCameraPropertyValue(characteristic, propertyName) {
259
+ try {
260
+ const value = this.device.getPropertyValue(propertyName);
261
+ return this.applyPropertyValue(characteristic, propertyName, value);
262
+ }
263
+ catch (error) {
264
+ this.log.debug(`Error getting '${characteristic.displayName}' ${propertyName}: ${error}`);
265
+ return false;
266
+ }
267
+ }
268
+ applyPropertyValue(characteristic, propertyName, value) {
269
+ this.log.debug(`GET '${characteristic.displayName}' ${propertyName}: ${value}`);
270
+ if (propertyName === PropertyName.DeviceNightvision) {
271
+ return value === 1;
272
+ }
273
+ // Override for PropertyName.DeviceEnabled when enabled button is fired and
274
+ if (propertyName === PropertyName.DeviceEnabled &&
275
+ Date.now() - this.cameraStatus.timestamp <= 60000) {
276
+ this.log.debug(`CACHED for (1 min) '${characteristic.displayName}' ${propertyName}: ${this.cameraStatus.isEnabled}`);
277
+ value = this.cameraStatus.isEnabled;
278
+ }
279
+ if (characteristic.displayName === 'Manually Disabled') {
280
+ value = !value;
281
+ this.log.debug(`INVERSED '${characteristic.displayName}' ${propertyName}: ${value}`);
282
+ }
283
+ if (value === undefined) {
284
+ throw new Error(`Value is undefined: this shouldn't happend`);
285
+ }
286
+ return value;
287
+ }
288
+ async setCameraPropertyValue(characteristic, propertyName, value) {
289
+ try {
290
+ this.log.debug(`SET '${characteristic.displayName}' ${propertyName}: ${value}`);
291
+ await this.setPropertyValue(propertyName, value);
292
+ if (propertyName === PropertyName.DeviceEnabled &&
293
+ characteristic.displayName === 'On') {
294
+ characteristic.updateValue(value);
295
+ this.cameraStatus = { isEnabled: value, timestamp: Date.now() };
296
+ characteristic = this.getService(SERV.CameraOperatingMode)
297
+ .getCharacteristic(CHAR.ManuallyDisabled);
298
+ this.log.debug(`INVERSED '${characteristic.displayName}' ${propertyName}: ${!value}`);
299
+ value = !value;
300
+ }
301
+ characteristic.updateValue(value);
302
+ }
303
+ catch (error) {
304
+ this.log.debug(`Error setting '${characteristic.displayName}' ${propertyName}: ${error}`);
305
+ }
306
+ }
307
+ /**
308
+ * Handle push notifications for a doorbell device.
309
+ * Mute subsequent notifications within a timeout period.
310
+ * @param characteristic - The Characteristic to update for HomeKit.
311
+ */
312
+ onDeviceRingsPushNotification(characteristic) {
313
+ if (!this.notificationTimeout) {
314
+ this.log.debug(`DoorBell ringing`);
315
+ characteristic.updateValue(CHAR.ProgrammableSwitchEvent.SINGLE_PRESS);
316
+ // Set a new timeout for muting subsequent notifications
317
+ this.notificationTimeout = setTimeout(() => {
318
+ this.notificationTimeout = null;
319
+ }, 15 * 1000);
320
+ }
321
+ }
322
+ // Get the current bitrate for a specific camera channel.
323
+ getBitrate() {
324
+ return -1;
325
+ }
326
+ // Set the bitrate for a specific camera channel.
327
+ async setBitrate() {
328
+ return true;
329
+ }
330
+ // Configure a camera accessory for HomeKit.
331
+ configureVideoStream() {
332
+ this.log.debug(`configureVideoStream`);
333
+ try {
334
+ this.log.debug(`StreamingDelegate`);
335
+ this.streamingDelegate = new StreamingDelegate(this);
336
+ this.log.debug(`RecordingDelegate`);
337
+ this.recordingDelegate = new RecordingDelegate(this.platform, this.accessory, this.device, this.cameraConfig, this.streamingDelegate.getLivestreamManager(), this.streamingDelegate.getSnapshotDelegate());
338
+ this.log.debug(`Controller`);
339
+ const controller = new this.platform.api.hap.CameraController(this.getCameraControllerOptions());
340
+ this.log.debug(`streamingDelegate.setController`);
341
+ this.streamingDelegate.setController(controller);
342
+ this.log.debug(`recordingDelegate.setController`);
343
+ this.recordingDelegate.setController(controller);
344
+ this.log.debug(`configureController`);
345
+ // Remove stale controller-managed services from cache before configuring.
346
+ // When HSV is enabled, CameraController creates CameraOperatingMode and
347
+ // DataStreamTransportManagement services automatically. If the cached
348
+ // accessory already has them (e.g. from a previous run), configureController
349
+ // will throw a duplicate UUID error.
350
+ const controllerManagedServiceUUIDs = [
351
+ SERV.CameraOperatingMode.UUID,
352
+ SERV.DataStreamTransportManagement.UUID,
353
+ ];
354
+ for (const uuid of controllerManagedServiceUUIDs) {
355
+ const existingService = this.accessory.services.find(s => s.UUID === uuid);
356
+ if (existingService) {
357
+ this.log.debug(`Removing stale cached service ${uuid} before configureController`);
358
+ this.accessory.removeService(existingService);
359
+ }
360
+ }
361
+ this.accessory.configureController(controller);
362
+ }
363
+ catch (error) {
364
+ this.log.error(`while happending Delegate ${error}`);
365
+ }
366
+ return true;
367
+ }
368
+ getCameraControllerOptions() {
369
+ const option = {
370
+ cameraStreamCount: this.cameraConfig.videoConfig?.maxStreams || 2, // HomeKit requires at least 2 streams, but 1 is also just fine
371
+ delegate: this.streamingDelegate,
372
+ streamingOptions: {
373
+ supportedCryptoSuites: [0 /* SRTPCryptoSuites.AES_CM_128_HMAC_SHA1_80 */],
374
+ video: {
375
+ resolutions: this.resolutions,
376
+ codec: {
377
+ profiles: [0 /* H264Profile.BASELINE */, 1 /* H264Profile.MAIN */, 2 /* H264Profile.HIGH */],
378
+ levels: [0 /* H264Level.LEVEL3_1 */, 1 /* H264Level.LEVEL3_2 */, 2 /* H264Level.LEVEL4_0 */],
379
+ },
380
+ },
381
+ audio: {
382
+ twoWayAudio: this.cameraConfig.talkback,
383
+ codecs: [
384
+ {
385
+ type: "AAC-eld" /* AudioStreamingCodecType.AAC_ELD */,
386
+ samplerate: 16 /* AudioStreamingSamplerate.KHZ_16 */,
387
+ },
388
+ ],
389
+ },
390
+ },
391
+ recording: {
392
+ options: {
393
+ overrideEventTriggerOptions: [
394
+ 1 /* EventTriggerOption.MOTION */,
395
+ 2 /* EventTriggerOption.DOORBELL */,
396
+ ],
397
+ prebufferLength: 0, // prebufferLength always remains 4s ?
398
+ mediaContainerConfiguration: [
399
+ {
400
+ type: 0 /* MediaContainerType.FRAGMENTED_MP4 */,
401
+ fragmentLength: 4000,
402
+ },
403
+ ],
404
+ video: {
405
+ type: 0 /* this.platform.api.hap.VideoCodecType.H264 */,
406
+ parameters: {
407
+ profiles: [0 /* H264Profile.BASELINE */, 1 /* H264Profile.MAIN */, 2 /* H264Profile.HIGH */],
408
+ levels: [0 /* H264Level.LEVEL3_1 */, 1 /* H264Level.LEVEL3_2 */, 2 /* H264Level.LEVEL4_0 */],
409
+ },
410
+ resolutions: this.resolutions,
411
+ },
412
+ audio: {
413
+ codecs: {
414
+ type: 1 /* AudioRecordingCodecType.AAC_ELD */,
415
+ samplerate: 2 /* AudioRecordingSamplerate.KHZ_24 */,
416
+ bitrateMode: 0,
417
+ audioChannels: 1,
418
+ },
419
+ },
420
+ },
421
+ delegate: this.recordingDelegate,
422
+ },
423
+ sensors: {
424
+ motion: this.getService(SERV.MotionSensor),
425
+ occupancy: undefined,
426
+ },
427
+ };
428
+ return option;
429
+ }
430
+ }
431
+ //# sourceMappingURL=CameraAccessory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CameraAccessory.js","sourceRoot":"","sources":["../../src/accessories/CameraAccessory.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C,eAAe;AACf,OAAO,EAAwB,YAAY,EAAE,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U,yCAAiC;4BAC3C,WAAW,EAAE,CAAC;4BACd,aAAa,EAAE,CAAC;yBACjB;qBACF;iBACF;gBACD,QAAQ,EAAE,IAAI,CAAC,iBAAsC;aACtD;YACD,OAAO,EAAE;gBACP,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC;gBAC1C,SAAS,EAAE,SAAS;aACrB;SACF,CAAC;QAEF,OAAO,MAAM,CAAC;IAChB,CAAC;CAEF"}
@@ -0,0 +1,67 @@
1
+ import { BaseAccessory } from './BaseAccessory.js';
2
+ import { PropertyName } from 'eufy-security-client';
3
+ import { CHAR, SERV } from '../utils/utils.js';
4
+ export class DeviceAccessory extends BaseAccessory {
5
+ constructor(platform, accessory, device) {
6
+ super(platform, accessory, device);
7
+ }
8
+ /**
9
+ * Get the current value of the "propertyName" characteristic
10
+ */
11
+ getPropertyValue(characteristic, propertyName) {
12
+ try {
13
+ const value = this.device.getPropertyValue(propertyName);
14
+ this.log.debug(`GET '${characteristic}' ${propertyName}: ${value}`);
15
+ return value;
16
+ }
17
+ catch (error) {
18
+ this.log.debug(`Error getting '${characteristic}' ${propertyName}: ${error}`);
19
+ return false;
20
+ }
21
+ }
22
+ async setPropertyValue(propertyName, value) {
23
+ await this.platform.eufyClient.setDeviceProperty(this.SN, propertyName, value);
24
+ }
25
+ onPushNotification(characteristicType, serviceType, value) {
26
+ this.log.debug(`ON '${serviceType.name}': ${value}`);
27
+ this.getService(serviceType)
28
+ .getCharacteristic(characteristicType)
29
+ .updateValue(value);
30
+ }
31
+ initSensorService() {
32
+ const propertiesToRegister = [
33
+ {
34
+ property: 'battery',
35
+ characteristicType: CHAR.BatteryLevel,
36
+ propertyName: PropertyName.DeviceBattery,
37
+ onSimpleValue: null,
38
+ fallback: 100,
39
+ },
40
+ {
41
+ property: 'batteryLow',
42
+ characteristicType: CHAR.StatusLowBattery,
43
+ propertyName: PropertyName.DeviceBatteryLow,
44
+ onSimpleValue: 'low battery',
45
+ fallback: false,
46
+ },
47
+ {
48
+ property: 'batteryIsCharging',
49
+ characteristicType: CHAR.ChargingState,
50
+ propertyName: PropertyName.DeviceBatteryIsCharging,
51
+ onSimpleValue: null,
52
+ fallback: false,
53
+ },
54
+ ];
55
+ propertiesToRegister.forEach((propertyConfig) => {
56
+ if (this.device.hasProperty(propertyConfig.property)) {
57
+ this.registerCharacteristic({
58
+ serviceType: SERV.Battery,
59
+ characteristicType: propertyConfig.characteristicType,
60
+ getValue: () => this.device.getPropertyValue(propertyConfig.propertyName) || propertyConfig.fallback,
61
+ onSimpleValue: propertyConfig.onSimpleValue,
62
+ });
63
+ }
64
+ });
65
+ }
66
+ }
67
+ //# sourceMappingURL=Device.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Device.js","sourceRoot":"","sources":["../../src/accessories/Device.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAU,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAK/C,MAAM,OAAgB,eAAgB,SAAQ,aAAa;IAEzD,YACE,QAA8B,EAC9B,SAA4B,EAC5B,MAAc;QAEd,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACI,gBAAgB,CAAC,cAAsB,EAAE,YAA0B;QACxE,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;YACzD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,cAAc,KAAK,YAAY,KAAK,KAAK,EAAE,CAAC,CAAC;YACpE,OAAO,KAA4B,CAAC;QACtC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,kBAAkB,cAAc,KAAK,YAAY,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CAAC;gBACrD,IAAI,CAAC,sBAAsB,CAAC;oBAC1B,WAAW,EAAE,IAAI,CAAC,OAAO;oBACzB,kBAAkB,EAAE,cAAc,CAAC,kBAAkB;oBACrD,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,cAAc,CAAC,QAAQ;oBACpG,aAAa,EAAE,cAAc,CAAC,aAAa;iBAC5C,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,48 @@
1
+ import { DeviceAccessory } from './Device.js';
2
+ // @ts-ignore
3
+ import { PropertyName } from 'eufy-security-client';
4
+ import { CHAR, SERV } from '../utils/utils.js';
5
+ /**
6
+ * EntrySensorAccessory Class
7
+ *
8
+ * This class represents an entry sensor accessory within a home automation system. It is designed
9
+ * to integrate entry sensors into the system, register appropriate characteristics, and provide
10
+ * necessary functionality for monitoring the open or closed state of doors or windows.
11
+ *
12
+ * @class EntrySensorAccessory
13
+ * @extends DeviceAccessory
14
+ */
15
+ export class EntrySensorAccessory extends DeviceAccessory {
16
+ /**
17
+ * Constructor for EntrySensorAccessory.
18
+ *
19
+ * @param {EufySecurityPlatform} platform - The platform instance managing accessories.
20
+ * @param {PlatformAccessory} accessory - The platform-specific accessory.
21
+ * @param {EntrySensor} device - The entry sensor device being represented.
22
+ */
23
+ constructor(platform, accessory, device) {
24
+ // Call the constructor of the parent class DeviceAccessory.
25
+ super(platform, accessory, device);
26
+ // Log a debug message indicating the construction of the Entry Sensor.
27
+ this.log.debug(`Constructed Entry Sensor`);
28
+ // Check if the device has the 'sensorOpen' property.
29
+ if (this.device.hasProperty('sensorOpen')) {
30
+ // Register the Contact Sensor characteristic.
31
+ this.registerCharacteristic({
32
+ serviceType: SERV.ContactSensor,
33
+ characteristicType: CHAR.ContactSensorState,
34
+ getValue: () => this.device.getPropertyValue(PropertyName.DeviceSensorOpen),
35
+ onSimpleValue: 'open',
36
+ });
37
+ // Initialize the sensor service.
38
+ this.initSensorService();
39
+ }
40
+ else {
41
+ // Log an error if the 'sensorOpen' property is not available for this device.
42
+ this.log.error(`has no sensorOpen`);
43
+ }
44
+ // Remove any unused services.
45
+ this.pruneUnusedServices();
46
+ }
47
+ }
48
+ //# sourceMappingURL=EntrySensorAccessory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EntrySensorAccessory.js","sourceRoot":"","sources":["../../src/accessories/EntrySensorAccessory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C,eAAe;AACf,OAAO,EAAe,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE/C;;;;;;;;;GASG;AACH,MAAM,OAAO,oBAAqB,SAAQ,eAAe;IAEvD;;;;;;OAMG;IACH,YACE,QAA8B,EAC9B,SAA4B,EAC5B,MAAmB;QAEnB,4DAA4D;QAC5D,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAEnC,uEAAuE;QACvE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAE3C,qDAAqD;QACrD,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,EAAE,CAAC;YAE1C,8CAA8C;YAC9C,IAAI,CAAC,sBAAsB,CAAC;gBAC1B,WAAW,EAAE,IAAI,CAAC,aAAa;gBAC/B,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;gBAC3C,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,YAAY,CAAC,gBAAgB,CAAC;gBAC3E,aAAa,EAAE,MAAM;aACtB,CAAC,CAAC;YAEH,iCAAiC;YACjC,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAE3B,CAAC;aAAM,CAAC;YACN,8EAA8E;YAC9E,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACtC,CAAC;QAED,8BAA8B;QAC9B,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;CACF"}