@homebridge-plugins/homebridge-eufy-security 4.7.1 → 5.0.0-beta.0

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 (469) hide show
  1. package/AUTHORS +4 -0
  2. package/CODE_OF_CONDUCT.md +30 -0
  3. package/CONTRIBUTING.md +77 -0
  4. package/README.md +152 -49
  5. package/SECURITY.md +30 -0
  6. package/config.schema.json +92 -3
  7. package/dist/account/ownership.js +290 -0
  8. package/dist/account/ownership.js.map +1 -0
  9. package/dist/account/persistence.js +274 -0
  10. package/dist/account/persistence.js.map +1 -0
  11. package/dist/account/temporary-authentication.js +348 -0
  12. package/dist/account/temporary-authentication.js.map +1 -0
  13. package/dist/configuration.js +167 -0
  14. package/dist/configuration.js.map +1 -0
  15. package/dist/device/member-evidence.js +66 -0
  16. package/dist/device/member-evidence.js.map +1 -0
  17. package/dist/device/member-trust.js +114 -0
  18. package/dist/device/member-trust.js.map +1 -0
  19. package/dist/device/snapshot.js +190 -0
  20. package/dist/device/snapshot.js.map +1 -0
  21. package/dist/diagnostics.js +2218 -0
  22. package/dist/diagnostics.js.map +1 -0
  23. package/dist/homekit/adapter.js +2 -0
  24. package/dist/homekit/adapter.js.map +1 -0
  25. package/dist/homekit/adapters/battery.js +208 -0
  26. package/dist/homekit/adapters/battery.js.map +1 -0
  27. package/dist/homekit/adapters/camera-controls.js +527 -0
  28. package/dist/homekit/adapters/camera-controls.js.map +1 -0
  29. package/dist/homekit/adapters/camera-streaming.js +1515 -0
  30. package/dist/homekit/adapters/camera-streaming.js.map +1 -0
  31. package/dist/homekit/adapters/contact.js +138 -0
  32. package/dist/homekit/adapters/contact.js.map +1 -0
  33. package/dist/homekit/adapters/doorbell.js +57 -0
  34. package/dist/homekit/adapters/doorbell.js.map +1 -0
  35. package/dist/homekit/adapters/information.js +55 -0
  36. package/dist/homekit/adapters/information.js.map +1 -0
  37. package/dist/homekit/adapters/lock.js +489 -0
  38. package/dist/homekit/adapters/lock.js.map +1 -0
  39. package/dist/homekit/adapters/motion.js +100 -0
  40. package/dist/homekit/adapters/motion.js.map +1 -0
  41. package/dist/homekit/adapters/registry.js +26 -0
  42. package/dist/homekit/adapters/registry.js.map +1 -0
  43. package/dist/homekit/adapters/security-system.js +425 -0
  44. package/dist/homekit/adapters/security-system.js.map +1 -0
  45. package/dist/homekit/adapters/siren.js +136 -0
  46. package/dist/homekit/adapters/siren.js.map +1 -0
  47. package/dist/homekit/adapters/smart-light.js +662 -0
  48. package/dist/homekit/adapters/smart-light.js.map +1 -0
  49. package/dist/homekit/coverage-matrix.js +119 -0
  50. package/dist/homekit/coverage-matrix.js.map +1 -0
  51. package/dist/homekit/device-control.js +175 -0
  52. package/dist/homekit/device-control.js.map +1 -0
  53. package/dist/homekit/reconciler.js +319 -0
  54. package/dist/homekit/reconciler.js.map +1 -0
  55. package/dist/homekit/representation.js +23 -0
  56. package/dist/homekit/representation.js.map +1 -0
  57. package/dist/index.js +4 -9
  58. package/dist/index.js.map +1 -1
  59. package/dist/media/contracts.js +2 -0
  60. package/dist/media/contracts.js.map +1 -0
  61. package/dist/media/last-successful-image.js +208 -0
  62. package/dist/media/last-successful-image.js.map +1 -0
  63. package/dist/media/live-stream.js +1003 -0
  64. package/dist/media/live-stream.js.map +1 -0
  65. package/dist/media/recording.js +560 -0
  66. package/dist/media/recording.js.map +1 -0
  67. package/dist/media/session-budget.js +39 -0
  68. package/dist/media/session-budget.js.map +1 -0
  69. package/dist/media/snapshot.js +406 -0
  70. package/dist/media/snapshot.js.map +1 -0
  71. package/dist/media/station-live-sessions.js +101 -0
  72. package/dist/media/station-live-sessions.js.map +1 -0
  73. package/dist/platform.js +97 -769
  74. package/dist/platform.js.map +1 -1
  75. package/dist/runtime/channel.js +375 -0
  76. package/dist/runtime/channel.js.map +1 -0
  77. package/dist/runtime/owner.js +682 -0
  78. package/dist/runtime/owner.js.map +1 -0
  79. package/dist/runtime/sdk-client.js +211 -0
  80. package/dist/runtime/sdk-client.js.map +1 -0
  81. package/dist/runtime/tracker.js +211 -0
  82. package/dist/runtime/tracker.js.map +1 -0
  83. package/dist/settings.js +1 -43
  84. package/dist/settings.js.map +1 -1
  85. package/dist/storage.js +59 -0
  86. package/dist/storage.js.map +1 -0
  87. package/dist/ui/dashboard.js +181 -0
  88. package/dist/ui/dashboard.js.map +1 -0
  89. package/dist/ui/device-image.js +22 -0
  90. package/dist/ui/device-image.js.map +1 -0
  91. package/dist/ui/runtime-channel-client.js +305 -0
  92. package/dist/ui/runtime-channel-client.js.map +1 -0
  93. package/dist/ui/server.js +259 -0
  94. package/dist/ui/server.js.map +1 -0
  95. package/homebridge-ui/public/app.css +1902 -0
  96. package/homebridge-ui/public/assets/devices/clean/clean-T1250.webp +0 -0
  97. package/homebridge-ui/public/assets/devices/clean/clean-T2070.webp +0 -0
  98. package/homebridge-ui/public/assets/devices/clean/clean-T2080.webp +0 -0
  99. package/homebridge-ui/public/assets/devices/clean/clean-T2081.webp +0 -0
  100. package/homebridge-ui/public/assets/devices/clean/clean-T2103.webp +0 -0
  101. package/homebridge-ui/public/assets/devices/clean/clean-T2117.webp +0 -0
  102. package/homebridge-ui/public/assets/devices/clean/clean-T2118.webp +0 -0
  103. package/homebridge-ui/public/assets/devices/clean/clean-T2119.webp +0 -0
  104. package/homebridge-ui/public/assets/devices/clean/clean-T211A.webp +0 -0
  105. package/homebridge-ui/public/assets/devices/clean/clean-T2120.webp +0 -0
  106. package/homebridge-ui/public/assets/devices/clean/clean-T2123.webp +0 -0
  107. package/homebridge-ui/public/assets/devices/clean/clean-T2128.webp +0 -0
  108. package/homebridge-ui/public/assets/devices/clean/clean-T2130.webp +0 -0
  109. package/homebridge-ui/public/assets/devices/clean/clean-T2132.webp +0 -0
  110. package/homebridge-ui/public/assets/devices/clean/clean-T2150.webp +0 -0
  111. package/homebridge-ui/public/assets/devices/clean/clean-T2181.webp +0 -0
  112. package/homebridge-ui/public/assets/devices/clean/clean-T2182.webp +0 -0
  113. package/homebridge-ui/public/assets/devices/clean/clean-T2190.webp +0 -0
  114. package/homebridge-ui/public/assets/devices/clean/clean-T2192.webp +0 -0
  115. package/homebridge-ui/public/assets/devices/clean/clean-T2193.webp +0 -0
  116. package/homebridge-ui/public/assets/devices/clean/clean-T2194.webp +0 -0
  117. package/homebridge-ui/public/assets/devices/clean/clean-T2210.webp +0 -0
  118. package/homebridge-ui/public/assets/devices/clean/clean-T2250.webp +0 -0
  119. package/homebridge-ui/public/assets/devices/clean/clean-T2251.webp +0 -0
  120. package/homebridge-ui/public/assets/devices/clean/clean-T2252.webp +0 -0
  121. package/homebridge-ui/public/assets/devices/clean/clean-T2253.webp +0 -0
  122. package/homebridge-ui/public/assets/devices/clean/clean-T2254.webp +0 -0
  123. package/homebridge-ui/public/assets/devices/clean/clean-T2255.webp +0 -0
  124. package/homebridge-ui/public/assets/devices/clean/clean-T2256.webp +0 -0
  125. package/homebridge-ui/public/assets/devices/clean/clean-T2257.webp +0 -0
  126. package/homebridge-ui/public/assets/devices/clean/clean-T2258.webp +0 -0
  127. package/homebridge-ui/public/assets/devices/clean/clean-T2259.webp +0 -0
  128. package/homebridge-ui/public/assets/devices/clean/clean-T2261.webp +0 -0
  129. package/homebridge-ui/public/assets/devices/clean/clean-T2262.webp +0 -0
  130. package/homebridge-ui/public/assets/devices/clean/clean-T2266.webp +0 -0
  131. package/homebridge-ui/public/assets/devices/clean/clean-T2267.webp +0 -0
  132. package/homebridge-ui/public/assets/devices/clean/clean-T2268.webp +0 -0
  133. package/homebridge-ui/public/assets/devices/clean/clean-T2270.webp +0 -0
  134. package/homebridge-ui/public/assets/devices/clean/clean-T2272.webp +0 -0
  135. package/homebridge-ui/public/assets/devices/clean/clean-T2273.webp +0 -0
  136. package/homebridge-ui/public/assets/devices/clean/clean-T2276.webp +0 -0
  137. package/homebridge-ui/public/assets/devices/clean/clean-T2277.webp +0 -0
  138. package/homebridge-ui/public/assets/devices/clean/clean-T2278.webp +0 -0
  139. package/homebridge-ui/public/assets/devices/clean/clean-T2280.webp +0 -0
  140. package/homebridge-ui/public/assets/devices/clean/clean-T2292.webp +0 -0
  141. package/homebridge-ui/public/assets/devices/clean/clean-T2320.webp +0 -0
  142. package/homebridge-ui/public/assets/devices/clean/clean-T2351.webp +0 -0
  143. package/homebridge-ui/public/assets/devices/clean/clean-T2352.webp +0 -0
  144. package/homebridge-ui/public/assets/devices/clean/clean-T2353.webp +0 -0
  145. package/homebridge-ui/public/assets/devices/life/life-T8L00.webp +0 -0
  146. package/homebridge-ui/public/assets/devices/life/life-T8L01.webp +0 -0
  147. package/homebridge-ui/public/assets/devices/life/life-T8L02.webp +0 -0
  148. package/homebridge-ui/public/assets/devices/life/life-T8L04.webp +0 -0
  149. package/homebridge-ui/public/assets/devices/life/life-T8L10.webp +0 -0
  150. package/homebridge-ui/public/assets/devices/life/life-T8L20.webp +0 -0
  151. package/homebridge-ui/public/assets/devices/life/life-T8L30.webp +0 -0
  152. package/homebridge-ui/public/assets/devices/life/life-T8L40.webp +0 -0
  153. package/homebridge-ui/public/assets/devices/mower/mower-T2801.webp +0 -0
  154. package/homebridge-ui/public/assets/devices/mower/mower-T280B.webp +0 -0
  155. package/homebridge-ui/public/assets/devices/mower/mower-T2880.webp +0 -0
  156. package/homebridge-ui/public/assets/devices/security/security-T7400.webp +0 -0
  157. package/homebridge-ui/public/assets/devices/security/security-T7401.webp +0 -0
  158. package/homebridge-ui/public/assets/devices/security/security-T8001.webp +0 -0
  159. package/homebridge-ui/public/assets/devices/security/security-T8002.webp +0 -0
  160. package/homebridge-ui/public/assets/devices/security/security-T8010.webp +0 -0
  161. package/homebridge-ui/public/assets/devices/security/security-T8021.webp +0 -0
  162. package/homebridge-ui/public/assets/devices/security/security-T8023.webp +0 -0
  163. package/homebridge-ui/public/assets/devices/security/security-T8025.webp +0 -0
  164. package/homebridge-ui/public/assets/devices/security/security-T8030.webp +0 -0
  165. package/homebridge-ui/public/assets/devices/security/security-T8110.webp +0 -0
  166. package/homebridge-ui/public/assets/devices/security/security-T8111.webp +0 -0
  167. package/homebridge-ui/public/assets/devices/security/security-T8112.webp +0 -0
  168. package/homebridge-ui/public/assets/devices/security/security-T8113.webp +0 -0
  169. package/homebridge-ui/public/assets/devices/security/security-T8114.webp +0 -0
  170. package/homebridge-ui/public/assets/devices/security/security-T8122.webp +0 -0
  171. package/homebridge-ui/public/assets/devices/security/security-T8123.webp +0 -0
  172. package/homebridge-ui/public/assets/devices/security/security-T8124.webp +0 -0
  173. package/homebridge-ui/public/assets/devices/security/security-T8130.webp +0 -0
  174. package/homebridge-ui/public/assets/devices/security/security-T8131.webp +0 -0
  175. package/homebridge-ui/public/assets/devices/security/security-T8134.webp +0 -0
  176. package/homebridge-ui/public/assets/devices/security/security-T8140.webp +0 -0
  177. package/homebridge-ui/public/assets/devices/security/security-T8141.webp +0 -0
  178. package/homebridge-ui/public/assets/devices/security/security-T8150.webp +0 -0
  179. package/homebridge-ui/public/assets/devices/security/security-T8151.webp +0 -0
  180. package/homebridge-ui/public/assets/devices/security/security-T8152.webp +0 -0
  181. package/homebridge-ui/public/assets/devices/security/security-T8153.webp +0 -0
  182. package/homebridge-ui/public/assets/devices/security/security-T8160.webp +0 -0
  183. package/homebridge-ui/public/assets/devices/security/security-T8161.webp +0 -0
  184. package/homebridge-ui/public/assets/devices/security/security-T8162.webp +0 -0
  185. package/homebridge-ui/public/assets/devices/security/security-T8170.webp +0 -0
  186. package/homebridge-ui/public/assets/devices/security/security-T8171.webp +0 -0
  187. package/homebridge-ui/public/assets/devices/security/security-T8172.webp +0 -0
  188. package/homebridge-ui/public/assets/devices/security/security-T8173.webp +0 -0
  189. package/homebridge-ui/public/assets/devices/security/security-T8200.webp +0 -0
  190. package/homebridge-ui/public/assets/devices/security/security-T8200X.webp +0 -0
  191. package/homebridge-ui/public/assets/devices/security/security-T8201.webp +0 -0
  192. package/homebridge-ui/public/assets/devices/security/security-T8203.webp +0 -0
  193. package/homebridge-ui/public/assets/devices/security/security-T8210.webp +0 -0
  194. package/homebridge-ui/public/assets/devices/security/security-T8213.webp +0 -0
  195. package/homebridge-ui/public/assets/devices/security/security-T8214.webp +0 -0
  196. package/homebridge-ui/public/assets/devices/security/security-T8222.webp +0 -0
  197. package/homebridge-ui/public/assets/devices/security/security-T8400.webp +0 -0
  198. package/homebridge-ui/public/assets/devices/security/security-T8401.webp +0 -0
  199. package/homebridge-ui/public/assets/devices/security/security-T8410.webp +0 -0
  200. package/homebridge-ui/public/assets/devices/security/security-T8411.webp +0 -0
  201. package/homebridge-ui/public/assets/devices/security/security-T8414.webp +0 -0
  202. package/homebridge-ui/public/assets/devices/security/security-T8416.webp +0 -0
  203. package/homebridge-ui/public/assets/devices/security/security-T8417.webp +0 -0
  204. package/homebridge-ui/public/assets/devices/security/security-T8419.webp +0 -0
  205. package/homebridge-ui/public/assets/devices/security/security-T8419N.webp +0 -0
  206. package/homebridge-ui/public/assets/devices/security/security-T8420.webp +0 -0
  207. package/homebridge-ui/public/assets/devices/security/security-T8420X.webp +0 -0
  208. package/homebridge-ui/public/assets/devices/security/security-T8422.webp +0 -0
  209. package/homebridge-ui/public/assets/devices/security/security-T8423.webp +0 -0
  210. package/homebridge-ui/public/assets/devices/security/security-T8424.webp +0 -0
  211. package/homebridge-ui/public/assets/devices/security/security-T8425.webp +0 -0
  212. package/homebridge-ui/public/assets/devices/security/security-T8441.webp +0 -0
  213. package/homebridge-ui/public/assets/devices/security/security-T8442.webp +0 -0
  214. package/homebridge-ui/public/assets/devices/security/security-T8452.webp +0 -0
  215. package/homebridge-ui/public/assets/devices/security/security-T84A0.webp +0 -0
  216. package/homebridge-ui/public/assets/devices/security/security-T84A1.webp +0 -0
  217. package/homebridge-ui/public/assets/devices/security/security-T8500.webp +0 -0
  218. package/homebridge-ui/public/assets/devices/security/security-T8502.webp +0 -0
  219. package/homebridge-ui/public/assets/devices/security/security-T8503.webp +0 -0
  220. package/homebridge-ui/public/assets/devices/security/security-T8504.webp +0 -0
  221. package/homebridge-ui/public/assets/devices/security/security-T8506.webp +0 -0
  222. package/homebridge-ui/public/assets/devices/security/security-T8510.webp +0 -0
  223. package/homebridge-ui/public/assets/devices/security/security-T8510P.webp +0 -0
  224. package/homebridge-ui/public/assets/devices/security/security-T8520.webp +0 -0
  225. package/homebridge-ui/public/assets/devices/security/security-T8520P.webp +0 -0
  226. package/homebridge-ui/public/assets/devices/security/security-T8530.webp +0 -0
  227. package/homebridge-ui/public/assets/devices/security/security-T8531.webp +0 -0
  228. package/homebridge-ui/public/assets/devices/security/security-T85D0.webp +0 -0
  229. package/homebridge-ui/public/assets/devices/security/security-T85L0.webp +0 -0
  230. package/homebridge-ui/public/assets/devices/security/security-T85P0.webp +0 -0
  231. package/homebridge-ui/public/assets/devices/security/security-T85V0.webp +0 -0
  232. package/homebridge-ui/public/assets/devices/security/security-T8600.webp +0 -0
  233. package/homebridge-ui/public/assets/devices/security/security-T86P2.webp +0 -0
  234. package/homebridge-ui/public/assets/devices/security/security-T8790.webp +0 -0
  235. package/homebridge-ui/public/assets/devices/security/security-T87B0.webp +0 -0
  236. package/homebridge-ui/public/assets/devices/security/security-T87B2.webp +0 -0
  237. package/homebridge-ui/public/assets/devices/security/security-T8900.webp +0 -0
  238. package/homebridge-ui/public/assets/devices/security/security-T8910.webp +0 -0
  239. package/homebridge-ui/public/assets/devices/security/security-T8920.webp +0 -0
  240. package/homebridge-ui/public/assets/devices/security/security-T8960.webp +0 -0
  241. package/homebridge-ui/public/assets/devices/security/security-T8B0.webp +0 -0
  242. package/homebridge-ui/public/assets/devices/security/security-T8E00.webp +0 -0
  243. package/homebridge-ui/public/assets/devices/security/security-T8N00.webp +0 -0
  244. package/homebridge-ui/public/assets/devices/security/security-T8W11C.webp +0 -0
  245. package/homebridge-ui/public/assets/devices/security/security-T90F0.webp +0 -0
  246. package/homebridge-ui/public/assets/devices/security/security-T90M0.webp +0 -0
  247. package/homebridge-ui/public/assets/devices/security/security-T90R0.webp +0 -0
  248. package/homebridge-ui/public/assets/devices/security/security-T90S0.webp +0 -0
  249. package/homebridge-ui/public/assets/icons/inventory.svg +1 -1
  250. package/homebridge-ui/public/assets/icons/troubleshoot.svg +1 -0
  251. package/homebridge-ui/public/assets/icons/warning.svg +1 -1
  252. package/homebridge-ui/public/assets/logo-dark.svg +10 -0
  253. package/homebridge-ui/public/assets/logo.svg +10 -0
  254. package/homebridge-ui/public/i18n/en.json +218 -0
  255. package/homebridge-ui/public/i18n/fr.json +218 -0
  256. package/homebridge-ui/public/index.html +377 -28
  257. package/homebridge-ui/public/js/app.js +1065 -0
  258. package/homebridge-ui/public/js/dashboard.js +385 -0
  259. package/homebridge-ui/public/js/legacy-settings.js +37 -0
  260. package/homebridge-ui/public/js/profile-wizard.js +68 -0
  261. package/homebridge-ui/server.js +2 -1393
  262. package/i18n/runtime/en.json +100 -0
  263. package/media/Snapshot-Unavailable.jpg +0 -0
  264. package/media/Snapshot-black.jpg +0 -0
  265. package/media/camera-disabled.jpg +0 -0
  266. package/media/camera-offline.jpg +0 -0
  267. package/package.json +29 -24
  268. package/.claude/CLAUDE.md +0 -175
  269. package/.claude/PRD.md +0 -241
  270. package/.claude/docs/debug-recording-lessons.md +0 -91
  271. package/.claude/docs/hksv-recording-fix.md +0 -160
  272. package/.claude/skills/architect/SKILL.md +0 -76
  273. package/.claude/skills/developer/SKILL.md +0 -59
  274. package/.claude/skills/new-device-support/SKILL.md +0 -212
  275. package/.claude/skills/new-device-support/check-device.mjs +0 -363
  276. package/.claude/skills/new-device-support/map-properties.mjs +0 -450
  277. package/.claude/skills/new-device-support/verify-device.mjs +0 -272
  278. package/.claude/skills/planner/SKILL.md +0 -100
  279. package/.claude/skills/qa/SKILL.md +0 -79
  280. package/.claude/skills/support/SKILL.md +0 -175
  281. package/.prettierignore +0 -7
  282. package/.prettierrc.json +0 -7
  283. package/FUNDING.yml +0 -1
  284. package/dist/accessories/AutoSyncStationAccessory.js +0 -157
  285. package/dist/accessories/AutoSyncStationAccessory.js.map +0 -1
  286. package/dist/accessories/BaseAccessory.js +0 -261
  287. package/dist/accessories/BaseAccessory.js.map +0 -1
  288. package/dist/accessories/CameraAccessory.js +0 -431
  289. package/dist/accessories/CameraAccessory.js.map +0 -1
  290. package/dist/accessories/Device.js +0 -65
  291. package/dist/accessories/Device.js.map +0 -1
  292. package/dist/accessories/EntrySensorAccessory.js +0 -48
  293. package/dist/accessories/EntrySensorAccessory.js.map +0 -1
  294. package/dist/accessories/LockAccessory.js +0 -142
  295. package/dist/accessories/LockAccessory.js.map +0 -1
  296. package/dist/accessories/MotionSensorAccessory.js +0 -48
  297. package/dist/accessories/MotionSensorAccessory.js.map +0 -1
  298. package/dist/accessories/SmartDropAccessory.js +0 -141
  299. package/dist/accessories/SmartDropAccessory.js.map +0 -1
  300. package/dist/accessories/StationAccessory.js +0 -373
  301. package/dist/accessories/StationAccessory.js.map +0 -1
  302. package/dist/config.js +0 -26
  303. package/dist/config.js.map +0 -1
  304. package/dist/controller/DebugRecordingManager.js +0 -402
  305. package/dist/controller/DebugRecordingManager.js.map +0 -1
  306. package/dist/controller/LocalLivestreamManager.js +0 -371
  307. package/dist/controller/LocalLivestreamManager.js.map +0 -1
  308. package/dist/controller/recordingDelegate.js +0 -252
  309. package/dist/controller/recordingDelegate.js.map +0 -1
  310. package/dist/controller/snapshotDelegate.js +0 -348
  311. package/dist/controller/snapshotDelegate.js.map +0 -1
  312. package/dist/controller/streamingDelegate.js +0 -389
  313. package/dist/controller/streamingDelegate.js.map +0 -1
  314. package/dist/interfaces.js +0 -2
  315. package/dist/interfaces.js.map +0 -1
  316. package/dist/media/Snapshot-Unavailable.png +0 -0
  317. package/dist/media/Snapshot-Unavailable.xcf +0 -0
  318. package/dist/media/Snapshot-black.png +0 -0
  319. package/dist/media/camera-disabled.png +0 -0
  320. package/dist/media/camera-offline.png +0 -0
  321. package/dist/media/media/Snapshot-Unavailable.png +0 -0
  322. package/dist/media/media/Snapshot-Unavailable.xcf +0 -0
  323. package/dist/media/media/Snapshot-black.png +0 -0
  324. package/dist/media/media/camera-disabled.png +0 -0
  325. package/dist/media/media/camera-offline.png +0 -0
  326. package/dist/utils/Talkback.js +0 -162
  327. package/dist/utils/Talkback.js.map +0 -1
  328. package/dist/utils/accessoriesStore.js +0 -207
  329. package/dist/utils/accessoriesStore.js.map +0 -1
  330. package/dist/utils/configTypes.js +0 -36
  331. package/dist/utils/configTypes.js.map +0 -1
  332. package/dist/utils/ffmpeg.js +0 -1111
  333. package/dist/utils/ffmpeg.js.map +0 -1
  334. package/dist/utils/interfaces.js +0 -8
  335. package/dist/utils/interfaces.js.map +0 -1
  336. package/dist/utils/utils.js +0 -224
  337. package/dist/utils/utils.js.map +0 -1
  338. package/dist/version.js +0 -2
  339. package/dist/version.js.map +0 -1
  340. package/homebridge-eufy-security.png +0 -0
  341. package/homebridge-ui/diagnosticsCrypto.js +0 -112
  342. package/homebridge-ui/public/app.js +0 -237
  343. package/homebridge-ui/public/assets/devices/4g_lte_cam_s330_large.png +0 -0
  344. package/homebridge-ui/public/assets/devices/4g_lte_starlight_large.jpg +0 -0
  345. package/homebridge-ui/public/assets/devices/BATTERY_DOORBELL_C30.png +0 -0
  346. package/homebridge-ui/public/assets/devices/BATTERY_DOORBELL_C31.png +0 -0
  347. package/homebridge-ui/public/assets/devices/batterydoorbell1080p_large.jpg +0 -0
  348. package/homebridge-ui/public/assets/devices/batterydoorbell2k_large.png +0 -0
  349. package/homebridge-ui/public/assets/devices/batterydoorbell2kdual_large.jpg +0 -0
  350. package/homebridge-ui/public/assets/devices/batterydoorbell_e340_large.png +0 -0
  351. package/homebridge-ui/public/assets/devices/eufy-security-client.png +0 -0
  352. package/homebridge-ui/public/assets/devices/eufyCamS4_large.png +0 -0
  353. package/homebridge-ui/public/assets/devices/eufycam2_large.png +0 -0
  354. package/homebridge-ui/public/assets/devices/eufycam2c_large.jpg +0 -0
  355. package/homebridge-ui/public/assets/devices/eufycam2cpro_large.jpg +0 -0
  356. package/homebridge-ui/public/assets/devices/eufycam2pro_large.jpg +0 -0
  357. package/homebridge-ui/public/assets/devices/eufycam3_large.jpg +0 -0
  358. package/homebridge-ui/public/assets/devices/eufycam3c_large.jpg +0 -0
  359. package/homebridge-ui/public/assets/devices/eufycam3pro_large.png +0 -0
  360. package/homebridge-ui/public/assets/devices/eufycam_large.jpg +0 -0
  361. package/homebridge-ui/public/assets/devices/eufycame330_large.jpg +0 -0
  362. package/homebridge-ui/public/assets/devices/flood_freeze_sensor_e20_t90F0_large.png +0 -0
  363. package/homebridge-ui/public/assets/devices/floodlight2_large.jpg +0 -0
  364. package/homebridge-ui/public/assets/devices/floodlight2pro_large.jpg +0 -0
  365. package/homebridge-ui/public/assets/devices/floodlight_large.jpg +0 -0
  366. package/homebridge-ui/public/assets/devices/floodlightcame340_large.jpg +0 -0
  367. package/homebridge-ui/public/assets/devices/garage_camera_t8452_large.png +0 -0
  368. package/homebridge-ui/public/assets/devices/homebase2_large.png +0 -0
  369. package/homebridge-ui/public/assets/devices/homebase3_large.png +0 -0
  370. package/homebridge-ui/public/assets/devices/homebase_large.jpg +0 -0
  371. package/homebridge-ui/public/assets/devices/homebasemini_large.png +0 -0
  372. package/homebridge-ui/public/assets/devices/indoorcamC210_large.png +0 -0
  373. package/homebridge-ui/public/assets/devices/indoorcamC220_large.png +0 -0
  374. package/homebridge-ui/public/assets/devices/indoorcamC220_t8419N_large.png +0 -0
  375. package/homebridge-ui/public/assets/devices/indoorcamE30_large.png +0 -0
  376. package/homebridge-ui/public/assets/devices/indoorcamc120_large.png +0 -0
  377. package/homebridge-ui/public/assets/devices/indoorcammini_large.jpg +0 -0
  378. package/homebridge-ui/public/assets/devices/indoorcamp24_large.png +0 -0
  379. package/homebridge-ui/public/assets/devices/indoorcams350_large.png +0 -0
  380. package/homebridge-ui/public/assets/devices/keypad_large.png +0 -0
  381. package/homebridge-ui/public/assets/devices/minibase_chime_T8023_large.jpg +0 -0
  382. package/homebridge-ui/public/assets/devices/motionsensor_large.png +0 -0
  383. package/homebridge-ui/public/assets/devices/nvr_s4_max_T8N00_large.png +0 -0
  384. package/homebridge-ui/public/assets/devices/pir_sensor_e20_large.png +0 -0
  385. package/homebridge-ui/public/assets/devices/poe_bullet_ptz_cam_s4_T8E00_large.png +0 -0
  386. package/homebridge-ui/public/assets/devices/sensor_large.png +0 -0
  387. package/homebridge-ui/public/assets/devices/siren_sensor_e20_large.png +0 -0
  388. package/homebridge-ui/public/assets/devices/smartdrop_t8790_large.png +0 -0
  389. package/homebridge-ui/public/assets/devices/smartlock_t8500_large.png +0 -0
  390. package/homebridge-ui/public/assets/devices/smartlock_t8500_wifibridge_large.jpg +0 -0
  391. package/homebridge-ui/public/assets/devices/smartlock_t8503_large.png +0 -0
  392. package/homebridge-ui/public/assets/devices/smartlock_t8504_large.jpg +0 -0
  393. package/homebridge-ui/public/assets/devices/smartlock_t8510P_t8520P_large.png +0 -0
  394. package/homebridge-ui/public/assets/devices/smartlock_t85D0_large.png +0 -0
  395. package/homebridge-ui/public/assets/devices/smartlock_t85L0_large.png +0 -0
  396. package/homebridge-ui/public/assets/devices/smartlock_t85P0_large.png +0 -0
  397. package/homebridge-ui/public/assets/devices/smartlock_t85V0_large.png +0 -0
  398. package/homebridge-ui/public/assets/devices/smartlock_touch_and_wifi_t8502_large.png +0 -0
  399. package/homebridge-ui/public/assets/devices/smartlock_touch_and_wifi_t8506_large.png +0 -0
  400. package/homebridge-ui/public/assets/devices/smartlock_touch_and_wifi_t8520_large.png +0 -0
  401. package/homebridge-ui/public/assets/devices/smartlock_touch_t8510_large.png +0 -0
  402. package/homebridge-ui/public/assets/devices/smartlock_touch_t8510_wifibridge_large.jpg +0 -0
  403. package/homebridge-ui/public/assets/devices/smartlock_video_t8530_large.png +0 -0
  404. package/homebridge-ui/public/assets/devices/smartlock_video_t8531_large.png +0 -0
  405. package/homebridge-ui/public/assets/devices/smartlockwifibridge_t8021_large.jpg +0 -0
  406. package/homebridge-ui/public/assets/devices/smartsafe_s10_t7400_large.png +0 -0
  407. package/homebridge-ui/public/assets/devices/smartsafe_s12_t7401_large.png +0 -0
  408. package/homebridge-ui/public/assets/devices/smarttrack_card_t87B2_large.png +0 -0
  409. package/homebridge-ui/public/assets/devices/smarttrack_link_t87B0_large.png +0 -0
  410. package/homebridge-ui/public/assets/devices/smoke_alarm_e10_t90S0_large.png +0 -0
  411. package/homebridge-ui/public/assets/devices/solocamc210_large.jpg +0 -0
  412. package/homebridge-ui/public/assets/devices/solocamc35_large.png +0 -0
  413. package/homebridge-ui/public/assets/devices/solocame20_large.jpg +0 -0
  414. package/homebridge-ui/public/assets/devices/solocame30_large.png +0 -0
  415. package/homebridge-ui/public/assets/devices/solocame40_large.jpg +0 -0
  416. package/homebridge-ui/public/assets/devices/solocame42_large.png +0 -0
  417. package/homebridge-ui/public/assets/devices/solocaml20_large.jpg +0 -0
  418. package/homebridge-ui/public/assets/devices/solocams220_large.jpg +0 -0
  419. package/homebridge-ui/public/assets/devices/solocams340_large.png +0 -0
  420. package/homebridge-ui/public/assets/devices/solocams40_large.jpg +0 -0
  421. package/homebridge-ui/public/assets/devices/soloindoorcamc24_large.jpg +0 -0
  422. package/homebridge-ui/public/assets/devices/solooutdoorcamc22_large.png +0 -0
  423. package/homebridge-ui/public/assets/devices/solooutdoorcamc24_large.jpg +0 -0
  424. package/homebridge-ui/public/assets/devices/unknown.png +0 -0
  425. package/homebridge-ui/public/assets/devices/walllight_s100_large.png +0 -0
  426. package/homebridge-ui/public/assets/devices/walllight_s120_large.png +0 -0
  427. package/homebridge-ui/public/assets/devices/water_freeze_sensor_t8920_large.png +0 -0
  428. package/homebridge-ui/public/assets/devices/wireddoorbell1080p_large.jpg +0 -0
  429. package/homebridge-ui/public/assets/devices/wireddoorbell2k_large.png +0 -0
  430. package/homebridge-ui/public/assets/devices/wireddoorbelldual_large.jpg +0 -0
  431. package/homebridge-ui/public/assets/icons/attach.svg +0 -1
  432. package/homebridge-ui/public/assets/icons/battery_0.svg +0 -1
  433. package/homebridge-ui/public/assets/icons/battery_1.svg +0 -1
  434. package/homebridge-ui/public/assets/icons/battery_2.svg +0 -1
  435. package/homebridge-ui/public/assets/icons/battery_3.svg +0 -1
  436. package/homebridge-ui/public/assets/icons/battery_4.svg +0 -1
  437. package/homebridge-ui/public/assets/icons/battery_5.svg +0 -1
  438. package/homebridge-ui/public/assets/icons/battery_6.svg +0 -1
  439. package/homebridge-ui/public/assets/icons/copy.svg +0 -1
  440. package/homebridge-ui/public/assets/icons/delete.svg +0 -1
  441. package/homebridge-ui/public/assets/icons/download.svg +0 -1
  442. package/homebridge-ui/public/assets/icons/info.svg +0 -1
  443. package/homebridge-ui/public/assets/icons/refresh.svg +0 -1
  444. package/homebridge-ui/public/assets/icons/satellite_alt.svg +0 -1
  445. package/homebridge-ui/public/assets/icons/solar_power.svg +0 -1
  446. package/homebridge-ui/public/components/device-card.js +0 -174
  447. package/homebridge-ui/public/components/guard-modes.js +0 -88
  448. package/homebridge-ui/public/components/number-input.js +0 -121
  449. package/homebridge-ui/public/components/select.js +0 -73
  450. package/homebridge-ui/public/components/toggle.js +0 -68
  451. package/homebridge-ui/public/services/api.js +0 -250
  452. package/homebridge-ui/public/services/config.js +0 -144
  453. package/homebridge-ui/public/style.css +0 -818
  454. package/homebridge-ui/public/utils/countries.js +0 -73
  455. package/homebridge-ui/public/utils/device-images.js +0 -102
  456. package/homebridge-ui/public/utils/helpers.js +0 -115
  457. package/homebridge-ui/public/views/dashboard.js +0 -226
  458. package/homebridge-ui/public/views/device-detail.js +0 -626
  459. package/homebridge-ui/public/views/diagnostics.js +0 -402
  460. package/homebridge-ui/public/views/login.js +0 -650
  461. package/homebridge-ui/public/views/recordings.js +0 -319
  462. package/homebridge-ui/public/views/settings.js +0 -197
  463. package/homebridge-ui/public/views/unsupported-detail.js +0 -296
  464. package/media/Snapshot-Unavailable.png +0 -0
  465. package/media/Snapshot-Unavailable.xcf +0 -0
  466. package/media/Snapshot-black.png +0 -0
  467. package/media/camera-disabled.png +0 -0
  468. package/media/camera-offline.png +0 -0
  469. package/scripts/decrypt-diagnostics.mjs +0 -257
