matter-all-in-one-addon 1.8.21

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 (244) hide show
  1. package/README.md +183 -0
  2. package/dist/camera/ai/camera-ai-detector.d.ts +44 -0
  3. package/dist/camera/ai/camera-ai-detector.js +329 -0
  4. package/dist/camera/ai/camera-ai-detector.js.map +1 -0
  5. package/dist/camera/camera-capabilities.d.ts +13 -0
  6. package/dist/camera/camera-capabilities.js +186 -0
  7. package/dist/camera/camera-capabilities.js.map +1 -0
  8. package/dist/camera/camera-source-resolver.d.ts +18 -0
  9. package/dist/camera/camera-source-resolver.js +187 -0
  10. package/dist/camera/camera-source-resolver.js.map +1 -0
  11. package/dist/camera/camera-types.d.ts +124 -0
  12. package/dist/camera/camera-types.js +8 -0
  13. package/dist/camera/camera-types.js.map +1 -0
  14. package/dist/camera/cameraui/cameraui-client.d.ts +54 -0
  15. package/dist/camera/cameraui/cameraui-client.js +698 -0
  16. package/dist/camera/cameraui/cameraui-client.js.map +1 -0
  17. package/dist/camera/cameraui/cameraui-homekit-bridge.d.ts +21 -0
  18. package/dist/camera/cameraui/cameraui-homekit-bridge.js +343 -0
  19. package/dist/camera/cameraui/cameraui-homekit-bridge.js.map +1 -0
  20. package/dist/camera/cameraui/cameraui-storage.d.ts +17 -0
  21. package/dist/camera/cameraui/cameraui-storage.js +916 -0
  22. package/dist/camera/cameraui/cameraui-storage.js.map +1 -0
  23. package/dist/camera/cameraui/cameraui-types.d.ts +89 -0
  24. package/dist/camera/cameraui/cameraui-types.js +5 -0
  25. package/dist/camera/cameraui/cameraui-types.js.map +1 -0
  26. package/dist/camera/homekit/ffmpeg-helper.d.ts +88 -0
  27. package/dist/camera/homekit/ffmpeg-helper.js +673 -0
  28. package/dist/camera/homekit/ffmpeg-helper.js.map +1 -0
  29. package/dist/camera/homekit/fmp4-parser.d.ts +48 -0
  30. package/dist/camera/homekit/fmp4-parser.js +156 -0
  31. package/dist/camera/homekit/fmp4-parser.js.map +1 -0
  32. package/dist/camera/homekit/hevc-eligibility.d.ts +16 -0
  33. package/dist/camera/homekit/hevc-eligibility.js +153 -0
  34. package/dist/camera/homekit/hevc-eligibility.js.map +1 -0
  35. package/dist/camera/homekit/homekit-camera-recording.delegate.d.ts +73 -0
  36. package/dist/camera/homekit/homekit-camera-recording.delegate.js +445 -0
  37. package/dist/camera/homekit/homekit-camera-recording.delegate.js.map +1 -0
  38. package/dist/camera/homekit/homekit-camera-stream.delegate.d.ts +47 -0
  39. package/dist/camera/homekit/homekit-camera-stream.delegate.js +833 -0
  40. package/dist/camera/homekit/homekit-camera-stream.delegate.js.map +1 -0
  41. package/dist/camera/homekit/homekit-camera.accessory.d.ts +53 -0
  42. package/dist/camera/homekit/homekit-camera.accessory.js +697 -0
  43. package/dist/camera/homekit/homekit-camera.accessory.js.map +1 -0
  44. package/dist/camera/matter/camera-endpoint.builder.d.ts +7 -0
  45. package/dist/camera/matter/camera-endpoint.builder.js +127 -0
  46. package/dist/camera/matter/camera-endpoint.builder.js.map +1 -0
  47. package/dist/camera/matter/camera-session-manager.d.ts +46 -0
  48. package/dist/camera/matter/camera-session-manager.js +120 -0
  49. package/dist/camera/matter/camera-session-manager.js.map +1 -0
  50. package/dist/camera/matter/camera-webrtc-adapter.d.ts +62 -0
  51. package/dist/camera/matter/camera-webrtc-adapter.js +298 -0
  52. package/dist/camera/matter/camera-webrtc-adapter.js.map +1 -0
  53. package/dist/camera/motion/ffmpeg-motion-detector.d.ts +46 -0
  54. package/dist/camera/motion/ffmpeg-motion-detector.js +200 -0
  55. package/dist/camera/motion/ffmpeg-motion-detector.js.map +1 -0
  56. package/dist/camera/nest/nest-camera-adapter.d.ts +38 -0
  57. package/dist/camera/nest/nest-camera-adapter.js +109 -0
  58. package/dist/camera/nest/nest-camera-adapter.js.map +1 -0
  59. package/dist/camera/scrypted/scrypted-camera-card.d.ts +39 -0
  60. package/dist/camera/scrypted/scrypted-camera-card.js +38 -0
  61. package/dist/camera/scrypted/scrypted-camera-card.js.map +1 -0
  62. package/dist/camera/scrypted/scrypted-camera-detail.d.ts +33 -0
  63. package/dist/camera/scrypted/scrypted-camera-detail.js +34 -0
  64. package/dist/camera/scrypted/scrypted-camera-detail.js.map +1 -0
  65. package/dist/camera/scrypted/scrypted-camera-discovery-adapter.d.ts +17 -0
  66. package/dist/camera/scrypted/scrypted-camera-discovery-adapter.js +24 -0
  67. package/dist/camera/scrypted/scrypted-camera-discovery-adapter.js.map +1 -0
  68. package/dist/camera/scrypted/scrypted-camera-normalizer.d.ts +44 -0
  69. package/dist/camera/scrypted/scrypted-camera-normalizer.js +44 -0
  70. package/dist/camera/scrypted/scrypted-camera-normalizer.js.map +1 -0
  71. package/dist/camera/scrypted/scrypted-camera-policy.d.ts +11 -0
  72. package/dist/camera/scrypted/scrypted-camera-policy.js +13 -0
  73. package/dist/camera/scrypted/scrypted-camera-policy.js.map +1 -0
  74. package/dist/camera/scrypted/scrypted-camera-presentation.d.ts +13 -0
  75. package/dist/camera/scrypted/scrypted-camera-presentation.js +23 -0
  76. package/dist/camera/scrypted/scrypted-camera-presentation.js.map +1 -0
  77. package/dist/camera/scrypted/scrypted-client-discovery-adapter.d.ts +6 -0
  78. package/dist/camera/scrypted/scrypted-client-discovery-adapter.js +12 -0
  79. package/dist/camera/scrypted/scrypted-client-discovery-adapter.js.map +1 -0
  80. package/dist/camera/scrypted/scrypted-client.d.ts +152 -0
  81. package/dist/camera/scrypted/scrypted-client.js +1170 -0
  82. package/dist/camera/scrypted/scrypted-client.js.map +1 -0
  83. package/dist/camera/scrypted/scrypted-crypto.d.ts +21 -0
  84. package/dist/camera/scrypted/scrypted-crypto.js +90 -0
  85. package/dist/camera/scrypted/scrypted-crypto.js.map +1 -0
  86. package/dist/camera/scrypted/scrypted-discovery-provider.d.ts +9 -0
  87. package/dist/camera/scrypted/scrypted-discovery-provider.js +25 -0
  88. package/dist/camera/scrypted/scrypted-discovery-provider.js.map +1 -0
  89. package/dist/camera/scrypted/scrypted-homekit-bridge.d.ts +12 -0
  90. package/dist/camera/scrypted/scrypted-homekit-bridge.js +214 -0
  91. package/dist/camera/scrypted/scrypted-homekit-bridge.js.map +1 -0
  92. package/dist/camera/scrypted/scrypted-matter-bridge.d.ts +36 -0
  93. package/dist/camera/scrypted/scrypted-matter-bridge.js +226 -0
  94. package/dist/camera/scrypted/scrypted-matter-bridge.js.map +1 -0
  95. package/dist/camera/scrypted/scrypted-reconnect-manager.d.ts +40 -0
  96. package/dist/camera/scrypted/scrypted-reconnect-manager.js +353 -0
  97. package/dist/camera/scrypted/scrypted-reconnect-manager.js.map +1 -0
  98. package/dist/camera/scrypted/scrypted-runtime-connector.d.ts +7 -0
  99. package/dist/camera/scrypted/scrypted-runtime-connector.js +17 -0
  100. package/dist/camera/scrypted/scrypted-runtime-connector.js.map +1 -0
  101. package/dist/camera/scrypted/scrypted-runtime-facade.d.ts +13 -0
  102. package/dist/camera/scrypted/scrypted-runtime-facade.js +29 -0
  103. package/dist/camera/scrypted/scrypted-runtime-facade.js.map +1 -0
  104. package/dist/camera/scrypted/scrypted-runtime-ingest.d.ts +5 -0
  105. package/dist/camera/scrypted/scrypted-runtime-ingest.js +54 -0
  106. package/dist/camera/scrypted/scrypted-runtime-ingest.js.map +1 -0
  107. package/dist/camera/scrypted/scrypted-storage.d.ts +95 -0
  108. package/dist/camera/scrypted/scrypted-storage.js +698 -0
  109. package/dist/camera/scrypted/scrypted-storage.js.map +1 -0
  110. package/dist/camera/scrypted/scrypted-stream-validator.d.ts +46 -0
  111. package/dist/camera/scrypted/scrypted-stream-validator.js +412 -0
  112. package/dist/camera/scrypted/scrypted-stream-validator.js.map +1 -0
  113. package/dist/camera/scrypted/scrypted-types.d.ts +354 -0
  114. package/dist/camera/scrypted/scrypted-types.js +6 -0
  115. package/dist/camera/scrypted/scrypted-types.js.map +1 -0
  116. package/dist/converters/binary_sensor.converter.d.ts +18 -0
  117. package/dist/converters/binary_sensor.converter.js +21 -0
  118. package/dist/converters/binary_sensor.converter.js.map +1 -0
  119. package/dist/converters/camera.converter.d.ts +18 -0
  120. package/dist/converters/camera.converter.js +24 -0
  121. package/dist/converters/camera.converter.js.map +1 -0
  122. package/dist/converters/climate.converter.d.ts +21 -0
  123. package/dist/converters/climate.converter.js +55 -0
  124. package/dist/converters/climate.converter.js.map +1 -0
  125. package/dist/converters/cover.converter.d.ts +14 -0
  126. package/dist/converters/cover.converter.js +22 -0
  127. package/dist/converters/cover.converter.js.map +1 -0
  128. package/dist/converters/energy_tariff.converter.d.ts +10 -0
  129. package/dist/converters/energy_tariff.converter.js +12 -0
  130. package/dist/converters/energy_tariff.converter.js.map +1 -0
  131. package/dist/converters/fan.converter.d.ts +233 -0
  132. package/dist/converters/fan.converter.js +353 -0
  133. package/dist/converters/fan.converter.js.map +1 -0
  134. package/dist/converters/index.d.ts +14 -0
  135. package/dist/converters/index.js +15 -0
  136. package/dist/converters/index.js.map +1 -0
  137. package/dist/converters/light.converter.d.ts +26 -0
  138. package/dist/converters/light.converter.js +36 -0
  139. package/dist/converters/light.converter.js.map +1 -0
  140. package/dist/converters/lock.converter.d.ts +20 -0
  141. package/dist/converters/lock.converter.js +29 -0
  142. package/dist/converters/lock.converter.js.map +1 -0
  143. package/dist/converters/sensor.converter.d.ts +18 -0
  144. package/dist/converters/sensor.converter.js +33 -0
  145. package/dist/converters/sensor.converter.js.map +1 -0
  146. package/dist/converters/soil_sensor.converter.d.ts +14 -0
  147. package/dist/converters/soil_sensor.converter.js +21 -0
  148. package/dist/converters/soil_sensor.converter.js.map +1 -0
  149. package/dist/converters/vacuum.converter.d.ts +168 -0
  150. package/dist/converters/vacuum.converter.js +288 -0
  151. package/dist/converters/vacuum.converter.js.map +1 -0
  152. package/dist/device-profiles.d.ts +14 -0
  153. package/dist/device-profiles.js +245 -0
  154. package/dist/device-profiles.js.map +1 -0
  155. package/dist/device-registry.d.ts +58 -0
  156. package/dist/device-registry.js +288 -0
  157. package/dist/device-registry.js.map +1 -0
  158. package/dist/entities/base.entity.d.ts +40 -0
  159. package/dist/entities/base.entity.js +826 -0
  160. package/dist/entities/base.entity.js.map +1 -0
  161. package/dist/entities/camera.entity.d.ts +48 -0
  162. package/dist/entities/camera.entity.js +127 -0
  163. package/dist/entities/camera.entity.js.map +1 -0
  164. package/dist/entities/closure.entity.d.ts +9 -0
  165. package/dist/entities/closure.entity.js +52 -0
  166. package/dist/entities/closure.entity.js.map +1 -0
  167. package/dist/entities/composite-device.entity.d.ts +61 -0
  168. package/dist/entities/composite-device.entity.js +986 -0
  169. package/dist/entities/composite-device.entity.js.map +1 -0
  170. package/dist/entities/cooktop.entity.d.ts +20 -0
  171. package/dist/entities/cooktop.entity.js +59 -0
  172. package/dist/entities/cooktop.entity.js.map +1 -0
  173. package/dist/entities/energy_tariff.entity.d.ts +7 -0
  174. package/dist/entities/energy_tariff.entity.js +32 -0
  175. package/dist/entities/energy_tariff.entity.js.map +1 -0
  176. package/dist/entities/humidifier.entity.d.ts +27 -0
  177. package/dist/entities/humidifier.entity.js +187 -0
  178. package/dist/entities/humidifier.entity.js.map +1 -0
  179. package/dist/entities/lock.entity.d.ts +12 -0
  180. package/dist/entities/lock.entity.js +58 -0
  181. package/dist/entities/lock.entity.js.map +1 -0
  182. package/dist/entities/media-player.entity.d.ts +13 -0
  183. package/dist/entities/media-player.entity.js +52 -0
  184. package/dist/entities/media-player.entity.js.map +1 -0
  185. package/dist/entities/oven.entity.d.ts +20 -0
  186. package/dist/entities/oven.entity.js +112 -0
  187. package/dist/entities/oven.entity.js.map +1 -0
  188. package/dist/entities/pet_feeder.entity.d.ts +28 -0
  189. package/dist/entities/pet_feeder.entity.js +67 -0
  190. package/dist/entities/pet_feeder.entity.js.map +1 -0
  191. package/dist/entities/soil_sensor.entity.d.ts +7 -0
  192. package/dist/entities/soil_sensor.entity.js +40 -0
  193. package/dist/entities/soil_sensor.entity.js.map +1 -0
  194. package/dist/entities/vacuum.entity.d.ts +37 -0
  195. package/dist/entities/vacuum.entity.js +352 -0
  196. package/dist/entities/vacuum.entity.js.map +1 -0
  197. package/dist/frontend/assets/index-DPXu3al2.js +26 -0
  198. package/dist/frontend/assets/index-DalMl4eS.css +1 -0
  199. package/dist/frontend/assets/logo-B_gEBugV.png +0 -0
  200. package/dist/frontend/index.html +14 -0
  201. package/dist/frontend/logo.png +0 -0
  202. package/dist/homeAssistant.d.ts +1268 -0
  203. package/dist/homeAssistant.js +1623 -0
  204. package/dist/homeAssistant.js.map +1 -0
  205. package/dist/homekit.compat.d.ts +40 -0
  206. package/dist/homekit.compat.js +43 -0
  207. package/dist/homekit.compat.js.map +1 -0
  208. package/dist/index.d.ts +7 -0
  209. package/dist/index.js +31 -0
  210. package/dist/index.js.map +1 -0
  211. package/dist/mqtt/mqtt-client.d.ts +33 -0
  212. package/dist/mqtt/mqtt-client.js +138 -0
  213. package/dist/mqtt/mqtt-client.js.map +1 -0
  214. package/dist/mqtt/mqtt.entity.d.ts +30 -0
  215. package/dist/mqtt/mqtt.entity.js +286 -0
  216. package/dist/mqtt/mqtt.entity.js.map +1 -0
  217. package/dist/platform.d.ts +318 -0
  218. package/dist/platform.js +6144 -0
  219. package/dist/platform.js.map +1 -0
  220. package/dist/proxy.d.ts +1 -0
  221. package/dist/proxy.js +226 -0
  222. package/dist/proxy.js.map +1 -0
  223. package/dist/utils/ha-discovery.d.ts +30 -0
  224. package/dist/utils/ha-discovery.js +175 -0
  225. package/dist/utils/ha-discovery.js.map +1 -0
  226. package/dist/utils/ha-state.d.ts +48 -0
  227. package/dist/utils/ha-state.js +21 -0
  228. package/dist/utils/ha-state.js.map +1 -0
  229. package/dist/utils/light-color.d.ts +63 -0
  230. package/dist/utils/light-color.js +213 -0
  231. package/dist/utils/light-color.js.map +1 -0
  232. package/dist/utils/log-buffer.d.ts +13 -0
  233. package/dist/utils/log-buffer.js +50 -0
  234. package/dist/utils/log-buffer.js.map +1 -0
  235. package/dist/utils/matter-attributes.d.ts +13 -0
  236. package/dist/utils/matter-attributes.js +35 -0
  237. package/dist/utils/matter-attributes.js.map +1 -0
  238. package/dist/utils/matter-device-identity.d.ts +22 -0
  239. package/dist/utils/matter-device-identity.js +70 -0
  240. package/dist/utils/matter-device-identity.js.map +1 -0
  241. package/dist/utils/thread-credentials.d.ts +22 -0
  242. package/dist/utils/thread-credentials.js +29 -0
  243. package/dist/utils/thread-credentials.js.map +1 -0
  244. package/package.json +80 -0
