matter-all-in-one-addon 2.3.1 → 2.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -8
- package/dist/camera/ai/camera-ai-detector.d.ts +0 -2
- package/dist/camera/ai/camera-ai-detector.js +52 -57
- package/dist/camera/ai/camera-ai-detector.js.map +1 -1
- package/dist/camera/browser-preview.d.ts +9 -0
- package/dist/camera/browser-preview.js +135 -0
- package/dist/camera/browser-preview.js.map +1 -0
- package/dist/camera/camera-source-resolver.js +5 -3
- package/dist/camera/camera-source-resolver.js.map +1 -1
- package/dist/camera/camera-types.d.ts +0 -2
- package/dist/camera/cameraui/cameraui-client.js +91 -30
- package/dist/camera/cameraui/cameraui-client.js.map +1 -1
- package/dist/camera/cameraui/cameraui-homekit-bridge.js +13 -4
- package/dist/camera/cameraui/cameraui-homekit-bridge.js.map +1 -1
- package/dist/camera/cameraui/cameraui-storage.js.map +1 -1
- package/dist/camera/cameraui/cameraui-types.d.ts +6 -2
- package/dist/camera/cameraui/ha-camera-entity.js +5 -2
- package/dist/camera/cameraui/ha-camera-entity.js.map +1 -1
- package/dist/camera/homekit/ffmpeg-helper.js +17 -35
- package/dist/camera/homekit/ffmpeg-helper.js.map +1 -1
- package/dist/camera/homekit/hevc/fmp4-hevc.js +3 -1
- package/dist/camera/homekit/hevc/fmp4-hevc.js.map +1 -1
- package/dist/camera/homekit/hevc/hevc-recording.d.ts +0 -2
- package/dist/camera/homekit/hevc/hevc-recording.js +28 -63
- package/dist/camera/homekit/hevc/hevc-recording.js.map +1 -1
- package/dist/camera/homekit/hevc/multi-tier-rtp.d.ts +1 -15
- package/dist/camera/homekit/hevc/multi-tier-rtp.js +70 -228
- package/dist/camera/homekit/hevc/multi-tier-rtp.js.map +1 -1
- package/dist/camera/homekit/hevc/sframe-rtp.d.ts +0 -2
- package/dist/camera/homekit/hevc/sframe-rtp.js +0 -25
- package/dist/camera/homekit/hevc/sframe-rtp.js.map +1 -1
- package/dist/camera/homekit/hevc/sframe.d.ts +1 -11
- package/dist/camera/homekit/hevc/sframe.js +18 -133
- package/dist/camera/homekit/hevc/sframe.js.map +1 -1
- package/dist/camera/homekit/hevc/types.js +81 -9
- package/dist/camera/homekit/hevc/types.js.map +1 -1
- package/dist/camera/homekit/hevc/webrtc-session.d.ts +3 -17
- package/dist/camera/homekit/hevc/webrtc-session.js +55 -229
- package/dist/camera/homekit/hevc/webrtc-session.js.map +1 -1
- package/dist/camera/homekit/homekit-camera-recording.delegate.d.ts +0 -1
- package/dist/camera/homekit/homekit-camera-recording.delegate.js +115 -43
- package/dist/camera/homekit/homekit-camera-recording.delegate.js.map +1 -1
- package/dist/camera/homekit/homekit-camera-stream.delegate.d.ts +4 -7
- package/dist/camera/homekit/homekit-camera-stream.delegate.js +388 -201
- package/dist/camera/homekit/homekit-camera-stream.delegate.js.map +1 -1
- package/dist/camera/homekit/homekit-camera.accessory.d.ts +7 -34
- package/dist/camera/homekit/homekit-camera.accessory.js +207 -169
- package/dist/camera/homekit/homekit-camera.accessory.js.map +1 -1
- package/dist/camera/homekit/live-view-telemetry.d.ts +0 -4
- package/dist/camera/homekit/live-view-telemetry.js.map +1 -1
- package/dist/camera/homekit/tuya-hap-talkback.d.ts +41 -0
- package/dist/camera/homekit/tuya-hap-talkback.js +326 -0
- package/dist/camera/homekit/tuya-hap-talkback.js.map +1 -0
- package/dist/camera/matter/camera-endpoint.builder.js +9 -7
- package/dist/camera/matter/camera-endpoint.builder.js.map +1 -1
- package/dist/camera/matter/camera-session-manager.d.ts +1 -0
- package/dist/camera/matter/camera-session-manager.js +2 -0
- package/dist/camera/matter/camera-session-manager.js.map +1 -1
- package/dist/camera/matter/camera-webrtc-adapter.js +32 -15
- package/dist/camera/matter/camera-webrtc-adapter.js.map +1 -1
- package/dist/camera/motion/ffmpeg-motion-detector.js +28 -14
- package/dist/camera/motion/ffmpeg-motion-detector.js.map +1 -1
- package/dist/camera/nest/nest-camera-adapter.js +9 -5
- package/dist/camera/nest/nest-camera-adapter.js.map +1 -1
- package/dist/camera/ptz/ptz-capabilities.js +3 -1
- package/dist/camera/ptz/ptz-capabilities.js.map +1 -1
- package/dist/camera/ptz/ptz-legacy-discovery.js.map +1 -1
- package/dist/camera/ptz/ptz-mqtt-publisher.js +50 -12
- package/dist/camera/ptz/ptz-mqtt-publisher.js.map +1 -1
- package/dist/camera/ptz/ptz-zones-manager.js +6 -1
- package/dist/camera/ptz/ptz-zones-manager.js.map +1 -1
- package/dist/camera/scrypted/scrypted-camera-card.js +3 -1
- package/dist/camera/scrypted/scrypted-camera-card.js.map +1 -1
- package/dist/camera/scrypted/scrypted-camera-discovery-adapter.js +7 -5
- package/dist/camera/scrypted/scrypted-camera-discovery-adapter.js.map +1 -1
- package/dist/camera/scrypted/scrypted-client-discovery-adapter.js.map +1 -1
- package/dist/camera/scrypted/scrypted-client.js +6 -5
- package/dist/camera/scrypted/scrypted-client.js.map +1 -1
- package/dist/camera/scrypted/scrypted-discovery-provider.js.map +1 -1
- package/dist/camera/scrypted/scrypted-homekit-bridge.js +6 -4
- package/dist/camera/scrypted/scrypted-homekit-bridge.js.map +1 -1
- package/dist/camera/scrypted/scrypted-reconnect-manager.js.map +1 -1
- package/dist/camera/scrypted/scrypted-runtime-facade.js +2 -2
- package/dist/camera/scrypted/scrypted-runtime-facade.js.map +1 -1
- package/dist/camera/scrypted/scrypted-runtime-ingest.js +3 -1
- package/dist/camera/scrypted/scrypted-runtime-ingest.js.map +1 -1
- package/dist/camera/scrypted/scrypted-storage.js +12 -6
- package/dist/camera/scrypted/scrypted-storage.js.map +1 -1
- package/dist/camera/scrypted/scrypted-stream-validator.js +25 -7
- package/dist/camera/scrypted/scrypted-stream-validator.js.map +1 -1
- package/dist/camera/tuya-webrtc-session.d.ts +53 -0
- package/dist/camera/tuya-webrtc-session.js +261 -0
- package/dist/camera/tuya-webrtc-session.js.map +1 -0
- package/dist/converters/sensor.converter.js +4 -1
- package/dist/converters/sensor.converter.js.map +1 -1
- package/dist/device-profiles.js +3 -1
- package/dist/device-profiles.js.map +1 -1
- package/dist/entities/air_quality.entity.js +3 -1
- package/dist/entities/air_quality.entity.js.map +1 -1
- package/dist/entities/base.entity.js +45 -17
- package/dist/entities/base.entity.js.map +1 -1
- package/dist/entities/camera.entity.d.ts +1 -0
- package/dist/entities/camera.entity.js +24 -2
- package/dist/entities/camera.entity.js.map +1 -1
- package/dist/entities/composite-device.entity.js +37 -13
- package/dist/entities/composite-device.entity.js.map +1 -1
- package/dist/entities/energy_tariff.entity.js.map +1 -1
- package/dist/entities/pet_feeder.entity.d.ts +1 -0
- package/dist/entities/pet_feeder.entity.js +12 -0
- package/dist/entities/pet_feeder.entity.js.map +1 -1
- package/dist/entities/vacuum.entity.js +16 -5
- package/dist/entities/vacuum.entity.js.map +1 -1
- package/dist/frontend/assets/index-1k-iTL-m.js +26 -0
- package/dist/frontend/assets/{index-NrzHqycm.css → index-CJdlkpIy.css} +1 -1
- package/dist/frontend/index.html +2 -2
- package/dist/hap/hap-generic-accessory.d.ts +4 -0
- package/dist/hap/hap-generic-accessory.js +512 -122
- package/dist/hap/hap-generic-accessory.js.map +1 -1
- package/dist/homeAssistant.d.ts +1 -0
- package/dist/homeAssistant.js +23 -5
- package/dist/homeAssistant.js.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/mqtt/mqtt-client.js.map +1 -1
- package/dist/mqtt/mqtt.entity.js +41 -17
- package/dist/mqtt/mqtt.entity.js.map +1 -1
- package/dist/platform.d.ts +1 -0
- package/dist/platform.js +83 -13
- package/dist/platform.js.map +1 -1
- package/dist/utils/atomic-json-store.js +5 -1
- package/dist/utils/atomic-json-store.js.map +1 -1
- package/dist/utils/ha-state.js +3 -1
- package/dist/utils/ha-state.js.map +1 -1
- package/dist/utils/light-color.js +3 -5
- package/dist/utils/light-color.js.map +1 -1
- package/dist/utils/matter-command-response.js.map +1 -1
- package/dist/utils/matter-firmware.js +1 -2
- package/dist/utils/matter-firmware.js.map +1 -1
- package/dist/utils/matter-protocol.d.ts +1 -0
- package/dist/utils/matter-protocol.js +30 -0
- package/dist/utils/matter-protocol.js.map +1 -0
- package/package.json +27 -19
- package/dist/camera/camera-entity-control.d.ts +0 -12
- package/dist/camera/camera-entity-control.js +0 -24
- package/dist/camera/camera-entity-control.js.map +0 -1
- package/dist/camera/homekit/hevc/bootstrap.d.ts +0 -9
- package/dist/camera/homekit/hevc/bootstrap.js +0 -47
- package/dist/camera/homekit/hevc/bootstrap.js.map +0 -1
- package/dist/camera/homekit/hevc/recording-output.d.ts +0 -2
- package/dist/camera/homekit/hevc/recording-output.js +0 -33
- package/dist/camera/homekit/hevc/recording-output.js.map +0 -1
- package/dist/camera/homekit/media-policy.d.ts +0 -25
- package/dist/camera/homekit/media-policy.js +0 -102
- package/dist/camera/homekit/media-policy.js.map +0 -1
- package/dist/camera/homekit/route-address.d.ts +0 -2
- package/dist/camera/homekit/route-address.js +0 -27
- package/dist/camera/homekit/route-address.js.map +0 -1
- package/dist/camera/homekit/rtp-relay.d.ts +0 -21
- package/dist/camera/homekit/rtp-relay.js +0 -112
- package/dist/camera/homekit/rtp-relay.js.map +0 -1
- package/dist/camera/homekit/startup-timing.d.ts +0 -8
- package/dist/camera/homekit/startup-timing.js +0 -14
- package/dist/camera/homekit/startup-timing.js.map +0 -1
- package/dist/camera/source-adapter.d.ts +0 -132
- package/dist/camera/source-adapter.js +0 -282
- package/dist/camera/source-adapter.js.map +0 -1
- package/dist/frontend/assets/index-Bka3TVAQ.js +0 -21
- package/vendor/hap-nodejs/LICENSE +0 -176
- package/vendor/hap-nodejs/MIAO.md +0 -5
- package/vendor/hap-nodejs/PATCH.md +0 -37
- package/vendor/hap-nodejs/README.md +0 -86
- package/vendor/hap-nodejs/dist/accessories/AirConditioner_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/AirConditioner_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/AirConditioner_accessory.js +0 -128
- package/vendor/hap-nodejs/dist/accessories/AirConditioner_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/AppleTVRemote_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/AppleTVRemote_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/AppleTVRemote_accessory.js +0 -159
- package/vendor/hap-nodejs/dist/accessories/AppleTVRemote_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Camera_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/Camera_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Camera_accessory.js +0 -545
- package/vendor/hap-nodejs/dist/accessories/Camera_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Fan_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/Fan_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Fan_accessory.js +0 -74
- package/vendor/hap-nodejs/dist/accessories/Fan_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/GarageDoorOpener_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/GarageDoorOpener_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/GarageDoorOpener_accessory.js +0 -78
- package/vendor/hap-nodejs/dist/accessories/GarageDoorOpener_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Light-AdaptiveLighting_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/Light-AdaptiveLighting_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Light-AdaptiveLighting_accessory.js +0 -106
- package/vendor/hap-nodejs/dist/accessories/Light-AdaptiveLighting_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Light_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/Light_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Light_accessory.js +0 -145
- package/vendor/hap-nodejs/dist/accessories/Light_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Lock_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/Lock_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Lock_accessory.js +0 -76
- package/vendor/hap-nodejs/dist/accessories/Lock_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/MotionSensor_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/MotionSensor_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/MotionSensor_accessory.js +0 -45
- package/vendor/hap-nodejs/dist/accessories/MotionSensor_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Outlet_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/Outlet_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Outlet_accessory.js +0 -79
- package/vendor/hap-nodejs/dist/accessories/Outlet_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/SmartSpeaker_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/SmartSpeaker_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/SmartSpeaker_accessory.js +0 -44
- package/vendor/hap-nodejs/dist/accessories/SmartSpeaker_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Sprinkler_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/Sprinkler_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Sprinkler_accessory.js +0 -128
- package/vendor/hap-nodejs/dist/accessories/Sprinkler_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/TV_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/TV_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/TV_accessory.js +0 -101
- package/vendor/hap-nodejs/dist/accessories/TV_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/TemperatureSensor_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/TemperatureSensor_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/TemperatureSensor_accessory.js +0 -44
- package/vendor/hap-nodejs/dist/accessories/TemperatureSensor_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Wi-FiRouter_accessory.d.ts +0 -3
- package/vendor/hap-nodejs/dist/accessories/Wi-FiRouter_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Wi-FiRouter_accessory.js +0 -17
- package/vendor/hap-nodejs/dist/accessories/Wi-FiRouter_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Wi-FiSatellite_accessory.d.ts +0 -3
- package/vendor/hap-nodejs/dist/accessories/Wi-FiSatellite_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Wi-FiSatellite_accessory.js +0 -19
- package/vendor/hap-nodejs/dist/accessories/Wi-FiSatellite_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/gstreamer-audioProducer.d.ts +0 -25
- package/vendor/hap-nodejs/dist/accessories/gstreamer-audioProducer.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/gstreamer-audioProducer.js +0 -145
- package/vendor/hap-nodejs/dist/accessories/gstreamer-audioProducer.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/types.d.ts +0 -78
- package/vendor/hap-nodejs/dist/accessories/types.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/types.js +0 -88
- package/vendor/hap-nodejs/dist/accessories/types.js.map +0 -1
- package/vendor/hap-nodejs/dist/index.d.ts +0 -50
- package/vendor/hap-nodejs/dist/index.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/index.js +0 -54
- package/vendor/hap-nodejs/dist/index.js.map +0 -1
- package/vendor/hap-nodejs/dist/internal-types.d.ts +0 -76
- package/vendor/hap-nodejs/dist/internal-types.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/internal-types.js +0 -80
- package/vendor/hap-nodejs/dist/internal-types.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Accessory.d.ts +0 -521
- package/vendor/hap-nodejs/dist/lib/Accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Accessory.js +0 -1762
- package/vendor/hap-nodejs/dist/lib/Accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Advertiser.d.ts +0 -190
- package/vendor/hap-nodejs/dist/lib/Advertiser.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Advertiser.js +0 -592
- package/vendor/hap-nodejs/dist/lib/Advertiser.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Bridge.d.ts +0 -12
- package/vendor/hap-nodejs/dist/lib/Bridge.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Bridge.js +0 -19
- package/vendor/hap-nodejs/dist/lib/Bridge.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Characteristic.d.ts +0 -1768
- package/vendor/hap-nodejs/dist/lib/Characteristic.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Characteristic.js +0 -2532
- package/vendor/hap-nodejs/dist/lib/Characteristic.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/HAPServer.d.ts +0 -299
- package/vendor/hap-nodejs/dist/lib/HAPServer.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/HAPServer.js +0 -968
- package/vendor/hap-nodejs/dist/lib/HAPServer.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Service.d.ts +0 -598
- package/vendor/hap-nodejs/dist/lib/Service.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Service.js +0 -797
- package/vendor/hap-nodejs/dist/lib/Service.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/CMAFIngest.d.ts +0 -102
- package/vendor/hap-nodejs/dist/lib/camera/CMAFIngest.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/CMAFIngest.js +0 -317
- package/vendor/hap-nodejs/dist/lib/camera/CMAFIngest.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/HDSSnapshotTransport.d.ts +0 -38
- package/vendor/hap-nodejs/dist/lib/camera/HDSSnapshotTransport.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/HDSSnapshotTransport.js +0 -174
- package/vendor/hap-nodejs/dist/lib/camera/HDSSnapshotTransport.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/RTPProxy.d.ts +0 -59
- package/vendor/hap-nodejs/dist/lib/camera/RTPProxy.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/RTPProxy.js +0 -267
- package/vendor/hap-nodejs/dist/lib/camera/RTPProxy.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/RTPStreamManagement.d.ts +0 -379
- package/vendor/hap-nodejs/dist/lib/camera/RTPStreamManagement.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/RTPStreamManagement.js +0 -1021
- package/vendor/hap-nodejs/dist/lib/camera/RTPStreamManagement.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/RecordingManagement.d.ts +0 -325
- package/vendor/hap-nodejs/dist/lib/camera/RecordingManagement.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/RecordingManagement.js +0 -800
- package/vendor/hap-nodejs/dist/lib/camera/RecordingManagement.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoCredentials.d.ts +0 -20
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoCredentials.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoCredentials.js +0 -48
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoCredentials.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoTypes.d.ts +0 -618
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoTypes.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoTypes.js +0 -911
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoTypes.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/index.d.ts +0 -8
- package/vendor/hap-nodejs/dist/lib/camera/index.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/index.js +0 -11
- package/vendor/hap-nodejs/dist/lib/camera/index.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/AdaptiveLightingController.d.ts +0 -452
- package/vendor/hap-nodejs/dist/lib/controller/AdaptiveLightingController.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/AdaptiveLightingController.js +0 -868
- package/vendor/hap-nodejs/dist/lib/controller/AdaptiveLightingController.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/CameraController.d.ts +0 -410
- package/vendor/hap-nodejs/dist/lib/controller/CameraController.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/CameraController.js +0 -658
- package/vendor/hap-nodejs/dist/lib/controller/CameraController.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/Controller.d.ts +0 -197
- package/vendor/hap-nodejs/dist/lib/controller/Controller.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/Controller.js +0 -32
- package/vendor/hap-nodejs/dist/lib/controller/Controller.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/DoorbellController.d.ts +0 -59
- package/vendor/hap-nodejs/dist/lib/controller/DoorbellController.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/DoorbellController.js +0 -102
- package/vendor/hap-nodejs/dist/lib/controller/DoorbellController.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/RemoteController.d.ts +0 -434
- package/vendor/hap-nodejs/dist/lib/controller/RemoteController.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/RemoteController.js +0 -1178
- package/vendor/hap-nodejs/dist/lib/controller/RemoteController.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/SecureVideoController.d.ts +0 -380
- package/vendor/hap-nodejs/dist/lib/controller/SecureVideoController.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/SecureVideoController.js +0 -947
- package/vendor/hap-nodejs/dist/lib/controller/SecureVideoController.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/index.d.ts +0 -7
- package/vendor/hap-nodejs/dist/lib/controller/index.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/index.js +0 -10
- package/vendor/hap-nodejs/dist/lib/controller/index.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamManagement.d.ts +0 -73
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamManagement.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamManagement.js +0 -205
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamManagement.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamParser.d.ts +0 -186
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamParser.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamParser.js +0 -880
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamParser.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamServer.d.ts +0 -351
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamServer.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamServer.js +0 -878
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamServer.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/index.d.ts +0 -4
- package/vendor/hap-nodejs/dist/lib/datastream/index.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/index.js +0 -7
- package/vendor/hap-nodejs/dist/lib/datastream/index.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/CharacteristicDefinitions.d.ts +0 -2245
- package/vendor/hap-nodejs/dist/lib/definitions/CharacteristicDefinitions.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/CharacteristicDefinitions.js +0 -4957
- package/vendor/hap-nodejs/dist/lib/definitions/CharacteristicDefinitions.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/ServiceDefinitions.d.ts +0 -584
- package/vendor/hap-nodejs/dist/lib/definitions/ServiceDefinitions.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/ServiceDefinitions.js +0 -1518
- package/vendor/hap-nodejs/dist/lib/definitions/ServiceDefinitions.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/generate-definitions.d.ts +0 -34
- package/vendor/hap-nodejs/dist/lib/definitions/generate-definitions.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/generate-definitions.js +0 -624
- package/vendor/hap-nodejs/dist/lib/definitions/generate-definitions.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/generator-configuration.d.ts +0 -22
- package/vendor/hap-nodejs/dist/lib/definitions/generator-configuration.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/generator-configuration.js +0 -734
- package/vendor/hap-nodejs/dist/lib/definitions/generator-configuration.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/index.d.ts +0 -3
- package/vendor/hap-nodejs/dist/lib/definitions/index.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/index.js +0 -6
- package/vendor/hap-nodejs/dist/lib/definitions/index.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/gen/HomeKit.d.ts +0 -8
- package/vendor/hap-nodejs/dist/lib/gen/HomeKit.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/gen/HomeKit.js +0 -9
- package/vendor/hap-nodejs/dist/lib/gen/HomeKit.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/AccessoryInfo.d.ts +0 -91
- package/vendor/hap-nodejs/dist/lib/model/AccessoryInfo.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/AccessoryInfo.js +0 -311
- package/vendor/hap-nodejs/dist/lib/model/AccessoryInfo.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/ControllerStorage.d.ts +0 -46
- package/vendor/hap-nodejs/dist/lib/model/ControllerStorage.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/ControllerStorage.js +0 -277
- package/vendor/hap-nodejs/dist/lib/model/ControllerStorage.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/HAPFileStorage.d.ts +0 -75
- package/vendor/hap-nodejs/dist/lib/model/HAPFileStorage.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/HAPFileStorage.js +0 -190
- package/vendor/hap-nodejs/dist/lib/model/HAPFileStorage.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/HAPStorage.d.ts +0 -26
- package/vendor/hap-nodejs/dist/lib/model/HAPStorage.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/HAPStorage.js +0 -79
- package/vendor/hap-nodejs/dist/lib/model/HAPStorage.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/IdentifierCache.d.ts +0 -33
- package/vendor/hap-nodejs/dist/lib/model/IdentifierCache.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/IdentifierCache.js +0 -114
- package/vendor/hap-nodejs/dist/lib/model/IdentifierCache.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/tv/AccessControlManagement.d.ts +0 -83
- package/vendor/hap-nodejs/dist/lib/tv/AccessControlManagement.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/tv/AccessControlManagement.js +0 -127
- package/vendor/hap-nodejs/dist/lib/tv/AccessControlManagement.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/checkName.d.ts +0 -8
- package/vendor/hap-nodejs/dist/lib/util/checkName.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/checkName.js +0 -28
- package/vendor/hap-nodejs/dist/lib/util/checkName.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/clone.d.ts +0 -7
- package/vendor/hap-nodejs/dist/lib/util/clone.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/clone.js +0 -22
- package/vendor/hap-nodejs/dist/lib/util/clone.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/color-utils.d.ts +0 -18
- package/vendor/hap-nodejs/dist/lib/util/color-utils.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/color-utils.js +0 -442
- package/vendor/hap-nodejs/dist/lib/util/color-utils.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/eventedhttp.d.ts +0 -251
- package/vendor/hap-nodejs/dist/lib/util/eventedhttp.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/eventedhttp.js +0 -714
- package/vendor/hap-nodejs/dist/lib/util/eventedhttp.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/hapCrypto.d.ts +0 -50
- package/vendor/hap-nodejs/dist/lib/util/hapCrypto.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/hapCrypto.js +0 -185
- package/vendor/hap-nodejs/dist/lib/util/hapCrypto.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/hapStatusError.d.ts +0 -16
- package/vendor/hap-nodejs/dist/lib/util/hapStatusError.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/hapStatusError.js +0 -29
- package/vendor/hap-nodejs/dist/lib/util/hapStatusError.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/net-utils.d.ts +0 -21
- package/vendor/hap-nodejs/dist/lib/util/net-utils.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/net-utils.js +0 -79
- package/vendor/hap-nodejs/dist/lib/util/net-utils.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/once.d.ts +0 -7
- package/vendor/hap-nodejs/dist/lib/util/once.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/once.js +0 -22
- package/vendor/hap-nodejs/dist/lib/util/once.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/promise-utils.d.ts +0 -14
- package/vendor/hap-nodejs/dist/lib/util/promise-utils.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/promise-utils.js +0 -29
- package/vendor/hap-nodejs/dist/lib/util/promise-utils.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/request-util.d.ts +0 -36
- package/vendor/hap-nodejs/dist/lib/util/request-util.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/request-util.js +0 -108
- package/vendor/hap-nodejs/dist/lib/util/request-util.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/time.d.ts +0 -9
- package/vendor/hap-nodejs/dist/lib/util/time.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/time.js +0 -23
- package/vendor/hap-nodejs/dist/lib/util/time.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/tlv.d.ts +0 -90
- package/vendor/hap-nodejs/dist/lib/util/tlv.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/tlv.js +0 -318
- package/vendor/hap-nodejs/dist/lib/util/tlv.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/uuid.d.ts +0 -23
- package/vendor/hap-nodejs/dist/lib/util/uuid.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/uuid.js +0 -78
- package/vendor/hap-nodejs/dist/lib/util/uuid.js.map +0 -1
- package/vendor/hap-nodejs/dist/types.d.ts +0 -276
- package/vendor/hap-nodejs/dist/types.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/types.js +0 -11
- package/vendor/hap-nodejs/dist/types.js.map +0 -1
- package/vendor/hap-nodejs/package.json +0 -53
- package/vendor/hap-nodejs/src/lib/util/hapCrypto.ts +0 -208
|
@@ -1,797 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Service = exports.ServiceEventTypes = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
6
|
-
const debug_1 = tslib_1.__importDefault(require("debug"));
|
|
7
|
-
const events_1 = require("events");
|
|
8
|
-
const Characteristic_1 = require("./Characteristic");
|
|
9
|
-
const uuid_1 = require("./util/uuid");
|
|
10
|
-
const checkName_1 = require("./util/checkName");
|
|
11
|
-
const debug = (0, debug_1.default)("HAP-NodeJS:Service");
|
|
12
|
-
/**
|
|
13
|
-
* HAP spec allows a maximum of 100 characteristics per service!
|
|
14
|
-
*/
|
|
15
|
-
const MAX_CHARACTERISTICS = 100;
|
|
16
|
-
/**
|
|
17
|
-
* @group Service
|
|
18
|
-
*/
|
|
19
|
-
var ServiceEventTypes;
|
|
20
|
-
(function (ServiceEventTypes) {
|
|
21
|
-
ServiceEventTypes["CHARACTERISTIC_CHANGE"] = "characteristic-change";
|
|
22
|
-
ServiceEventTypes["SERVICE_CONFIGURATION_CHANGE"] = "service-configurationChange";
|
|
23
|
-
ServiceEventTypes["CHARACTERISTIC_WARNING"] = "characteristic-warning";
|
|
24
|
-
})(ServiceEventTypes || (exports.ServiceEventTypes = ServiceEventTypes = {}));
|
|
25
|
-
/**
|
|
26
|
-
* Service represents a set of grouped values necessary to provide a logical function. For instance, a
|
|
27
|
-
* "Door Lock Mechanism" service might contain two values, one for the "desired lock state" and one for the
|
|
28
|
-
* "current lock state". A particular Service is distinguished from others by its "type", which is a UUID.
|
|
29
|
-
* HomeKit provides a set of known Service UUIDs defined in HomeKit.ts along with a corresponding
|
|
30
|
-
* concrete subclass that you can instantiate directly to set up the necessary values. These natively-supported
|
|
31
|
-
* Services are expected to contain a particular set of Characteristics.
|
|
32
|
-
*
|
|
33
|
-
* Unlike Characteristics, where you cannot have two Characteristics with the same UUID in the same Service,
|
|
34
|
-
* you can actually have multiple Services with the same UUID in a single Accessory. For instance, imagine
|
|
35
|
-
* a Garage Door Opener with both a "security light" and a "backlight" for the display. Each light could be
|
|
36
|
-
* a "Lightbulb" Service with the same UUID. To account for this situation, we define an extra "subtype"
|
|
37
|
-
* property on Service, that can be a string or other string-convertible object that uniquely identifies the
|
|
38
|
-
* Service among its peers in an Accessory. For instance, you might have `service1.subtype = 'security_light'`
|
|
39
|
-
* for one and `service2.subtype = 'backlight'` for the other.
|
|
40
|
-
*
|
|
41
|
-
* You can also define custom Services by providing your own UUID for the type that you generate yourself.
|
|
42
|
-
* Custom Services can contain an arbitrary set of Characteristics, but Siri will likely not be able to
|
|
43
|
-
* work with these.
|
|
44
|
-
*
|
|
45
|
-
* @group Service
|
|
46
|
-
*/
|
|
47
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
|
48
|
-
class Service extends events_1.EventEmitter {
|
|
49
|
-
// Service MUST NOT have any other static variables
|
|
50
|
-
// Pattern below is for automatic detection of the section of defined services. Used by the generator
|
|
51
|
-
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
|
52
|
-
/**
|
|
53
|
-
* @group Service Definitions
|
|
54
|
-
*/
|
|
55
|
-
static AccessCode;
|
|
56
|
-
/**
|
|
57
|
-
* @group Service Definitions
|
|
58
|
-
*/
|
|
59
|
-
static AccessControl;
|
|
60
|
-
/**
|
|
61
|
-
* @group Service Definitions
|
|
62
|
-
*/
|
|
63
|
-
static AccessoryInformation;
|
|
64
|
-
/**
|
|
65
|
-
* @group Service Definitions
|
|
66
|
-
*/
|
|
67
|
-
static AccessoryMetrics;
|
|
68
|
-
/**
|
|
69
|
-
* @group Service Definitions
|
|
70
|
-
*/
|
|
71
|
-
static AccessoryRuntimeInformation;
|
|
72
|
-
/**
|
|
73
|
-
* @group Service Definitions
|
|
74
|
-
*/
|
|
75
|
-
static AirPurifier;
|
|
76
|
-
/**
|
|
77
|
-
* @group Service Definitions
|
|
78
|
-
*/
|
|
79
|
-
static AirQualitySensor;
|
|
80
|
-
/**
|
|
81
|
-
* @group Service Definitions
|
|
82
|
-
*/
|
|
83
|
-
static AssetUpdate;
|
|
84
|
-
/**
|
|
85
|
-
* @group Service Definitions
|
|
86
|
-
*/
|
|
87
|
-
static Assistant;
|
|
88
|
-
/**
|
|
89
|
-
* @group Service Definitions
|
|
90
|
-
*/
|
|
91
|
-
static AudioStreamManagement;
|
|
92
|
-
/**
|
|
93
|
-
* @group Service Definitions
|
|
94
|
-
*/
|
|
95
|
-
static Battery;
|
|
96
|
-
/**
|
|
97
|
-
* @group Service Definitions
|
|
98
|
-
*/
|
|
99
|
-
static CameraBufferManagement;
|
|
100
|
-
/**
|
|
101
|
-
* @group Service Definitions
|
|
102
|
-
*/
|
|
103
|
-
static CameraCapabilities;
|
|
104
|
-
/**
|
|
105
|
-
* @group Service Definitions
|
|
106
|
-
*/
|
|
107
|
-
static CameraClientCertificateManagement;
|
|
108
|
-
/**
|
|
109
|
-
* @group Service Definitions
|
|
110
|
-
*/
|
|
111
|
-
static CameraGlobalOperatingMode;
|
|
112
|
-
/**
|
|
113
|
-
* @group Service Definitions
|
|
114
|
-
*/
|
|
115
|
-
static CameraKeyManagement;
|
|
116
|
-
/**
|
|
117
|
-
* @group Service Definitions
|
|
118
|
-
*/
|
|
119
|
-
static CameraMotionZones;
|
|
120
|
-
/**
|
|
121
|
-
* @group Service Definitions
|
|
122
|
-
*/
|
|
123
|
-
static CameraMultiTierRTPStreamManagement;
|
|
124
|
-
/**
|
|
125
|
-
* @group Service Definitions
|
|
126
|
-
*/
|
|
127
|
-
static CameraOperatingMode;
|
|
128
|
-
/**
|
|
129
|
-
* @group Service Definitions
|
|
130
|
-
*/
|
|
131
|
-
static CameraRecordingManagement;
|
|
132
|
-
/**
|
|
133
|
-
* @group Service Definitions
|
|
134
|
-
*/
|
|
135
|
-
static CameraRTPStreamManagement;
|
|
136
|
-
/**
|
|
137
|
-
* @group Service Definitions
|
|
138
|
-
*/
|
|
139
|
-
static CameraWebRTCStreamManagement;
|
|
140
|
-
/**
|
|
141
|
-
* @group Service Definitions
|
|
142
|
-
*/
|
|
143
|
-
static CarbonDioxideSensor;
|
|
144
|
-
/**
|
|
145
|
-
* @group Service Definitions
|
|
146
|
-
*/
|
|
147
|
-
static CarbonMonoxideSensor;
|
|
148
|
-
/**
|
|
149
|
-
* @group Service Definitions
|
|
150
|
-
* @deprecated Removed
|
|
151
|
-
*/
|
|
152
|
-
static CloudRelay;
|
|
153
|
-
/**
|
|
154
|
-
* @group Service Definitions
|
|
155
|
-
*/
|
|
156
|
-
static ContactSensor;
|
|
157
|
-
/**
|
|
158
|
-
* @group Service Definitions
|
|
159
|
-
*/
|
|
160
|
-
static DataStreamTransportManagement;
|
|
161
|
-
/**
|
|
162
|
-
* @group Service Definitions
|
|
163
|
-
*/
|
|
164
|
-
static Diagnostics;
|
|
165
|
-
/**
|
|
166
|
-
* @group Service Definitions
|
|
167
|
-
*/
|
|
168
|
-
static Door;
|
|
169
|
-
/**
|
|
170
|
-
* @group Service Definitions
|
|
171
|
-
*/
|
|
172
|
-
static Doorbell;
|
|
173
|
-
/**
|
|
174
|
-
* @group Service Definitions
|
|
175
|
-
*/
|
|
176
|
-
static Fan;
|
|
177
|
-
/**
|
|
178
|
-
* @group Service Definitions
|
|
179
|
-
*/
|
|
180
|
-
static Fanv2;
|
|
181
|
-
/**
|
|
182
|
-
* @group Service Definitions
|
|
183
|
-
*/
|
|
184
|
-
static Faucet;
|
|
185
|
-
/**
|
|
186
|
-
* @group Service Definitions
|
|
187
|
-
*/
|
|
188
|
-
static FilterMaintenance;
|
|
189
|
-
/**
|
|
190
|
-
* @group Service Definitions
|
|
191
|
-
*/
|
|
192
|
-
static FirmwareUpdate;
|
|
193
|
-
/**
|
|
194
|
-
* @group Service Definitions
|
|
195
|
-
*/
|
|
196
|
-
static GarageDoorOpener;
|
|
197
|
-
/**
|
|
198
|
-
* @group Service Definitions
|
|
199
|
-
*/
|
|
200
|
-
static HeaterCooler;
|
|
201
|
-
/**
|
|
202
|
-
* @group Service Definitions
|
|
203
|
-
*/
|
|
204
|
-
static HumidifierDehumidifier;
|
|
205
|
-
/**
|
|
206
|
-
* @group Service Definitions
|
|
207
|
-
*/
|
|
208
|
-
static HumiditySensor;
|
|
209
|
-
/**
|
|
210
|
-
* @group Service Definitions
|
|
211
|
-
*/
|
|
212
|
-
static InputSource;
|
|
213
|
-
/**
|
|
214
|
-
* @group Service Definitions
|
|
215
|
-
*/
|
|
216
|
-
static IrrigationSystem;
|
|
217
|
-
/**
|
|
218
|
-
* @group Service Definitions
|
|
219
|
-
*/
|
|
220
|
-
static LeakSensor;
|
|
221
|
-
/**
|
|
222
|
-
* @group Service Definitions
|
|
223
|
-
*/
|
|
224
|
-
static Lightbulb;
|
|
225
|
-
/**
|
|
226
|
-
* @group Service Definitions
|
|
227
|
-
*/
|
|
228
|
-
static LightSensor;
|
|
229
|
-
/**
|
|
230
|
-
* @group Service Definitions
|
|
231
|
-
*/
|
|
232
|
-
static LockManagement;
|
|
233
|
-
/**
|
|
234
|
-
* @group Service Definitions
|
|
235
|
-
*/
|
|
236
|
-
static LockMechanism;
|
|
237
|
-
/**
|
|
238
|
-
* @group Service Definitions
|
|
239
|
-
*/
|
|
240
|
-
static Microphone;
|
|
241
|
-
/**
|
|
242
|
-
* @group Service Definitions
|
|
243
|
-
*/
|
|
244
|
-
static MotionSensor;
|
|
245
|
-
/**
|
|
246
|
-
* @group Service Definitions
|
|
247
|
-
*/
|
|
248
|
-
static NFCAccess;
|
|
249
|
-
/**
|
|
250
|
-
* @group Service Definitions
|
|
251
|
-
*/
|
|
252
|
-
static OccupancySensor;
|
|
253
|
-
/**
|
|
254
|
-
* @group Service Definitions
|
|
255
|
-
*/
|
|
256
|
-
static Outlet;
|
|
257
|
-
/**
|
|
258
|
-
* @group Service Definitions
|
|
259
|
-
*/
|
|
260
|
-
static Pairing;
|
|
261
|
-
/**
|
|
262
|
-
* @group Service Definitions
|
|
263
|
-
*/
|
|
264
|
-
static PowerManagement;
|
|
265
|
-
/**
|
|
266
|
-
* @group Service Definitions
|
|
267
|
-
*/
|
|
268
|
-
static ProtocolInformation;
|
|
269
|
-
/**
|
|
270
|
-
* @group Service Definitions
|
|
271
|
-
*/
|
|
272
|
-
static SecuritySystem;
|
|
273
|
-
/**
|
|
274
|
-
* @group Service Definitions
|
|
275
|
-
*/
|
|
276
|
-
static ServiceLabel;
|
|
277
|
-
/**
|
|
278
|
-
* @group Service Definitions
|
|
279
|
-
*/
|
|
280
|
-
static Siri;
|
|
281
|
-
/**
|
|
282
|
-
* @group Service Definitions
|
|
283
|
-
*/
|
|
284
|
-
static SiriEndpoint;
|
|
285
|
-
/**
|
|
286
|
-
* @group Service Definitions
|
|
287
|
-
*/
|
|
288
|
-
static Slats;
|
|
289
|
-
/**
|
|
290
|
-
* @group Service Definitions
|
|
291
|
-
*/
|
|
292
|
-
static SmartSpeaker;
|
|
293
|
-
/**
|
|
294
|
-
* @group Service Definitions
|
|
295
|
-
*/
|
|
296
|
-
static SmokeSensor;
|
|
297
|
-
/**
|
|
298
|
-
* @group Service Definitions
|
|
299
|
-
*/
|
|
300
|
-
static Speaker;
|
|
301
|
-
/**
|
|
302
|
-
* @group Service Definitions
|
|
303
|
-
*/
|
|
304
|
-
static StatefulProgrammableSwitch;
|
|
305
|
-
/**
|
|
306
|
-
* @group Service Definitions
|
|
307
|
-
*/
|
|
308
|
-
static StatelessProgrammableSwitch;
|
|
309
|
-
/**
|
|
310
|
-
* @group Service Definitions
|
|
311
|
-
*/
|
|
312
|
-
static Switch;
|
|
313
|
-
/**
|
|
314
|
-
* @group Service Definitions
|
|
315
|
-
* @deprecated Removed
|
|
316
|
-
*/
|
|
317
|
-
static TapManagement;
|
|
318
|
-
/**
|
|
319
|
-
* @group Service Definitions
|
|
320
|
-
*/
|
|
321
|
-
static TargetControl;
|
|
322
|
-
/**
|
|
323
|
-
* @group Service Definitions
|
|
324
|
-
*/
|
|
325
|
-
static TargetControlManagement;
|
|
326
|
-
/**
|
|
327
|
-
* @group Service Definitions
|
|
328
|
-
*/
|
|
329
|
-
static Television;
|
|
330
|
-
/**
|
|
331
|
-
* @group Service Definitions
|
|
332
|
-
*/
|
|
333
|
-
static TelevisionSpeaker;
|
|
334
|
-
/**
|
|
335
|
-
* @group Service Definitions
|
|
336
|
-
*/
|
|
337
|
-
static TemperatureSensor;
|
|
338
|
-
/**
|
|
339
|
-
* @group Service Definitions
|
|
340
|
-
*/
|
|
341
|
-
static Thermostat;
|
|
342
|
-
/**
|
|
343
|
-
* @group Service Definitions
|
|
344
|
-
*/
|
|
345
|
-
static ThreadTransport;
|
|
346
|
-
/**
|
|
347
|
-
* @group Service Definitions
|
|
348
|
-
*/
|
|
349
|
-
static TransferTransportManagement;
|
|
350
|
-
/**
|
|
351
|
-
* @group Service Definitions
|
|
352
|
-
* @deprecated Removed
|
|
353
|
-
*/
|
|
354
|
-
static Tunnel;
|
|
355
|
-
/**
|
|
356
|
-
* @group Service Definitions
|
|
357
|
-
*/
|
|
358
|
-
static Valve;
|
|
359
|
-
/**
|
|
360
|
-
* @group Service Definitions
|
|
361
|
-
*/
|
|
362
|
-
static WiFiRouter;
|
|
363
|
-
/**
|
|
364
|
-
* @group Service Definitions
|
|
365
|
-
*/
|
|
366
|
-
static WiFiSatellite;
|
|
367
|
-
/**
|
|
368
|
-
* @group Service Definitions
|
|
369
|
-
*/
|
|
370
|
-
static WiFiTransport;
|
|
371
|
-
/**
|
|
372
|
-
* @group Service Definitions
|
|
373
|
-
*/
|
|
374
|
-
static Window;
|
|
375
|
-
/**
|
|
376
|
-
* @group Service Definitions
|
|
377
|
-
*/
|
|
378
|
-
static WindowCovering;
|
|
379
|
-
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
|
380
|
-
// NOTICE: when adding/changing properties, remember to possibly adjust the serialize/deserialize functions
|
|
381
|
-
displayName;
|
|
382
|
-
UUID;
|
|
383
|
-
subtype;
|
|
384
|
-
iid = null; // assigned later by our containing Accessory
|
|
385
|
-
name = null;
|
|
386
|
-
characteristics = [];
|
|
387
|
-
optionalCharacteristics = [];
|
|
388
|
-
/**
|
|
389
|
-
* @private
|
|
390
|
-
*/
|
|
391
|
-
isHiddenService = false;
|
|
392
|
-
/**
|
|
393
|
-
* @private
|
|
394
|
-
*/
|
|
395
|
-
isPrimaryService = false; // do not write to this directly
|
|
396
|
-
/**
|
|
397
|
-
* @private
|
|
398
|
-
*/
|
|
399
|
-
linkedServices = [];
|
|
400
|
-
constructor(displayName = "", UUID, subtype) {
|
|
401
|
-
super();
|
|
402
|
-
(0, assert_1.default)(UUID, "Services must be created with a valid UUID.");
|
|
403
|
-
this.displayName = displayName;
|
|
404
|
-
this.UUID = UUID;
|
|
405
|
-
this.subtype = subtype;
|
|
406
|
-
// every service has an optional Characteristic.Name property - we'll set it to our displayName
|
|
407
|
-
// if one was given
|
|
408
|
-
// if you don't provide a display name, some HomeKit apps may choose to hide the device.
|
|
409
|
-
if (displayName) {
|
|
410
|
-
// create the characteristic if necessary
|
|
411
|
-
(0, checkName_1.checkName)(this.displayName, "Name", displayName);
|
|
412
|
-
const nameCharacteristic = this.getCharacteristic(Characteristic_1.Characteristic.Name) ||
|
|
413
|
-
this.addCharacteristic(Characteristic_1.Characteristic.Name);
|
|
414
|
-
nameCharacteristic.updateValue(displayName);
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* Returns an id which uniquely identifies a service on the associated accessory.
|
|
419
|
-
* The serviceId is a concatenation of the UUID for the service (defined by HAP) and the subtype (could be empty)
|
|
420
|
-
* which is programmatically defined by the programmer.
|
|
421
|
-
*
|
|
422
|
-
* @returns the serviceId
|
|
423
|
-
*/
|
|
424
|
-
getServiceId() {
|
|
425
|
-
return this.UUID + (this.subtype || "");
|
|
426
|
-
}
|
|
427
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
428
|
-
addCharacteristic(input, ...constructorArgs) {
|
|
429
|
-
// characteristic might be a constructor like `Characteristic.Brightness` instead of an instance of Characteristic. Coerce if necessary.
|
|
430
|
-
const characteristic = typeof input === "function" ? new input(...constructorArgs) : input;
|
|
431
|
-
// check for UUID conflict
|
|
432
|
-
for (const existing of this.characteristics) {
|
|
433
|
-
if (existing.UUID === characteristic.UUID) {
|
|
434
|
-
if (characteristic.UUID === "00000052-0000-1000-8000-0026BB765291") {
|
|
435
|
-
//This is a special workaround for the Firmware Revision characteristic.
|
|
436
|
-
return existing;
|
|
437
|
-
}
|
|
438
|
-
throw new Error("Cannot add a Characteristic with the same UUID as another Characteristic in this Service: " + existing.UUID);
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
if (this.characteristics.length >= MAX_CHARACTERISTICS) {
|
|
442
|
-
throw new Error("Cannot add more than " + MAX_CHARACTERISTICS + " characteristics to a single service!");
|
|
443
|
-
}
|
|
444
|
-
this.setupCharacteristicEventHandlers(characteristic);
|
|
445
|
-
this.characteristics.push(characteristic);
|
|
446
|
-
this.emit("service-configurationChange" /* ServiceEventTypes.SERVICE_CONFIGURATION_CHANGE */);
|
|
447
|
-
return characteristic;
|
|
448
|
-
}
|
|
449
|
-
/**
|
|
450
|
-
* Sets this service as the new primary service.
|
|
451
|
-
* Any currently active primary service will be reset to be not primary.
|
|
452
|
-
* This will happen immediately, if the service was already added to an accessory, or later
|
|
453
|
-
* when the service gets added to an accessory.
|
|
454
|
-
*
|
|
455
|
-
* @param isPrimary - optional boolean (default true) if the service should be the primary service
|
|
456
|
-
*/
|
|
457
|
-
setPrimaryService(isPrimary = true) {
|
|
458
|
-
this.isPrimaryService = isPrimary;
|
|
459
|
-
this.emit("service-configurationChange" /* ServiceEventTypes.SERVICE_CONFIGURATION_CHANGE */);
|
|
460
|
-
}
|
|
461
|
-
/**
|
|
462
|
-
* Marks the service as hidden
|
|
463
|
-
*
|
|
464
|
-
* @param isHidden - optional boolean (default true) if the service should be marked hidden
|
|
465
|
-
*/
|
|
466
|
-
setHiddenService(isHidden = true) {
|
|
467
|
-
this.isHiddenService = isHidden;
|
|
468
|
-
this.emit("service-configurationChange" /* ServiceEventTypes.SERVICE_CONFIGURATION_CHANGE */);
|
|
469
|
-
}
|
|
470
|
-
/**
|
|
471
|
-
* Adds a new link to the specified service. The service MUST be already added to
|
|
472
|
-
* the SAME accessory.
|
|
473
|
-
*
|
|
474
|
-
* @param service - The service this service should link to
|
|
475
|
-
*/
|
|
476
|
-
addLinkedService(service) {
|
|
477
|
-
//TODO: Add a check if the service is on the same accessory.
|
|
478
|
-
if (!this.linkedServices.includes(service)) {
|
|
479
|
-
this.linkedServices.push(service);
|
|
480
|
-
}
|
|
481
|
-
this.emit("service-configurationChange" /* ServiceEventTypes.SERVICE_CONFIGURATION_CHANGE */);
|
|
482
|
-
}
|
|
483
|
-
/**
|
|
484
|
-
* Removes a link to the specified service which was previously added with {@link addLinkedService}
|
|
485
|
-
*
|
|
486
|
-
* @param service - Previously linked service
|
|
487
|
-
*/
|
|
488
|
-
removeLinkedService(service) {
|
|
489
|
-
//TODO: Add a check if the service is on the same accessory.
|
|
490
|
-
const index = this.linkedServices.indexOf(service);
|
|
491
|
-
if (index !== -1) {
|
|
492
|
-
this.linkedServices.splice(index, 1);
|
|
493
|
-
}
|
|
494
|
-
this.emit("service-configurationChange" /* ServiceEventTypes.SERVICE_CONFIGURATION_CHANGE */);
|
|
495
|
-
}
|
|
496
|
-
removeCharacteristic(characteristic) {
|
|
497
|
-
const index = this.characteristics.indexOf(characteristic);
|
|
498
|
-
if (index !== -1) {
|
|
499
|
-
this.characteristics.splice(index, 1);
|
|
500
|
-
characteristic.removeAllListeners();
|
|
501
|
-
this.emit("service-configurationChange" /* ServiceEventTypes.SERVICE_CONFIGURATION_CHANGE */);
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
getCharacteristic(name) {
|
|
505
|
-
// returns a characteristic object from the service
|
|
506
|
-
// If Service.prototype.getCharacteristic(Characteristic.Type) does not find the characteristic,
|
|
507
|
-
// but the type is in optionalCharacteristics, it adds the characteristic.type to the service and returns it.
|
|
508
|
-
for (const characteristic of this.characteristics) {
|
|
509
|
-
if (typeof name === "string" && characteristic.displayName === name) {
|
|
510
|
-
return characteristic;
|
|
511
|
-
}
|
|
512
|
-
else {
|
|
513
|
-
// @ts-expect-error ('UUID' does not exist on type 'never')
|
|
514
|
-
if (typeof name === "function" && ((characteristic instanceof name) || (name.UUID === characteristic.UUID))) {
|
|
515
|
-
return characteristic;
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
if (typeof name === "function") {
|
|
520
|
-
for (const characteristic of this.optionalCharacteristics) {
|
|
521
|
-
// @ts-expect-error ('UUID' does not exist on type 'never')
|
|
522
|
-
if ((characteristic instanceof name) || (name.UUID === characteristic.UUID)) {
|
|
523
|
-
return this.addCharacteristic(name);
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
const instance = this.addCharacteristic(name);
|
|
527
|
-
// Not found in optional Characteristics. Adding anyway, but warning about it if it isn't the Name.
|
|
528
|
-
if (name.UUID !== Characteristic_1.Characteristic.Name.UUID) {
|
|
529
|
-
this.emitCharacteristicWarningEvent(instance, "warn-message" /* CharacteristicWarningType.WARN_MESSAGE */, "Characteristic not in required or optional characteristic section for service " + this.constructor.name + ". Adding anyway.");
|
|
530
|
-
}
|
|
531
|
-
return instance;
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
testCharacteristic(name) {
|
|
535
|
-
// checks for the existence of a characteristic object in the service
|
|
536
|
-
for (const characteristic of this.characteristics) {
|
|
537
|
-
if (typeof name === "string" && characteristic.displayName === name) {
|
|
538
|
-
return true;
|
|
539
|
-
}
|
|
540
|
-
else {
|
|
541
|
-
// @ts-expect-error ('UUID' does not exist on type 'never')
|
|
542
|
-
if (typeof name === "function" && ((characteristic instanceof name) || (name.UUID === characteristic.UUID))) {
|
|
543
|
-
return true;
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
return false;
|
|
548
|
-
}
|
|
549
|
-
setCharacteristic(name, value) {
|
|
550
|
-
// @ts-expect-error: We know that both overloads exists individually. There is just no publicly exposed type for that!
|
|
551
|
-
this.getCharacteristic(name).setValue(value);
|
|
552
|
-
return this; // for chaining
|
|
553
|
-
}
|
|
554
|
-
updateCharacteristic(name, value) {
|
|
555
|
-
this.getCharacteristic(name).updateValue(value);
|
|
556
|
-
return this;
|
|
557
|
-
}
|
|
558
|
-
addOptionalCharacteristic(characteristic) {
|
|
559
|
-
// characteristic might be a constructor like `Characteristic.Brightness` instead of an instance
|
|
560
|
-
// of Characteristic. Coerce if necessary.
|
|
561
|
-
if (typeof characteristic === "function") {
|
|
562
|
-
characteristic = new characteristic();
|
|
563
|
-
}
|
|
564
|
-
this.optionalCharacteristics.push(characteristic);
|
|
565
|
-
}
|
|
566
|
-
// noinspection JSUnusedGlobalSymbols
|
|
567
|
-
/**
|
|
568
|
-
* This method was created to copy all characteristics from another service to this.
|
|
569
|
-
* It's only adopting is currently in homebridge to merge the AccessoryInformation service. So some things
|
|
570
|
-
* may be explicitly tailored towards this use case.
|
|
571
|
-
*
|
|
572
|
-
* It will not remove characteristics which are present currently but not added on the other characteristic.
|
|
573
|
-
* It will not replace the characteristic if the value is falsy (except of '0' or 'false')
|
|
574
|
-
* @param service
|
|
575
|
-
* @private used by homebridge
|
|
576
|
-
*/
|
|
577
|
-
replaceCharacteristicsFromService(service) {
|
|
578
|
-
if (this.UUID !== service.UUID) {
|
|
579
|
-
throw new Error(`Incompatible services. Tried replacing characteristics of ${this.UUID} with characteristics from ${service.UUID}`);
|
|
580
|
-
}
|
|
581
|
-
const foreignCharacteristics = {}; // index foreign characteristics by UUID
|
|
582
|
-
service.characteristics.forEach(characteristic => foreignCharacteristics[characteristic.UUID] = characteristic);
|
|
583
|
-
this.characteristics.forEach(characteristic => {
|
|
584
|
-
const foreignCharacteristic = foreignCharacteristics[characteristic.UUID];
|
|
585
|
-
if (foreignCharacteristic) {
|
|
586
|
-
delete foreignCharacteristics[characteristic.UUID];
|
|
587
|
-
if (!foreignCharacteristic.value && foreignCharacteristic.value !== 0 && foreignCharacteristic.value !== false) {
|
|
588
|
-
return; // ignore falsy values except if it's the number zero or literally false
|
|
589
|
-
}
|
|
590
|
-
characteristic.replaceBy(foreignCharacteristic);
|
|
591
|
-
}
|
|
592
|
-
});
|
|
593
|
-
// add all additional characteristics which where not present already
|
|
594
|
-
Object.values(foreignCharacteristics).forEach(characteristic => this.addCharacteristic(characteristic));
|
|
595
|
-
}
|
|
596
|
-
/**
|
|
597
|
-
* @private
|
|
598
|
-
*/
|
|
599
|
-
getCharacteristicByIID(iid) {
|
|
600
|
-
for (const characteristic of this.characteristics) {
|
|
601
|
-
if (characteristic.iid === iid) {
|
|
602
|
-
return characteristic;
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
/**
|
|
607
|
-
* @private
|
|
608
|
-
*/
|
|
609
|
-
_assignIDs(identifierCache, accessoryName, baseIID = 0) {
|
|
610
|
-
// the Accessory Information service must have a (reserved by IdentifierCache) ID of 1
|
|
611
|
-
if (this.UUID === "0000003E-0000-1000-8000-0026BB765291") {
|
|
612
|
-
this.iid = 1;
|
|
613
|
-
}
|
|
614
|
-
else {
|
|
615
|
-
// assign our own ID based on our UUID
|
|
616
|
-
this.iid = baseIID + identifierCache.getIID(accessoryName, this.UUID, this.subtype);
|
|
617
|
-
}
|
|
618
|
-
// assign IIDs to our Characteristics
|
|
619
|
-
for (const characteristic of this.characteristics) {
|
|
620
|
-
characteristic._assignID(identifierCache, accessoryName, this.UUID, this.subtype);
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
/**
|
|
624
|
-
* Returns a JSON representation of this service suitable for delivering to HAP clients.
|
|
625
|
-
* @private used to generate response to /accessories query
|
|
626
|
-
*/
|
|
627
|
-
toHAP(connection, contactGetHandlers = true) {
|
|
628
|
-
return new Promise(resolve => {
|
|
629
|
-
(0, assert_1.default)(this.iid, "iid cannot be undefined for service '" + this.displayName + "'");
|
|
630
|
-
(0, assert_1.default)(this.characteristics.length, "service '" + this.displayName + "' does not have any characteristics!");
|
|
631
|
-
const service = {
|
|
632
|
-
type: (0, uuid_1.toShortForm)(this.UUID),
|
|
633
|
-
iid: this.iid,
|
|
634
|
-
characteristics: [],
|
|
635
|
-
hidden: this.isHiddenService ? true : undefined,
|
|
636
|
-
primary: this.isPrimaryService ? true : undefined,
|
|
637
|
-
};
|
|
638
|
-
if (this.linkedServices.length) {
|
|
639
|
-
service.linked = [];
|
|
640
|
-
for (const linked of this.linkedServices) {
|
|
641
|
-
if (!linked.iid) {
|
|
642
|
-
// we got a linked service which is not added to the accessory
|
|
643
|
-
// as it doesn't "exists" we just ignore it.
|
|
644
|
-
// we have some (at least one) plugins on homebridge which link to the AccessoryInformation service.
|
|
645
|
-
// homebridge always creates its own AccessoryInformation service and ignores the user supplied one
|
|
646
|
-
// thus the link is automatically broken.
|
|
647
|
-
debug(`iid of linked service '${linked.displayName}' ${linked.UUID} is undefined on service '${this.displayName}'`);
|
|
648
|
-
continue;
|
|
649
|
-
}
|
|
650
|
-
service.linked.push(linked.iid);
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
const missingCharacteristics = new Set();
|
|
654
|
-
let timeout = setTimeout(() => {
|
|
655
|
-
for (const characteristic of missingCharacteristics) {
|
|
656
|
-
this.emitCharacteristicWarningEvent(characteristic, "slow-read" /* CharacteristicWarningType.SLOW_READ */, `The read handler for the characteristic '${characteristic.displayName}' was slow to respond!`);
|
|
657
|
-
}
|
|
658
|
-
timeout = setTimeout(() => {
|
|
659
|
-
timeout = undefined;
|
|
660
|
-
for (const characteristic of missingCharacteristics) {
|
|
661
|
-
this.emitCharacteristicWarningEvent(characteristic, "timeout-read" /* CharacteristicWarningType.TIMEOUT_READ */, "The read handler for the characteristic '" + characteristic?.displayName +
|
|
662
|
-
"' didn't respond at all!. Please check that you properly call the callback!");
|
|
663
|
-
service.characteristics.push(characteristic.internalHAPRepresentation()); // value is set to null
|
|
664
|
-
}
|
|
665
|
-
missingCharacteristics.clear();
|
|
666
|
-
resolve(service);
|
|
667
|
-
}, 6000);
|
|
668
|
-
}, 3000);
|
|
669
|
-
for (const characteristic of this.characteristics) {
|
|
670
|
-
missingCharacteristics.add(characteristic);
|
|
671
|
-
characteristic.toHAP(connection, contactGetHandlers).then(value => {
|
|
672
|
-
if (!timeout) {
|
|
673
|
-
return; // if timeout is undefined, response was already sent out
|
|
674
|
-
}
|
|
675
|
-
missingCharacteristics.delete(characteristic);
|
|
676
|
-
service.characteristics.push(value);
|
|
677
|
-
if (missingCharacteristics.size === 0) {
|
|
678
|
-
if (timeout) {
|
|
679
|
-
clearTimeout(timeout);
|
|
680
|
-
timeout = undefined;
|
|
681
|
-
}
|
|
682
|
-
resolve(service);
|
|
683
|
-
}
|
|
684
|
-
});
|
|
685
|
-
}
|
|
686
|
-
});
|
|
687
|
-
}
|
|
688
|
-
/**
|
|
689
|
-
* Returns a JSON representation of this service without characteristic values.
|
|
690
|
-
* @private used to generate the config hash
|
|
691
|
-
*/
|
|
692
|
-
internalHAPRepresentation() {
|
|
693
|
-
(0, assert_1.default)(this.iid, "iid cannot be undefined for service '" + this.displayName + "'");
|
|
694
|
-
(0, assert_1.default)(this.characteristics.length, "service '" + this.displayName + "' does not have any characteristics!");
|
|
695
|
-
const service = {
|
|
696
|
-
type: (0, uuid_1.toShortForm)(this.UUID),
|
|
697
|
-
iid: this.iid,
|
|
698
|
-
characteristics: this.characteristics.map(characteristic => characteristic.internalHAPRepresentation()),
|
|
699
|
-
hidden: this.isHiddenService ? true : undefined,
|
|
700
|
-
primary: this.isPrimaryService ? true : undefined,
|
|
701
|
-
};
|
|
702
|
-
if (this.linkedServices.length) {
|
|
703
|
-
service.linked = [];
|
|
704
|
-
for (const linked of this.linkedServices) {
|
|
705
|
-
if (!linked.iid) {
|
|
706
|
-
// we got a linked service which is not added to the accessory
|
|
707
|
-
// as it doesn't "exists" we just ignore it.
|
|
708
|
-
// we have some (at least one) plugins on homebridge which link to the AccessoryInformation service.
|
|
709
|
-
// homebridge always creates its own AccessoryInformation service and ignores the user supplied one
|
|
710
|
-
// thus the link is automatically broken.
|
|
711
|
-
debug(`iid of linked service '${linked.displayName}' ${linked.UUID} is undefined on service '${this.displayName}'`);
|
|
712
|
-
continue;
|
|
713
|
-
}
|
|
714
|
-
service.linked.push(linked.iid);
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
return service;
|
|
718
|
-
}
|
|
719
|
-
/**
|
|
720
|
-
* @private
|
|
721
|
-
*/
|
|
722
|
-
setupCharacteristicEventHandlers(characteristic) {
|
|
723
|
-
// listen for changes in characteristics and bubble them up
|
|
724
|
-
characteristic.on("change" /* CharacteristicEventTypes.CHANGE */, (change) => {
|
|
725
|
-
this.emit("characteristic-change" /* ServiceEventTypes.CHARACTERISTIC_CHANGE */, { ...change, characteristic: characteristic });
|
|
726
|
-
});
|
|
727
|
-
characteristic.on("characteristic-warning" /* CharacteristicEventTypes.CHARACTERISTIC_WARNING */, this.emitCharacteristicWarningEvent.bind(this, characteristic));
|
|
728
|
-
}
|
|
729
|
-
/**
|
|
730
|
-
* @private
|
|
731
|
-
*/
|
|
732
|
-
emitCharacteristicWarningEvent(characteristic, type, message, stack) {
|
|
733
|
-
this.emit("characteristic-warning" /* ServiceEventTypes.CHARACTERISTIC_WARNING */, {
|
|
734
|
-
characteristic: characteristic,
|
|
735
|
-
type: type,
|
|
736
|
-
message: message,
|
|
737
|
-
originatorChain: [this.displayName, characteristic.displayName],
|
|
738
|
-
stack: stack,
|
|
739
|
-
});
|
|
740
|
-
}
|
|
741
|
-
/**
|
|
742
|
-
* @private
|
|
743
|
-
*/
|
|
744
|
-
_sideloadCharacteristics(targetCharacteristics) {
|
|
745
|
-
for (const target of targetCharacteristics) {
|
|
746
|
-
this.setupCharacteristicEventHandlers(target);
|
|
747
|
-
}
|
|
748
|
-
this.characteristics = targetCharacteristics.slice();
|
|
749
|
-
}
|
|
750
|
-
/**
|
|
751
|
-
* @private
|
|
752
|
-
*/
|
|
753
|
-
static serialize(service) {
|
|
754
|
-
let constructorName;
|
|
755
|
-
if (service.constructor.name !== "Service") {
|
|
756
|
-
constructorName = service.constructor.name;
|
|
757
|
-
}
|
|
758
|
-
return {
|
|
759
|
-
displayName: service.displayName,
|
|
760
|
-
UUID: service.UUID,
|
|
761
|
-
subtype: service.subtype,
|
|
762
|
-
constructorName: constructorName,
|
|
763
|
-
hiddenService: service.isHiddenService,
|
|
764
|
-
primaryService: service.isPrimaryService,
|
|
765
|
-
characteristics: service.characteristics.map(characteristic => Characteristic_1.Characteristic.serialize(characteristic)),
|
|
766
|
-
optionalCharacteristics: service.optionalCharacteristics.map(characteristic => Characteristic_1.Characteristic.serialize(characteristic)),
|
|
767
|
-
};
|
|
768
|
-
}
|
|
769
|
-
/**
|
|
770
|
-
* @private
|
|
771
|
-
*/
|
|
772
|
-
static deserialize(json) {
|
|
773
|
-
let service;
|
|
774
|
-
if (json.constructorName && json.constructorName.charAt(0).toUpperCase() === json.constructorName.charAt(0)
|
|
775
|
-
&& Service[json.constructorName]) { // MUST start with uppercase character and must exist on Service object
|
|
776
|
-
const constructor = Service[json.constructorName];
|
|
777
|
-
service = new constructor(json.displayName, json.subtype);
|
|
778
|
-
}
|
|
779
|
-
else {
|
|
780
|
-
service = new Service(json.displayName, json.UUID, json.subtype);
|
|
781
|
-
}
|
|
782
|
-
service.isHiddenService = !!json.hiddenService;
|
|
783
|
-
service.isPrimaryService = !!json.primaryService;
|
|
784
|
-
const characteristics = json.characteristics.map(serialized => Characteristic_1.Characteristic.deserialize(serialized));
|
|
785
|
-
service._sideloadCharacteristics(characteristics);
|
|
786
|
-
if (json.optionalCharacteristics) {
|
|
787
|
-
service.optionalCharacteristics = json.optionalCharacteristics.map(serialized => Characteristic_1.Characteristic.deserialize(serialized));
|
|
788
|
-
}
|
|
789
|
-
return service;
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
exports.Service = Service;
|
|
793
|
-
// We have a cyclic dependency problem. Within this file we have the definitions of "./definitions" as
|
|
794
|
-
// type imports only (in order to define the static properties). Setting those properties is done outside
|
|
795
|
-
// this file, within the definition files. Therefore, we import it at the end of this file. Seems weird, but is important.
|
|
796
|
-
require("./definitions/ServiceDefinitions");
|
|
797
|
-
//# sourceMappingURL=Service.js.map
|