@@ -0,0 +1,319 @@
1
+ import { indexDeviceEvidence } from '../device/member-evidence.js';
2
+ import { admittedHomeKitAdapters } from './representation.js';
3
+ /** Reconciles complete runtime registry publications into stable HomeKit accessory containers. */
4
+ export class HomeKitReconciler {
5
+ source;
6
+ store;
7
+ diagnose;
8
+ trace;
9
+ entityPreferences;
10
+ liveMedia;
11
+ snapshotMedia;
12
+ recordingMedia;
13
+ mediaBudget;
14
+ stationLiveSessions;
15
+ accessories = new Map();
16
+ representedSerials = new Set();
17
+ attachedAdapters = new Map();
18
+ activeAdapters = new Map();
19
+ representationDiagnostics = new Map();
20
+ adapterDiagnostics = new Map();
21
+ unsubscribeRegistry;
22
+ unsubscribeEvents;
23
+ lastPublication;
24
+ constructor(source, store, diagnose, cachedAccessories = [], trace, entityPreferences = {}, liveMedia, snapshotMedia, recordingMedia, mediaBudget, stationLiveSessions) {
25
+ this.source = source;
26
+ this.store = store;
27
+ this.diagnose = diagnose;
28
+ this.trace = trace;
29
+ this.entityPreferences = entityPreferences;
30
+ this.liveMedia = liveMedia;
31
+ this.snapshotMedia = snapshotMedia;
32
+ this.recordingMedia = recordingMedia;
33
+ this.mediaBudget = mediaBudget;
34
+ this.stationLiveSessions = stationLiveSessions;
35
+ for (const accessory of cachedAccessories) {
36
+ this.accessories.set(accessory.UUID, accessory);
37
+ const context = accessory.context;
38
+ const serial = context.homebridgeEufy?.version === 1 ? context.homebridgeEufy.serial : context.device?.uniqueId;
39
+ if (serial && accessory.UUID === this.store.generateUuid(`d1_${serial}`)) {
40
+ this.representedSerials.add(serial);
41
+ }
42
+ }
43
+ for (const [serial, preference] of Object.entries(this.entityPreferences)) {
44
+ if (preference.represented === false) {
45
+ this.snapshotMedia?.discard?.(serial);
46
+ }
47
+ }
48
+ }
49
+ start() {
50
+ if (this.unsubscribeRegistry) {
51
+ return;
52
+ }
53
+ this.unsubscribeRegistry = this.source.subscribeRegistry((view) => this.reconcile(view));
54
+ this.unsubscribeEvents = this.source.subscribeEvents((event) => this.observe(event));
55
+ const current = this.source.currentRegistry();
56
+ if (current) {
57
+ this.reconcile(current);
58
+ }
59
+ }
60
+ stop() {
61
+ this.unsubscribeRegistry?.();
62
+ this.unsubscribeEvents?.();
63
+ this.unsubscribeRegistry = undefined;
64
+ this.unsubscribeEvents = undefined;
65
+ for (const serial of this.attachedAdapters.keys()) {
66
+ this.detachAdapters(serial, 'shutdown');
67
+ }
68
+ this.lastPublication = undefined;
69
+ }
70
+ reconcile(view) {
71
+ const publication = `${view.generation}:${view.version}`;
72
+ if (publication === this.lastPublication) {
73
+ return;
74
+ }
75
+ const manifests = new Map(view.snapshot.devices.map((manifest) => [manifest.sn, manifest]));
76
+ if (manifests.size !== view.registry.size || [...manifests.keys()].some((serial) => !view.registry.has(serial))) {
77
+ throw new TypeError('HomeKit registry view does not match its complete snapshot');
78
+ }
79
+ this.snapshotMedia?.reconcile?.(manifests.keys());
80
+ const nextRepresented = new Set();
81
+ for (const [serial, device] of view.registry) {
82
+ const previousHandles = this.attachedAdapters.get(serial);
83
+ const manifest = manifests.get(serial);
84
+ const evidence = indexDeviceEvidence(manifest);
85
+ const admittedAdapters = admittedHomeKitAdapters(manifest, evidence);
86
+ const admittedKeys = new Set(admittedAdapters.map(([key]) => key));
87
+ for (const previousKey of this.activeAdapters.get(serial) ?? []) {
88
+ if (!admittedKeys.has(previousKey)) {
89
+ this.clearAdapterDiagnostics(serial, undefined, previousKey);
90
+ }
91
+ }
92
+ this.activeAdapters.set(serial, admittedKeys);
93
+ if (this.entityPreferences[serial]?.represented === false) {
94
+ this.snapshotMedia?.discard?.(serial);
95
+ this.detachHandles(previousHandles);
96
+ this.attachedAdapters.delete(serial);
97
+ this.clearRepresentationDiagnostic(serial);
98
+ continue;
99
+ }
100
+ const admittedPrimaryAdapters = admittedAdapters.filter(([, adapter]) => adapter.role === 'primary-purpose');
101
+ if (admittedPrimaryAdapters.length === 0) {
102
+ this.snapshotMedia?.discard?.(serial);
103
+ this.detachHandles(previousHandles);
104
+ this.attachedAdapters.delete(serial);
105
+ this.setRepresentationDiagnostic(serial, 'no-primary-purpose-member');
106
+ continue;
107
+ }
108
+ const uuid = this.store.generateUuid(`d1_${serial}`);
109
+ const existing = this.accessories.get(uuid);
110
+ const accessory = existing ?? this.store.createAccessory(manifest.name, uuid);
111
+ const handles = new Map();
112
+ const attachOrRetain = (key, adapter) => {
113
+ const handle = adapter.attach({
114
+ device,
115
+ evidence: evidence.members,
116
+ accessory,
117
+ hap: this.store.hap,
118
+ liveMedia: this.liveMedia,
119
+ recordingMedia: this.recordingMedia,
120
+ snapshotMedia: this.snapshotMedia,
121
+ ...(this.mediaBudget ? { mediaBudget: this.mediaBudget } : {}),
122
+ ...(this.stationLiveSessions ? { stationLiveSessions: this.stationLiveSessions } : {}),
123
+ audioEnabled: this.entityPreferences[serial]?.audio !== false,
124
+ snapshotMode: this.entityPreferences[serial]?.snapshotMode ?? 'Refresh',
125
+ availability: () => this.source.currentAvailability?.(serial),
126
+ diagnose: (diagnostic) => this.setAdapterDiagnostic(serial, key, diagnostic),
127
+ observed: (code) => this.clearAdapterDiagnostics(serial, code, key),
128
+ trace: (trace) => this.trace?.({ adapter: key, ...trace }),
129
+ persist: () => this.store.update([accessory]),
130
+ });
131
+ if (handle) {
132
+ handles.set(key, handle);
133
+ }
134
+ else {
135
+ const previous = previousHandles?.get(key);
136
+ if (previous) {
137
+ handles.set(key, previous);
138
+ }
139
+ }
140
+ return handles.has(key);
141
+ };
142
+ let primaryAvailable = false;
143
+ for (const [key, adapter] of admittedPrimaryAdapters) {
144
+ primaryAvailable = attachOrRetain(key, adapter) || primaryAvailable;
145
+ }
146
+ if (!primaryAvailable) {
147
+ this.snapshotMedia?.discard?.(serial);
148
+ this.detachReplacedHandles(previousHandles, handles);
149
+ this.attachedAdapters.set(serial, handles);
150
+ this.setRepresentationDiagnostic(serial, 'primary-adapter-unavailable');
151
+ continue;
152
+ }
153
+ accessory.updateDisplayName(manifest.name);
154
+ const accessoryContext = accessory.context;
155
+ accessoryContext.homebridgeEufy = {
156
+ version: 1,
157
+ serial,
158
+ };
159
+ for (const [key, adapter] of admittedAdapters) {
160
+ if (adapter.role === 'supplemental') {
161
+ attachOrRetain(key, adapter);
162
+ }
163
+ }
164
+ this.detachReplacedHandles(previousHandles, handles);
165
+ this.attachedAdapters.set(serial, handles);
166
+ this.accessories.set(uuid, accessory);
167
+ nextRepresented.add(serial);
168
+ this.clearRepresentationDiagnostic(serial);
169
+ if (existing) {
170
+ this.store.update([accessory]);
171
+ }
172
+ else {
173
+ this.store.register([accessory]);
174
+ }
175
+ }
176
+ for (const serial of this.representedSerials) {
177
+ if (nextRepresented.has(serial)) {
178
+ continue;
179
+ }
180
+ const uuid = this.store.generateUuid(`d1_${serial}`);
181
+ const accessory = this.accessories.get(uuid);
182
+ if (accessory) {
183
+ this.store.unregister([accessory]);
184
+ this.accessories.delete(uuid);
185
+ }
186
+ this.detachAdapters(serial);
187
+ this.activeAdapters.delete(serial);
188
+ this.clearAdapterDiagnostics(serial);
189
+ }
190
+ for (const serial of this.representationDiagnostics.keys()) {
191
+ if (!manifests.has(serial)) {
192
+ this.clearRepresentationDiagnostic(serial);
193
+ }
194
+ }
195
+ const removedDiagnosticSerials = new Set([...this.adapterDiagnostics.values()].map(({ serial }) => serial).filter((serial) => !manifests.has(serial)));
196
+ for (const serial of removedDiagnosticSerials) {
197
+ this.clearAdapterDiagnostics(serial);
198
+ }
199
+ for (const serial of this.activeAdapters.keys()) {
200
+ if (!manifests.has(serial)) {
201
+ this.activeAdapters.delete(serial);
202
+ this.detachAdapters(serial);
203
+ }
204
+ }
205
+ this.representedSerials.clear();
206
+ for (const serial of nextRepresented) {
207
+ this.representedSerials.add(serial);
208
+ }
209
+ this.lastPublication = publication;
210
+ }
211
+ observe(event) {
212
+ if (!event.deviceSn) {
213
+ return;
214
+ }
215
+ for (const [adapter, handle] of this.attachedAdapters.get(event.deviceSn) ?? []) {
216
+ const result = handle.event?.(event);
217
+ if (result) {
218
+ this.trace?.({ adapter, ...result });
219
+ }
220
+ }
221
+ }
222
+ detachAdapters(serial, reason = 'withdrawal') {
223
+ const handles = this.attachedAdapters.get(serial);
224
+ this.detachHandles(handles, reason);
225
+ this.attachedAdapters.delete(serial);
226
+ }
227
+ detachHandles(handles, reason = 'withdrawal') {
228
+ if (!handles) {
229
+ return;
230
+ }
231
+ for (const handle of handles.values()) {
232
+ handle.detach?.(reason);
233
+ }
234
+ }
235
+ detachReplacedHandles(previous, next) {
236
+ if (!previous) {
237
+ return;
238
+ }
239
+ for (const [key, handle] of previous) {
240
+ if (next.get(key) !== handle) {
241
+ handle.detach?.('replacement');
242
+ }
243
+ }
244
+ }
245
+ setRepresentationDiagnostic(serial, reason) {
246
+ if (this.representationDiagnostics.get(serial) === reason) {
247
+ return;
248
+ }
249
+ this.representationDiagnostics.set(serial, reason);
250
+ const aggregateReason = [...this.representationDiagnostics.values()].sort()[0];
251
+ this.diagnose({
252
+ code: 'recognized-device-not-represented',
253
+ active: true,
254
+ reason: aggregateReason,
255
+ }, [...this.representationDiagnostics.keys()]);
256
+ }
257
+ clearRepresentationDiagnostic(serial) {
258
+ if (!this.representationDiagnostics.delete(serial)) {
259
+ return;
260
+ }
261
+ const remainingReason = [...this.representationDiagnostics.values()].sort()[0];
262
+ this.diagnose({
263
+ code: 'recognized-device-not-represented',
264
+ active: remainingReason !== undefined,
265
+ reason: remainingReason ?? 'recovered',
266
+ }, [...this.representationDiagnostics.keys()]);
267
+ }
268
+ setAdapterDiagnostic(serial, adapter, diagnostic) {
269
+ const key = `${serial}:${adapter}:${diagnostic.code}:${diagnostic.capability}:${diagnostic.member}`;
270
+ if (diagnostic.active) {
271
+ if (this.adapterDiagnostics.get(key)?.diagnostic.reason === diagnostic.reason) {
272
+ return;
273
+ }
274
+ this.adapterDiagnostics.set(key, { serial, adapter, diagnostic });
275
+ this.publishAdapterDiagnostic(diagnostic);
276
+ return;
277
+ }
278
+ if (this.adapterDiagnostics.delete(key)) {
279
+ this.publishAdapterDiagnostic(diagnostic);
280
+ }
281
+ }
282
+ adapterDiagnosticDeviceIds(condition) {
283
+ return [
284
+ ...new Set([...this.adapterDiagnostics.values()]
285
+ .filter(({ diagnostic }) => this.sameAdapterCondition(diagnostic, condition))
286
+ .map(({ serial }) => serial)),
287
+ ];
288
+ }
289
+ sameAdapterCondition(left, right) {
290
+ return left.code === right.code && left.capability === right.capability && left.member === right.member;
291
+ }
292
+ publishAdapterDiagnostic(changed) {
293
+ const remaining = [...this.adapterDiagnostics.values()]
294
+ .map(({ diagnostic }) => diagnostic)
295
+ .filter((diagnostic) => this.sameAdapterCondition(diagnostic, changed))
296
+ .sort((left, right) => left.reason.localeCompare(right.reason))[0];
297
+ const affectedDeviceIds = this.adapterDiagnosticDeviceIds(changed);
298
+ this.diagnose({
299
+ ...(remaining ?? changed),
300
+ active: remaining !== undefined,
301
+ }, affectedDeviceIds);
302
+ }
303
+ clearAdapterDiagnostics(serial, onlyCode, onlyAdapter) {
304
+ const prefix = `${serial}:`;
305
+ const removed = new Map();
306
+ for (const [key, entry] of this.adapterDiagnostics) {
307
+ if (key.startsWith(prefix) &&
308
+ (onlyCode === undefined || entry.diagnostic.code === onlyCode) &&
309
+ (onlyAdapter === undefined || entry.adapter === onlyAdapter)) {
310
+ this.adapterDiagnostics.delete(key);
311
+ removed.set(`${entry.diagnostic.code}:${entry.diagnostic.capability}:${entry.diagnostic.member}`, entry.diagnostic);
312
+ }
313
+ }
314
+ for (const removedDiagnostic of removed.values()) {
315
+ this.publishAdapterDiagnostic({ ...removedDiagnostic, reason: 'recovered', active: false });
316
+ }
317
+ }
318
+ }
319
+ //# sourceMappingURL=reconciler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reconciler.js","sourceRoot":"","sources":["../../src/homekit/reconciler.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAgBnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,q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AAC;QACrD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACnD,IACE,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC;gBACtB,CAAC,QAAQ,KAAK,SAAS,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,KAAK,QAAQ,CAAC;gBAC9D,CAAC,WAAW,KAAK,SAAS,IAAI,KAAK,CAAC,OAAO,KAAK,WAAW,CAAC,EAC5D,CAAC;gBACD,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBACpC,OAAO,CAAC,GAAG,CACT,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,IAAI,KAAK,CAAC,UAAU,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,EACpF,KAAK,CAAC,UAAU,CACjB,CAAC;YACJ,CAAC;QACH,CAAC;QACD,KAAK,MAAM,iBAAiB,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;YACjD,IAAI,CAAC,wBAAwB,CAAC,EAAE,GAAG,iBAAiB,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QAC9F,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,23 @@
1
+ import { indexDeviceEvidence, satisfiesMemberRequirements, satisfiesProductRequirement, } from '../device/member-evidence.js';
2
+ import { ADAPTER_REGISTRY } from './adapters/registry.js';
3
+ /** Applies the closed adapter registry to one complete SDK manifest. */
4
+ export function admittedHomeKitAdapters(manifest, evidence = indexDeviceEvidence(manifest)) {
5
+ return Object.entries(ADAPTER_REGISTRY).filter(([, adapter]) => satisfiesProductRequirement(evidence.product, adapter.requiresProduct) &&
6
+ satisfiesMemberRequirements(evidence.members, adapter.requires, adapter.requiresAny));
7
+ }
8
+ /**
9
+ * Summarizes the same HomeKit admission policy used by reconciliation.
10
+ *
11
+ * `services` names the adapters that will represent this device, in the registry's own order, so an interface can
12
+ * say what the device becomes rather than only that it becomes something. Supplemental adapters are left out:
13
+ * they accompany a representation rather than being one, and every accessory carries them.
14
+ */
15
+ export function describeHomeKitRepresentation(manifest) {
16
+ const primary = admittedHomeKitAdapters(manifest).filter(([, adapter]) => adapter.role === 'primary-purpose');
17
+ return {
18
+ represented: primary.length > 0,
19
+ controllable: primary.some(([, adapter]) => adapter.coverage.some((id) => id.endsWith('.persistent-operation') || id.endsWith('.momentary-action'))),
20
+ services: primary.map(([key]) => key),
21
+ };
22
+ }
23
+ //# sourceMappingURL=representation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"representation.js","sourceRoot":"","sources":["../../src/homekit/representation.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,2BAA2B,GAE5B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI1D,wEAAwE;AACxE,MAAM,UAAU,uBAAuB,CACrC,QAAwB,EACxB,QAAQ,GAAwB,mBAAmB,CAAC,QAAQ,CAAC;IAE7D,OAAQ,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAqC,CAAC,MAAM,CACjF,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,EAAE,CACd,2BAA2B,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC;QACtE,2BAA2B,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,WAAW,CAAC,CACvF,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,6BAA6B,CAAC,QAAwB;IAKpE,MAAM,OAAO,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,iBAAiB,CAAC,CAAC;IAC9G,OAAO;QACL,WAAW,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC;QAC/B,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,EAAE,CACzC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,CACxG;QACD,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC;KACtC,CAAC;AACJ,CAAC"}
package/dist/index.js CHANGED
@@ -1,11 +1,6 @@
1
+ import { EufyPlatform } from './platform.js';
1
2
  import { PLATFORM_NAME, PLUGIN_NAME } from './settings.js';