@@ -0,0 +1,916 @@
1
+ import fs from "node:fs/promises";
2
+ import path from "node:path";
3
+ const CONFIG_PATH = "/data/cameraui-config.json";
4
+ const FALLBACK_CONFIG_PATH = "./cameraui-config.json";
5
+ export function repairCameraRecord(cam) {
6
+ let modified = false;
7
+ // Strip trailing hash fragments
8
+ if (cam.rtspUrl && cam.rtspUrl.includes("#")) {
9
+ cam.rtspUrl = cam.rtspUrl.substring(0, cam.rtspUrl.indexOf("#"));
10
+ modified = true;
11
+ }
12
+ if (cam.subRtspUrl && cam.subRtspUrl.includes("#")) {
13
+ cam.subRtspUrl = cam.subRtspUrl.substring(0, cam.subRtspUrl.indexOf("#"));
14
+ modified = true;
15
+ }
16
+ if (cam.snapshotUrl && cam.snapshotUrl.includes("#")) {
17
+ cam.snapshotUrl = cam.snapshotUrl.substring(0, cam.snapshotUrl.indexOf("#"));
18
+ modified = true;
19
+ }
20
+ /*
21
+ * Camera.UI is the source of truth for RTSP URLs and probed capabilities.
22
+ * Do not infer a camera from its display name or replace its source with a
23
+ * site-specific URL here: doing so breaks newly discovered cameras and can
24
+ * remount an already paired accessory with the wrong stream.
25
+ */
26
+ /* if (name.includes("wyze") || url.includes("wyze") || url.includes("192.168.110.118")) {
27
+ if (cam.rtspUrl && cam.rtspUrl.includes("/stream1")) {
28
+ cam.rtspUrl = cam.rtspUrl.replace("/stream1", "/stream0");
29
+ modified = true;
30
+ }
31
+ const targetUrl = "rtsp://192.168.110.147:8554/wyze_patio_trasero";
32
+ if (cam.rtspUrl !== targetUrl) {
33
+ cam.rtspUrl = targetUrl;
34
+ modified = true;
35
+ }
36
+ if (!cam.width || cam.width < 1920) {
37
+ cam.width = 1920;
38
+ cam.height = 1080;
39
+ cam.fps = 30;
40
+ modified = true;
41
+ }
42
+ cam.videoCodec = "h264";
43
+ cam.strategy = "passthrough_h264";
44
+ }
45
+ // Vimtag Gym: 2560x1440 2K HEVC
46
+ else if (url.includes("vimtag_gym") || name.includes("gym")) {
47
+ const targetUrl = "rtsp://192.168.110.147:8554/vimtag_113";
48
+ if (cam.rtspUrl !== targetUrl) {
49
+ cam.rtspUrl = targetUrl;
50
+ modified = true;
51
+ }
52
+ cam.width = 2560;
53
+ cam.height = 1440;
54
+ cam.fps = 20;
55
+ cam.videoCodec = "hevc";
56
+ cam.strategy = "passthrough_hevc";
57
+ }
58
+ // Vimtag Cochera: 2560x1440 2K HEVC
59
+ else if (url.includes("cochera") || name.includes("cochera")) {
60
+ const targetUrl = "rtsp://192.168.110.147:8554/cochera";
61
+ if (cam.rtspUrl !== targetUrl) {
62
+ cam.rtspUrl = targetUrl;
63
+ modified = true;
64
+ }
65
+ cam.width = 2560;
66
+ cam.height = 1440;
67
+ cam.fps = 20;
68
+ cam.videoCodec = "hevc";
69
+ cam.strategy = "passthrough_hevc";
70
+ }
71
+ // Vimtag Oficina / Jardin: 2560x1440 2K HEVC
72
+ else if (
73
+ url.includes("jardin") ||
74
+ url.includes("vimtag_oficina") ||
75
+ name.includes("jardin") ||
76
+ (name.includes("oficina") && (name.includes("vimtag") || url.includes("vimtag")))
77
+ ) {
78
+ const targetUrl = "rtsp://192.168.110.147:8554/jardin";
79
+ if (cam.rtspUrl !== targetUrl) {
80
+ cam.rtspUrl = targetUrl;
81
+ modified = true;
82
+ }
83
+ cam.width = 2560;
84
+ cam.height = 1440;
85
+ cam.fps = 20;
86
+ cam.videoCodec = "hevc";
87
+ cam.strategy = "passthrough_hevc";
88
+ }
89
+ // Vimtag Recamara Visita: 2560x1440 2K H264
90
+ else if (url.includes("recamara") || name.includes("recamara")) {
91
+ const targetUrl = "rtsp://192.168.110.147:8554/recamara";
92
+ if (cam.rtspUrl !== targetUrl) {
93
+ cam.rtspUrl = targetUrl;
94
+ modified = true;
95
+ }
96
+ cam.width = 2560;
97
+ cam.height = 1440;
98
+ cam.fps = 20;
99
+ cam.videoCodec = "h264";
100
+ cam.strategy = "passthrough_h264";
101
+ }
102
+ // Sala Vimtag: 2560x1440 2K HEVC
103
+ else if (url.includes("sala-vimtag") || url.includes("sala_vimtag") || name.includes("sala")) {
104
+ const targetUrl = "rtsp://192.168.110.147:8554/sala-vimtag";
105
+ if (cam.rtspUrl !== targetUrl) {
106
+ cam.rtspUrl = targetUrl;
107
+ modified = true;
108
+ }
109
+ cam.width = 2560;
110
+ cam.height = 1440;
111
+ cam.fps = 20;
112
+ cam.videoCodec = "hevc";
113
+ cam.strategy = "passthrough_hevc";
114
+ }
115
+ // Cocina Ring: 1080p H264
116
+ else if (url.includes("cocina_ring") || name.includes("cocina")) {
117
+ const targetUrl = "rtsp://192.168.110.147:8554/cocina_ring";
118
+ if (cam.rtspUrl !== targetUrl) {
119
+ cam.rtspUrl = targetUrl;
120
+ modified = true;
121
+ }
122
+ cam.width = 1920;
123
+ cam.height = 1080;
124
+ cam.fps = 30;
125
+ cam.videoCodec = "h264";
126
+ cam.strategy = "passthrough_h264";
127
+ }
128
+ // Ring Bodega: 1080p H264
129
+ else if (url.includes("ring_bodega") || name.includes("bodega")) {
130
+ const targetUrl = "rtsp://192.168.110.147:8554/ring_bodega";
131
+ if (cam.rtspUrl !== targetUrl) {
132
+ cam.rtspUrl = targetUrl;
133
+ modified = true;
134
+ }
135
+ cam.width = 1920;
136
+ cam.height = 1080;
137
+ cam.fps = 30;
138
+ cam.videoCodec = "h264";
139
+ cam.strategy = "passthrough_h264";
140
+ }
141
+ // Ring Lavanderia: 1080p H264
142
+ else if (url.includes("ring_lavanderia") || name.includes("lavanderia")) {
143
+ const targetUrl = "rtsp://192.168.110.147:8554/ring_lavanderia";
144
+ if (cam.rtspUrl !== targetUrl) {
145
+ cam.rtspUrl = targetUrl;
146
+ modified = true;
147
+ }
148
+ cam.width = 1920;
149
+ cam.height = 1080;
150
+ cam.fps = 30;
151
+ cam.videoCodec = "h264";
152
+ cam.strategy = "passthrough_h264";
153
+ }
154
+ // Tapo C402: 2304x1296 2K 3MP H264
155
+ else if (url.includes("tapo-c402") || name.includes("c402")) {
156
+ const targetUrl = "rtsp://192.168.110.147:62291/tapo-c402";
157
+ if (cam.rtspUrl !== targetUrl) {
158
+ cam.rtspUrl = targetUrl;
159
+ modified = true;
160
+ }
161
+ cam.width = 2304;
162
+ cam.height = 1296;
163
+ cam.fps = 15;
164
+ cam.videoCodec = "h264";
165
+ cam.strategy = "passthrough_h264";
166
+ }
167
+ // Tapo C120 ("TAPO-SPOT"): 1080p H264 — real source via go2rtc tapo_c120 stream
168
+ else if (url.includes("tapo_c120") || name.includes("c120")) {
169
+ const targetUrl = "rtsp://192.168.110.147:8554/tapo_c120";
170
+ if (cam.rtspUrl !== targetUrl) {
171
+ cam.rtspUrl = targetUrl;
172
+ modified = true;
173
+ }
174
+ cam.width = 1920;
175
+ cam.height = 1080;
176
+ cam.fps = 30;
177
+ cam.videoCodec = "h264";
178
+ cam.strategy = "passthrough_h264";
179
+ }
180
+ // Ezviz Patio Trasero (CS-H6c): 1080p H264 — real source via go2rtc ezviz_patio_trasero stream
181
+ else if (url.includes("ezviz") || name.includes("ezviz")) {
182
+ const targetUrl = "rtsp://192.168.110.147:8554/ezviz_patio_trasero";
183
+ if (cam.rtspUrl !== targetUrl) {
184
+ cam.rtspUrl = targetUrl;
185
+ modified = true;
186
+ }
187
+ cam.width = 1920;
188
+ cam.height = 1080;
189
+ cam.fps = 30;
190
+ cam.videoCodec = "h264";
191
+ cam.strategy = "passthrough_h264";
192
+ }
193
+
194
+ // Global repair for any rtsp://192.168.110.46 references
195
+ if (
196
+ cam.rtspUrl &&
197
+ (cam.rtspUrl.includes("192.168.110.46:8554") ||
198
+ cam.rtspUrl.includes("192.168.110.46:554") ||
199
+ cam.rtspUrl.startsWith("rtsp://192.168.110.46"))
200
+ ) {
201
+ cam.rtspUrl = cam.rtspUrl
202
+ .replace("192.168.110.46:8554", "192.168.110.147:8554")
203
+ .replace("192.168.110.46:554", "192.168.110.147:8554")
204
+ .replace("rtsp://192.168.110.46/", "rtsp://192.168.110.147:8554/");
205
+ modified = true;
206
+ } */
207
+ /* if (
208
+ cam.subRtspUrl &&
209
+ (cam.subRtspUrl.includes("192.168.110.46:8554") ||
210
+ cam.subRtspUrl.includes("192.168.110.46:554") ||
211
+ cam.subRtspUrl.startsWith("rtsp://192.168.110.46"))
212
+ ) {
213
+ cam.subRtspUrl = cam.subRtspUrl
214
+ .replace("192.168.110.46:8554", "192.168.110.147:8554")
215
+ .replace("192.168.110.46:554", "192.168.110.147:8554")
216
+ .replace("rtsp://192.168.110.46/", "rtsp://192.168.110.147:8554/");
217
+ modified = true;
218
+ } */
219
+ return { cam, modified };
220
+ }
221
+ export const DEFAULT_CAMERAS = [
222
+ {
223
+ id: "cameraui_f9922b88-19ee-4960-87d9-6edd4a139da6",
224
+ name: "COCINA RING",
225
+ manufacturer: "Ring",
226
+ model: "Indoor Cam",
227
+ serialNumber: "CUI-F9922B88-19EE-4960-87D9-6EDD4A139DA6",
228
+ rtspUrl: "rtsp://192.168.110.147:8554/cocina_ring",
229
+ snapshotUrl: "https://192.168.110.46:3543/api/cameras/COCINA%20RING/snapshot",
230
+ hasAudio: true,
231
+ width: 1920,
232
+ height: 1080,
233
+ fps: 30,
234
+ strategy: "passthrough_h264",
235
+ motionTopic: "camera.ui/cocina_ring/motion",
236
+ motionActive: false,
237
+ doorbellActive: false,
238
+ status: "online",
239
+ homeKitEnabled: true,
240
+ port: 51860,
241
+ username: "0E:09:A1:9E:4A:EE",
242
+ pincode: "031-45-154",
243
+ setupId: "B077",
244
+ uuid: "ad8e26bb-801e-42b0-a131-fb3e101c22e6",
245
+ isPaired: false,
246
+ setupUri: "X-HM://00GW95DQAB077",
247
+ videoCodec: "h264",
248
+ hasLight: false,
249
+ lightActive: false,
250
+ hasSiren: true,
251
+ sirenActive: false,
252
+ realEntities: [
253
+ {
254
+ id: "binary_sensor.omni_ai_sensors_mac_mac_persona_ring_cocina",
255
+ domain: "binary_sensor",
256
+ type: "motion",
257
+ name: "Omni AI Sensors - Mac MAC - Persona - RING- COCINA",
258
+ state: false,
259
+ matterExported: false,
260
+ },
261
+ ],
262
+ },
263
+ {
264
+ id: "cameraui_c47abc56-42a1-47d5-9c99-fafa2bba5193",
265
+ name: "JARDIN-VIMTAG",
266
+ manufacturer: "Gecko",
267
+ model: "Vimtag PTZ",
268
+ serialNumber: "CUI-C47ABC56-42A1-47D5-9C99-FAFA2BBA5193",
269
+ rtspUrl: "rtsp://192.168.110.147:8554/jardin",
270
+ snapshotUrl: "https://192.168.110.46:3543/api/cameras/JARDIN-VIMTAG/snapshot",
271
+ hasAudio: true,
272
+ width: 2560,
273
+ height: 1440,
274
+ fps: 20,
275
+ strategy: "passthrough_hevc",
276
+ motionTopic: "camera.ui/jardin/motion",
277
+ motionActive: false,
278
+ doorbellActive: false,
279
+ status: "online",
280
+ homeKitEnabled: true,
281
+ port: 51861,
282
+ username: "0E:47:C3:63:E7:EB",
283
+ pincode: "031-45-154",
284
+ setupId: "CFB1",
285
+ uuid: "bae5f86b-1d9b-4c8f-bc98-c3a76f3e440f",
286
+ isPaired: false,
287
+ setupUri: "X-HM://00GW95DQACFB1",
288
+ videoCodec: "hevc",
289
+ hasLight: false,
290
+ lightActive: false,
291
+ hasSiren: false,
292
+ sirenActive: false,
293
+ realEntities: [
294
+ {
295
+ id: "binary_sensor.omni_ai_sensors_mac_mac_persona_vimtag_jardin",
296
+ domain: "binary_sensor",
297
+ type: "motion",
298
+ name: "Omni AI Sensors - Mac MAC - Persona - VIMTAG-JARDIN",
299
+ state: false,
300
+ matterExported: false,
301
+ },
302
+ ],
303
+ },
304
+ {
305
+ id: "cameraui_3a3cb94b-ae88-4d9c-b7f0-a5280cdd7f80",
306
+ name: "RING BODEGA",
307
+ manufacturer: "Ring",
308
+ model: "Indoor Cam",
309
+ serialNumber: "CUI-3A3CB94B-AE88-4D9C-B7F0-A5280CDD7F80",
310
+ rtspUrl: "rtsp://192.168.110.147:8554/ring_bodega",
311
+ snapshotUrl: "https://192.168.110.46:3543/api/cameras/RING%20BODEGA/snapshot",
312
+ hasAudio: true,
313
+ width: 1920,
314
+ height: 1080,
315
+ fps: 30,
316
+ strategy: "passthrough_h264",
317
+ motionTopic: "camera.ui/ring_bodega/motion",
318
+ motionActive: false,
319
+ doorbellActive: false,
320
+ status: "online",
321
+ homeKitEnabled: true,
322
+ port: 51862,
323
+ username: "0E:85:B6:F1:F6:35",
324
+ pincode: "031-45-154",
325
+ setupId: "0B84",
326
+ uuid: "fb15f6e2-2dbd-4e09-a7c4-775b06a42f03",
327
+ isPaired: false,
328
+ setupUri: "X-HM://00GW95DQA0B84",
329
+ videoCodec: "h264",
330
+ hasLight: false,
331
+ lightActive: false,
332
+ hasSiren: false,
333
+ sirenActive: false,
334
+ realEntities: [
335
+ {
336
+ id: "binary_sensor.omni_ai_sensors_mac_mac_persona_petcam_ring",
337
+ domain: "binary_sensor",
338
+ type: "motion",
339
+ name: "Omni AI Sensors - Mac MAC - Persona - PETCAM - RING",
340
+ state: false,
341
+ matterExported: false,
342
+ },
343
+ ],
344
+ },
345
+ {
346
+ id: "cameraui_5019a1a4-d6e7-4e2c-b2ff-989d60219540",
347
+ name: "RING LAVANDERIA",
348
+ manufacturer: "Ring",
349
+ model: "Indoor Cam",
350
+ serialNumber: "CUI-5019A1A4-D6E7-4E2C-B2FF-989D60219540",
351
+ rtspUrl: "rtsp://192.168.110.147:8554/ring_lavanderia",
352
+ snapshotUrl: "https://192.168.110.46:3543/api/cameras/RING%20LAVANDERIA/snapshot",
353
+ hasAudio: true,
354
+ width: 1920,
355
+ height: 1080,
356
+ fps: 30,
357
+ strategy: "passthrough_h264",
358
+ motionTopic: "camera.ui/ring_lavanderia/motion",
359
+ motionActive: false,
360
+ doorbellActive: false,
361
+ status: "online",
362
+ homeKitEnabled: true,
363
+ port: 51863,
364
+ username: "0E:7E:3D:39:C8:BB",
365
+ pincode: "031-45-154",
366
+ setupId: "C02A",
367
+ uuid: "62f21e90-0201-441b-aff2-f984a2bc5f26",
368
+ isPaired: false,
369
+ setupUri: "X-HM://00GW95DQAC02A",
370
+ videoCodec: "h264",
371
+ hasLight: false,
372
+ lightActive: false,
373
+ hasSiren: false,
374
+ sirenActive: false,
375
+ realEntities: [
376
+ {
377
+ id: "binary_sensor.omni_ai_sensors_mac_mac_persona_ring_lavanderia",
378
+ domain: "binary_sensor",
379
+ type: "motion",
380
+ name: "Omni AI Sensors - Mac MAC - Persona - RING - LAVANDERIA",
381
+ state: false,
382
+ matterExported: false,
383
+ },
384
+ ],
385
+ },
386
+ {
387
+ id: "cameraui_af880e8a-1ef3-4545-a0c8-9877d8bca4f3",
388
+ name: "SALA-VIMTAG",
389
+ manufacturer: "Gecko",
390
+ model: "VIMTAG PTZ",
391
+ serialNumber: "CUI-AF880E8A-1EF3-4545-A0C8-9877D8BCA4F3",
392
+ rtspUrl: "rtsp://192.168.110.147:8554/sala-vimtag",
393
+ snapshotUrl: "https://192.168.110.46:3543/api/cameras/SALA-VIMTAG/snapshot",
394
+ hasAudio: true,
395
+ width: 2560,
396
+ height: 1440,
397
+ fps: 20,
398
+ strategy: "passthrough_hevc",
399
+ motionTopic: "camera.ui/sala-vimtag/motion",
400
+ motionActive: false,
401
+ doorbellActive: false,
402
+ status: "online",
403
+ homeKitEnabled: true,
404
+ port: 51864,
405
+ username: "0E:4C:56:68:9C:8C",
406
+ pincode: "031-45-154",
407
+ setupId: "844A",
408
+ uuid: "b84c437e-4114-4dcb-a1ee-3cf6bb62bd80",
409
+ isPaired: false,
410
+ setupUri: "X-HM://00GW95DQA844A",
411
+ videoCodec: "hevc",
412
+ hasLight: false,
413
+ lightActive: false,
414
+ hasSiren: false,
415
+ sirenActive: false,
416
+ realEntities: [
417
+ {
418
+ id: "binary_sensor.omni_ai_sensors_mac_mac_persona_vimtag_sala",
419
+ domain: "binary_sensor",
420
+ type: "motion",
421
+ name: "Omni AI Sensors - Mac MAC - Persona - VIMTAG-SALA",
422
+ state: false,
423
+ matterExported: false,
424
+ },
425
+ ],
426
+ },
427
+ {
428
+ id: "cameraui_4661fae4-808d-436c-96db-15be59e01d6b",
429
+ name: "EZVIZ PATIO TRASERO",
430
+ manufacturer: "EZVIZ",
431
+ model: "CS-H6c",
432
+ serialNumber: "CUI-4661FAE4-808D-436C-96DB-15BE59E01D6B",
433
+ rtspUrl: "rtsp://192.168.110.147:8554/ezviz_patio_trasero",
434
+ snapshotUrl: "https://192.168.110.46:3543/api/cameras/EZVIZ%20PATIO%20TRASERO/snapshot",
435
+ hasAudio: true,
436
+ width: 1920,
437
+ height: 1080,
438
+ fps: 30,
439
+ strategy: "passthrough_h264",
440
+ motionTopic: "camera.ui/ezviz_patio_trasero/motion",
441
+ motionActive: false,
442
+ doorbellActive: false,
443
+ status: "online",
444
+ homeKitEnabled: true,
445
+ port: 51865,
446
+ username: "0E:B4:BB:D1:9E:B2",
447
+ pincode: "031-45-154",
448
+ setupId: "908F",
449
+ uuid: "0c60e532-18c5-435f-bc10-29dff6192bcd",
450
+ setupUri: "X-HM://00GW95DQA908F",
451
+ isPaired: false,
452
+ videoCodec: "h264",
453
+ hasLight: false,
454
+ lightActive: false,
455
+ hasSiren: false,
456
+ sirenActive: false,
457
+ realEntities: [
458
+ {
459
+ id: "binary_sensor.omni_ai_sensors_mac_mac_persona_cs_h6c_r105_1l2wf",
460
+ domain: "binary_sensor",
461
+ type: "motion",
462
+ name: "Omni AI Sensors - Mac MAC - Persona - CS-H6c-R105-1L2WF",
463
+ state: false,
464
+ matterExported: false,
465
+ },
466
+ ],
467
+ },
468
+ {
469
+ id: "cameraui_ec110a11-ed20-44f7-8468-2bd8c7dce18f",
470
+ name: "Tapo C120",
471
+ manufacturer: "Tapo",
472
+ model: "C120",
473
+ serialNumber: "CUI-EC110A11-ED20-44F7-8468-2BD8C7DCE18F",
474
+ rtspUrl: "rtsp://192.168.110.147:8554/tapo_c120",
475
+ snapshotUrl: "https://192.168.110.46:3543/api/cameras/Tapo%20C120/snapshot",
476
+ hasAudio: true,
477
+ width: 1920,
478
+ height: 1080,
479
+ fps: 30,
480
+ strategy: "passthrough_h264",
481
+ motionTopic: "camera.ui/tapo_c120/motion",
482
+ motionActive: false,
483
+ doorbellActive: false,
484
+ status: "online",
485
+ homeKitEnabled: true,
486
+ port: 51866,
487
+ username: "0E:46:2B:5B:AE:15",
488
+ pincode: "031-45-154",
489
+ setupId: "7AEB",
490
+ uuid: "32245495-a08f-4ea5-aa5f-1b70f75f9088",
491
+ setupUri: "X-HM://00GW95DQA7AEB",
492
+ isPaired: false,
493
+ videoCodec: "h264",
494
+ hasLight: false,
495
+ lightActive: false,
496
+ hasSiren: false,
497
+ sirenActive: false,
498
+ realEntities: [
499
+ {
500
+ id: "binary_sensor.omni_ai_sensors_mac_mac_persona_tapo_spot",
501
+ domain: "binary_sensor",
502
+ type: "motion",
503
+ name: "Omni AI Sensors - Mac MAC - Persona - TAPO-SPOT",
504
+ state: false,
505
+ matterExported: false,
506
+ },
507
+ ],
508
+ },
509
+ {
510
+ id: "cameraui_ffd37848-ae95-403b-87f5-3fff4afe8334",
511
+ name: "VIMTAG COCHERA",
512
+ manufacturer: "Gecko",
513
+ model: "VIMTAG PTZ",
514
+ serialNumber: "CUI-FFD37848-AE95-403B-87F5-3FFF4AFE8334",
515
+ rtspUrl: "rtsp://192.168.110.147:8554/cochera",
516
+ snapshotUrl: "https://192.168.110.46:3543/api/cameras/VIMTAG%20COCHERA/snapshot",
517
+ hasAudio: true,
518
+ width: 2560,
519
+ height: 1440,
520
+ fps: 20,
521
+ strategy: "passthrough_hevc",
522
+ motionTopic: "camera.ui/cochera/motion",
523
+ motionActive: false,
524
+ doorbellActive: false,
525
+ status: "online",
526
+ homeKitEnabled: true,
527
+ port: 51867,
528
+ username: "0E:E3:71:E4:0C:BC",
529
+ pincode: "031-45-154",
530
+ setupId: "329D",
531
+ uuid: "b0e2da7e-1b75-4320-abe4-18c4161d7e25",
532
+ setupUri: "X-HM://00GW95DQA329D",
533
+ isPaired: false,
534
+ videoCodec: "hevc",
535
+ hasLight: false,
536
+ lightActive: false,
537
+ hasSiren: false,
538
+ sirenActive: false,
539
+ realEntities: [
540
+ {
541
+ id: "binary_sensor.omni_ai_sensors_mac_mac_persona_vimtag_cochera",
542
+ domain: "binary_sensor",
543
+ type: "motion",
544
+ name: "Omni AI Sensors - Mac MAC - Persona - VIMTAG-COCHERA",
545
+ state: false,
546
+ matterExported: false,
547
+ },
548
+ ],
549
+ },
550
+ {
551
+ id: "cameraui_25237d2a-48ae-4f77-9cb9-c26608d58128",
552
+ name: "VIMTAG GYM",
553
+ manufacturer: "Gecko",
554
+ model: "VIMTAG PTZ",
555
+ serialNumber: "CUI-25237D2A-48AE-4F77-9CB9-C26608D58128",
556
+ rtspUrl: "rtsp://192.168.110.147:8554/vimtag_113",
557
+ snapshotUrl: "https://192.168.110.46:3543/api/cameras/VIMTAG%20GYM/snapshot",
558
+ hasAudio: true,
559
+ width: 2560,
560
+ height: 1440,
561
+ fps: 20,
562
+ strategy: "passthrough_hevc",
563
+ motionTopic: "camera.ui/vimtag_gym/motion",
564
+ motionActive: false,
565
+ doorbellActive: false,
566
+ status: "online",
567
+ homeKitEnabled: true,
568
+ port: 51868,
569
+ username: "0E:67:12:EE:D9:44",
570
+ pincode: "031-45-154",
571
+ setupId: "9E3E",
572
+ uuid: "404d660f-6802-400d-8509-2032a713fbb4",
573
+ setupUri: "X-HM://00GW95DQA9E3E",
574
+ isPaired: false,
575
+ videoCodec: "hevc",
576
+ hasLight: false,
577
+ lightActive: false,
578
+ hasSiren: false,
579
+ sirenActive: false,
580
+ realEntities: [
581
+ {
582
+ id: "binary_sensor.omni_ai_sensors_mac_mac_persona_ring_gym",
583
+ domain: "binary_sensor",
584
+ type: "motion",
585
+ name: "Omni AI Sensors - Mac MAC - Persona - RING - GYM",
586
+ state: false,
587
+ matterExported: false,
588
+ },
589
+ ],
590
+ },
591
+ {
592
+ id: "cameraui_c0abed4c-0a46-4331-b480-32aa614973f8",
593
+ name: "VIMTAG OFICINA",
594
+ manufacturer: "Gecko",
595
+ model: "VIMTAG PTZ",
596
+ serialNumber: "CUI-C0ABED4C-0A46-4331-B480-32AA614973F8",
597
+ rtspUrl: "rtsp://192.168.110.147:8554/jardin",
598
+ snapshotUrl: "https://192.168.110.46:3543/api/cameras/VIMTAG%20OFICINA/snapshot",
599
+ hasAudio: true,
600
+ width: 2560,
601
+ height: 1440,
602
+ fps: 20,
603
+ strategy: "passthrough_hevc",
604
+ motionTopic: "camera.ui/vimtag_oficina/motion",
605
+ motionActive: false,
606
+ doorbellActive: false,
607
+ status: "online",
608
+ homeKitEnabled: true,
609
+ port: 51869,
610
+ username: "0E:49:34:3D:88:95",
611
+ pincode: "031-45-154",
612
+ setupId: "8C33",
613
+ uuid: "16bbb9b8-8934-4003-837d-a0f67a6893cb",
614
+ setupUri: "X-HM://00GW95DQA8C33",
615
+ isPaired: false,
616
+ videoCodec: "hevc",
617
+ hasLight: false,
618
+ lightActive: false,
619
+ hasSiren: false,
620
+ sirenActive: false,
621
+ realEntities: [
622
+ {
623
+ id: "binary_sensor.omni_ai_sensors_mac_mac_persona_vimtag_oficina",
624
+ domain: "binary_sensor",
625
+ type: "motion",
626
+ name: "Omni AI Sensors - Mac MAC - Persona - VIMTAG-OFICINA",
627
+ state: false,
628
+ matterExported: false,
629
+ },
630
+ ],
631
+ },
632
+ {
633
+ id: "cameraui_5715a9d4-fc49-4417-b477-c3159472ca29",
634
+ name: "VIMTAG RECAMARA VISITA",
635
+ manufacturer: "Gecko",
636
+ model: "VIMTAG RECAMARA PRINCIPAL",
637
+ serialNumber: "CUI-5715A9D4-FC49-4417-B477-C3159472CA29",
638
+ rtspUrl: "rtsp://192.168.110.147:8554/recamara",
639
+ snapshotUrl: "https://192.168.110.46:3543/api/cameras/VIMTAG%20RECAMARA%20VISITA/snapshot",
640
+ hasAudio: true,
641
+ width: 1920,
642
+ height: 1080,
643
+ fps: 30,
644
+ strategy: "passthrough_h264",
645
+ motionTopic: "camera.ui/vimtag_recamara_visita/motion",
646
+ motionActive: false,
647
+ doorbellActive: false,
648
+ status: "online",
649
+ homeKitEnabled: true,
650
+ port: 51870,
651
+ username: "0E:FA:67:62:4D:7A",
652
+ pincode: "031-45-154",
653
+ setupId: "63CA",
654
+ uuid: "a30d999e-272d-4523-8527-4267360fb7a4",
655
+ setupUri: "X-HM://00GW95DQA63CA",
656
+ isPaired: false,
657
+ videoCodec: "h264",
658
+ hasLight: false,
659
+ lightActive: false,
660
+ hasSiren: false,
661
+ sirenActive: false,
662
+ realEntities: [],
663
+ },
664
+ {
665
+ id: "cameraui_cba17b87-e6c0-4cc9-b6ab-e88b8cbc7cb4",
666
+ name: "WYZE PATIO TRASERO",
667
+ manufacturer: "WYZE",
668
+ model: "PAN V2",
669
+ serialNumber: "CUI-CBA17B87-E6C0-4CC9-B6AB-E88B8CBC7CB4",
670
+ rtspUrl: "rtsp://192.168.110.147:8554/wyze_patio_trasero",
671
+ snapshotUrl: "https://192.168.110.46:3543/api/cameras/WYZE%20PATIO%20TRASERO/snapshot",
672
+ hasAudio: true,
673
+ width: 1920,
674
+ height: 1080,
675
+ fps: 30,
676
+ videoCodec: "h264",
677
+ strategy: "passthrough_h264",
678
+ motionTopic: "camera.ui/wyze_patio_trasero/motion",
679
+ motionActive: false,
680
+ doorbellActive: false,
681
+ status: "online",
682
+ homeKitEnabled: true,
683
+ port: 51871,
684
+ username: "0E:25:EE:62:67:44",
685
+ pincode: "031-45-154",
686
+ setupId: "1D84",
687
+ uuid: "77232f84-74ad-4312-bed6-389fe9b50404",
688
+ setupUri: "X-HM://00GW95DQA1D84",
689
+ isPaired: true,
690
+ hasLight: false,
691
+ lightActive: false,
692
+ hasSiren: false,
693
+ sirenActive: false,
694
+ realEntities: [
695
+ {
696
+ id: "binary_sensor.omni_ai_sensors_mac_mac_persona_wyze_patio_trasero",
697
+ domain: "binary_sensor",
698
+ type: "motion",
699
+ name: "Omni AI Sensors - Mac MAC - Persona - WYZE - PATIO TRASERO",
700
+ state: false,
701
+ matterExported: false,
702
+ },
703
+ ],
704
+ },
705
+ {
706
+ id: "cameraui_5199854c-2694-4d69-bcc4-5cc6651fad0c",
707
+ name: "TAPO C402",
708
+ manufacturer: "Gecko",
709
+ model: "Tapo C402",
710
+ serialNumber: "CUI-5199854C-2694-4D69-BCC4-5CC6651FAD0C",
711
+ rtspUrl: "rtsp://192.168.110.147:62291/tapo-c402",
712
+ snapshotUrl: "https://192.168.110.46:3543/api/cameras/TAPO%20C402/snapshot",
713
+ hasAudio: true,
714
+ width: 2304,
715
+ height: 1296,
716
+ fps: 15,
717
+ videoCodec: "h264",
718
+ strategy: "passthrough_h264",
719
+ motionTopic: "camera.ui/tapo_c402/motion",
720
+ motionActive: false,
721
+ doorbellActive: false,
722
+ status: "online",
723
+ homeKitEnabled: true,
724
+ port: 51872,
725
+ pincode: "031-45-154",
726
+ username: "0E:25:DD:6E:A7:AE",
727
+ setupId: "6560",
728
+ uuid: "b49ac6ab-d692-490d-bd0b-370d0da964b1",
729
+ setupUri: "X-HM://00GW95DQA6560",
730
+ isPaired: true,
731
+ hasLight: false,
732
+ lightActive: false,
733
+ hasSiren: false,
734
+ sirenActive: false,
735
+ realEntities: [
736
+ {
737
+ id: "binary_sensor.omni_ai_sensors_mac_mac_persona_tapo_frente_de_calle",
738
+ domain: "binary_sensor",
739
+ type: "motion",
740
+ name: "Omni AI Sensors - Mac MAC - Persona - TAPO-FRENTE DE CALLE",
741
+ state: false,
742
+ matterExported: false,
743
+ },
744
+ ],
745
+ },
746
+ ];
747
+ export class CameraUiStorage {
748
+ static cachedStore = null;
749
+ static getCachedStore() {
750
+ return this.cachedStore;
751
+ }
752
+ static getDefaultStore() {
753
+ return {
754
+ config: {
755
+ enabled: true,
756
+ serverUrl: "http://127.0.0.1:8181",
757
+ mqttEnabled: true,
758
+ mqttTopicPrefix: "camera.ui",
759
+ allowSelfSignedCertificate: true,
760
+ pollIntervalSeconds: 300,
761
+ connectionStatus: "connected",
762
+ },
763
+ // An empty install must stay empty until Camera.UI discovery succeeds.
764
+ // Never synthesize cameras: their persisted HAP identity belongs to the
765
+ // user's actual Camera.UI records.
766
+ cameras: [],
767
+ };
768
+ }
769
+ static async getFilePath() {
770
+ try {
771
+ await fs.access("/data");
772
+ return CONFIG_PATH;
773
+ }
774
+ catch {
775
+ return FALLBACK_CONFIG_PATH;
776
+ }
777
+ }
778
+ static async load() {
779
+ if (this.cachedStore)
780
+ return this.cachedStore;
781
+ const target = await this.getFilePath();
782
+ try {
783
+ const raw = await fs.readFile(target, "utf8");
784
+ const parsed = JSON.parse(raw);
785
+ let hadMigration = false;
786
+ let cameras = Array.isArray(parsed.cameras)
787
+ ? parsed.cameras.map((cam) => {
788
+ const result = repairCameraRecord(cam);
789
+ if (result.modified)
790
+ hadMigration = true;
791
+ return result.cam;
792
+ })
793
+ : [];
794
+ const storeConfig = {
795
+ ...this.getDefaultStore().config,
796
+ ...(parsed.config || {}),
797
+ };
798
+ storeConfig.enabled = true;
799
+ this.cachedStore = {
800
+ config: storeConfig,
801
+ cameras,
802
+ };
803
+ if (hadMigration) {
804
+ void this.save(this.cachedStore);
805
+ }
806
+ return this.cachedStore;
807
+ }
808
+ catch {
809
+ this.cachedStore = this.getDefaultStore();
810
+ void this.save(this.cachedStore);
811
+ return this.cachedStore;
812
+ }
813
+ }
814
+ static async save(store) {
815
+ this.cachedStore = store;
816
+ const target = await this.getFilePath();
817
+ try {
818
+ await fs.mkdir(path.dirname(target), { recursive: true });
819
+ await fs.writeFile(target, JSON.stringify(store, null, 2), "utf8");
820
+ }
821
+ catch (err) {
822
+ // Fallback
823
+ }
824
+ }
825
+ static async mergeDiscoveredCameras(discovered) {
826
+ const store = await this.load();
827
+ if (discovered.length === 0)
828
+ return store;
829
+ const existingMap = new Map(store.cameras.map((c) => [c.id, c]));
830
+ // Start with persistent records. Discovery is a snapshot of a remote
831
+ // service and can be incomplete while Camera.UI/go2rtc is starting; an
832
+ // incomplete response must never remove an exported or paired camera.
833
+ const merged = [...store.cameras];
834
+ for (const rawItem of discovered) {
835
+ const repaired = repairCameraRecord(rawItem).cam;
836
+ const existing = existingMap.get(repaired.id);
837
+ if (existing) {
838
+ const finalItem = repairCameraRecord({
839
+ ...repaired,
840
+ // Preserve a known stream when a transient discovery result omitted it.
841
+ rtspUrl: repaired.rtspUrl || existing.rtspUrl,
842
+ subRtspUrl: repaired.subRtspUrl || existing.subRtspUrl,
843
+ snapshotUrl: repaired.snapshotUrl || existing.snapshotUrl,
844
+ // Preserve persistent HAP pairing and network settings
845
+ port: existing.port || repaired.port,
846
+ username: existing.username || repaired.username,
847
+ pincode: existing.pincode || repaired.pincode,
848
+ setupId: existing.setupId || repaired.setupId,
849
+ uuid: existing.uuid || repaired.uuid,
850
+ isPaired: existing.isPaired ?? false,
851
+ homeKitEnabled: existing.homeKitEnabled ?? true,
852
+ motionActive: existing.motionActive ?? false,
853
+ lastMotionAt: existing.lastMotionAt,
854
+ doorbellActive: existing.doorbellActive ?? false,
855
+ lastDoorbellAt: existing.lastDoorbellAt,
856
+ }).cam;
857
+ const index = merged.findIndex((camera) => camera.id === repaired.id);
858
+ merged[index] = finalItem;
859
+ }
860
+ else {
861
+ merged.push(repaired);
862
+ }
863
+ }
864
+ store.cameras = merged;
865
+ store.config.enabled = true;
866
+ store.config.connectionStatus = "connected";
867
+ store.config.lastSyncedAt = new Date().toISOString();
868
+ store.config.lastError = undefined;
869
+ await this.save(store);
870
+ return store;
871
+ }
872
+ static async updateCamera(cameraId, updater) {
873
+ const store = await this.load();
874
+ const cleanId = cameraId
875
+ .replace(/^camera\.cameraui_/, "")
876
+ .replace(/^camera\./, "")
877
+ .replace(/^cameraui_/, "");
878
+ const idx = store.cameras.findIndex((c) => {
879
+ const cClean = c.id
880
+ .replace(/^camera\.cameraui_/, "")
881
+ .replace(/^camera\./, "")
882
+ .replace(/^cameraui_/, "");
883
+ return (cClean === cleanId ||
884
+ c.id === cameraId ||
885
+ `camera.${c.id}` === cameraId ||
886
+ `camera.cameraui_${cClean}` === cameraId ||
887
+ `cameraui_${cleanId}` === c.id);
888
+ });
889
+ if (idx !== -1) {
890
+ store.cameras[idx] = updater({ ...store.cameras[idx] });
891
+ await this.save(store);
892
+ }
893
+ return store;
894
+ }
895
+ static async updateConnectionStatus(status, error) {
896
+ const store = await this.load();
897
+ store.config.connectionStatus = status;
898
+ if (error !== undefined) {
899
+ store.config.lastError = error;
900
+ }
901
+ else if (status === "connected") {
902
+ store.config.lastError = undefined;
903
+ }
904
+ // Only mark cameras online when server is confirmed connected.
905
+ // Do not force cameras offline when server connection is momentarily interrupted,
906
+ // as direct RTSP streams or HomeKit accessories may still be streaming.
907
+ if (status === "connected") {
908
+ store.cameras.forEach((cam) => {
909
+ cam.status = "online";
910
+ });
911
+ }
912
+ await this.save(store);
913
+ return store;
914
+ }
915
+ }
916
+ //# sourceMappingURL=cameraui-storage.js.map