2
- import { EufySecurityPlatform } from './platform.js';
3
- import { setHap } from './utils/utils.js';
4
- /**
5
- * This method registers the platform with Homebridge
6
- */
7
- export default (api) => {
8
- setHap(api.hap);
9
- api.registerPlatform(PLUGIN_NAME, PLATFORM_NAME, EufySecurityPlatform);
10
- };
3
+ export default function registerPlugin(api) {
4
+ api.registerPlatform(PLUGIN_NAME, PLATFORM_NAME, EufyPlatform);
5
+ }
11
6
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C;;GAEG;AACH,eAAe,CAAC,GAAQ,EAAE,EAAE;IAC1B,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChB,GAAG,CAAC,gBAAgB,CAAC,WAAW,EAAE,aAAa,EAAE,oBAAoB,CAAC,CAAC;AACzE,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAM3D,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,GAAoB;IACzD,GAAG,CAAC,gBAAgB,CAAC,WAAW,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;AACjE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src/media/contracts.ts"],"names":[],"mappings":""}
@@ -0,0 +1,208 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { chmod, mkdir, readFile, readdir, rename, rm, stat, writeFile } from 'node:fs/promises';
3
+ import { join } from 'node:path';
4
+ import { MAXIMUM_IMAGE_BYTES, isBoundedJpeg } from './snapshot.js';
5
+ const SNAPSHOT_DIRECTORY = 'snapshots';
6
+ const LIVE_PRECEDENCE_MS = 120_000;
7
+ /**
8
+ * Retains one validated source JPEG per camera in owner-only plugin storage so the last successful
9
+ * image survives restart and full Homebridge backup restoration.
10
+ *
11
+ * Files are sensitive plaintext camera images stored under an opaque SHA-256-derived name; neither
12
+ * retained provenance nor its acceptance time is persisted, so a restored image behaves as the oldest
13
+ * acceptable fallback. Filesystem failures never propagate, because losing a fallback image must not fail a
14
+ * HomeKit request or block startup.
15
+ *
16
+ * No filesystem call here is synchronous. An image is bounded at ten mebibytes and a replacement is flushed
17
+ * to disk, so doing that work on the one thread the whole plugin shares would stall live media, recording and
18
+ * motion delivery on a host whose disk concurrent adaptations are already saturating — the very moment a
19
+ * successful snapshot is most likely. Accepting an image is therefore separated from persisting it: the
20
+ * in-memory image is what this process serves and is claimed at once, and the file only carries one across a
21
+ * restart. That also means a disk that refuses the write no longer discards a good image the process holds.
22
+ */
23
+ export class PersistedLastSuccessfulImages {
24
+ onInvalid;
25
+ directory;
26
+ retained = new Map();
27
+ discardedNames = new Set();
28
+ replacements = 0;
29
+ invalidReported = false;
30
+ restoreEnabled = true;
31
+ /**
32
+ * Filesystem work runs one operation at a time, in the order it was requested.
33
+ *
34
+ * Every operation here replaces or removes a file another one may be reading, so their order is the
35
+ * correctness property: a discard that overtook the write it was meant to undo would leave the image
36
+ * behind, and two replacements landing out of order would leave the file disagreeing with what this
37
+ * process serves. Serializing also bounds what this store contributes to a saturated disk to one bounded
38
+ * image at a time.
39
+ */
40
+ lane = Promise.resolve();
41
+ constructor(storageRoot, onInvalid) {
42
+ this.onInvalid = onInvalid;
43
+ this.directory = join(storageRoot, SNAPSHOT_DIRECTORY);
44
+ }
45
+ async read(serial) {
46
+ const known = this.retained.get(serial);
47
+ if (known) {
48
+ return known.jpeg;
49
+ }
50
+ if (!this.restoreEnabled || this.discardedNames.has(this.name(serial))) {
51
+ return undefined;
52
+ }
53
+ return this.serialize(async () => {
54
+ const current = this.retained.get(serial);
55
+ if (current) {
56
+ return current.jpeg;
57
+ }
58
+ const restored = await this.restore(serial);
59
+ this.retained.set(serial, restored ? { jpeg: restored } : {});
60
+ return restored;
61
+ });
62
+ }
63
+ /** Accepts one image for this process at once, and resolves when its file has been replaced. */
64
+ async write(serial, jpeg, provenance) {
65
+ if (!isBoundedJpeg(jpeg) || !this.accepts(serial, jpeg, provenance)) {
66
+ return;
67
+ }
68
+ this.discardedNames.delete(this.name(serial));
69
+ this.retained.set(serial, { jpeg, provenance, acceptedAtMs: Date.now() });
70
+ await this.serialize(() => this.persist(serial, jpeg));
71
+ }
72
+ /** Removes one entity's persisted and process-local fallback without exposing its opaque filename. */
73
+ async discard(serial) {
74
+ this.retained.set(serial, {});
75
+ this.discardedNames.add(this.name(serial));
76
+ await this.serialize(() => this.discardPath(this.file(serial)));
77
+ }
78
+ /** Removes images not belonging to the latest complete authoritative inventory. */
79
+ async reconcile(serials) {
80
+ const retainedNames = new Set([...serials].map((serial) => this.name(serial)));
81
+ for (const serial of this.retained.keys()) {
82
+ if (!retainedNames.has(this.name(serial))) {
83
+ this.retained.set(serial, {});
84
+ }
85
+ }
86
+ await this.serialize(async () => {
87
+ let present;
88
+ try {
89
+ present = await readdir(this.directory);
90
+ }
91
+ catch {
92
+ return;
93
+ }
94
+ for (const name of present) {
95
+ if (/^[0-9a-f]{64}\.jpg$/.test(name) && !retainedNames.has(name)) {
96
+ this.discardedNames.add(name);
97
+ await this.discardPath(join(this.directory, name));
98
+ }
99
+ }
100
+ });
101
+ }
102
+ /** Removes every retained image for explicit account or plugin-data cleanup. */
103
+ async discardAll() {
104
+ this.retained.clear();
105
+ this.restoreEnabled = false;
106
+ await this.serialize(() => this.discardPath(this.directory, true));
107
+ }
108
+ /**
109
+ * A live image always replaces a retained image. A stored-only image may replace another stored-only
110
+ * image only when it differs, and may replace a live image only two minutes after that live success.
111
+ */
112
+ accepts(serial, jpeg, provenance) {
113
+ const current = this.retained.get(serial);
114
+ if (provenance === 'live') {
115
+ return true;
116
+ }
117
+ if (current?.jpeg?.equals(jpeg)) {
118
+ return false;
119
+ }
120
+ if (current?.provenance !== 'live' || current.acceptedAtMs === undefined) {
121
+ return true;
122
+ }
123
+ return Date.now() - current.acceptedAtMs >= LIVE_PRECEDENCE_MS;
124
+ }
125
+ /** Queues one filesystem operation behind whatever this store is already doing. */
126
+ serialize(work) {
127
+ const result = this.lane.then(work);
128
+ this.lane = result.catch(() => undefined);
129
+ return result;
130
+ }
131
+ async restore(serial) {
132
+ const file = this.file(serial);
133
+ try {
134
+ if ((await stat(file)).size > MAXIMUM_IMAGE_BYTES) {
135
+ this.reportInvalid();
136
+ await this.discardPath(file);
137
+ return undefined;
138
+ }
139
+ const jpeg = await readFile(file);
140
+ if (isBoundedJpeg(jpeg)) {
141
+ return jpeg;
142
+ }
143
+ this.reportInvalid();
144
+ await this.discardPath(file);
145
+ return undefined;
146
+ }
147
+ catch {
148
+ return undefined;
149
+ }
150
+ }
151
+ /** Replaces the retained file through a staged copy and a rename, so no reader ever sees a partial image. */
152
+ async persist(serial, jpeg) {
153
+ const file = this.file(serial);
154
+ const staged = `${file}.${process.pid}.${(this.replacements += 1)}.tmp`;
155
+ try {
156
+ await mkdir(this.directory, { recursive: true, mode: 0o700 });
157
+ await chmod(this.directory, 0o700);
158
+ await writeFile(staged, jpeg, { mode: 0o600, flush: true });
159
+ await rename(staged, file);
160
+ }
161
+ catch {
162
+ await this.remove(staged);
163
+ }
164
+ }
165
+ /** A file that cannot be removed is not a reason to fail startup or a snapshot request. */
166
+ async remove(file) {
167
+ try {
168
+ await rm(file, { force: true });
169
+ }
170
+ catch {
171
+ return;
172
+ }
173
+ }
174
+ /** Moves discarded data out of the readable namespace before best-effort physical removal. */
175
+ async discardPath(path, recursive = false) {
176
+ const discarded = `${path}.discarded.${process.pid}.${(this.replacements += 1)}`;
177
+ try {
178
+ await rename(path, discarded);
179
+ }
180
+ catch {
181
+ try {
182
+ await rm(path, { force: true, recursive });
183
+ }
184
+ catch { }
185
+ return;
186
+ }
187
+ try {
188
+ await rm(discarded, { force: true, recursive });
189
+ }
190
+ catch { }
191
+ }
192
+ file(serial) {
193
+ return join(this.directory, this.name(serial));
194
+ }
195
+ name(serial) {
196
+ return `${createHash('sha256').update(serial).digest('hex')}.jpg`;
197
+ }
198
+ reportInvalid() {
199
+ if (!this.invalidReported) {
200
+ this.invalidReported = true;
201
+ try {
202
+ this.onInvalid?.();
203
+ }
204
+ catch { }
205
+ }
206
+ }
207
+ }
208
+ //# sourceMappingURL=last-successful-image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"last-successful-image.js","sourceRoot":"","sources":["../../src/media/last-successful-image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,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