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
|
@@ -153,7 +153,9 @@ export class HapGenericAccessory {
|
|
|
153
153
|
if (!info)
|
|
154
154
|
return;
|
|
155
155
|
const mfr = "Matter All-In-One Chrisalvir";
|
|
156
|
-
const model = (this.record.model ||
|
|
156
|
+
const model = (this.record.model ||
|
|
157
|
+
HAP_PROFILE_LABELS[this.record.hapProfile] ||
|
|
158
|
+
"HAP Device")
|
|
157
159
|
.replace(/\s*\(HAP-NodeJS[^)]*\)/gi, "")
|
|
158
160
|
.trim();
|
|
159
161
|
info
|
|
@@ -168,8 +170,8 @@ export class HapGenericAccessory {
|
|
|
168
170
|
// Sensores reales del mismo dispositivo de Home Assistant
|
|
169
171
|
// ──────────────────────────────────────────────
|
|
170
172
|
getHomeAssistantState(entityId) {
|
|
171
|
-
return this.platform.ha?.hassStates?.get(entityId) ??
|
|
172
|
-
this.platform.entities.get(entityId)?.state;
|
|
173
|
+
return (this.platform.ha?.hassStates?.get(entityId) ??
|
|
174
|
+
this.platform.entities.get(entityId)?.state);
|
|
173
175
|
}
|
|
174
176
|
getDeviceMembers() {
|
|
175
177
|
const own = { entityId: this.entityId };
|
|
@@ -191,14 +193,21 @@ export class HapGenericAccessory {
|
|
|
191
193
|
}
|
|
192
194
|
bindDiscoveredSensor(entityId, serviceType, characteristic, suffix, read) {
|
|
193
195
|
const service = this.accessory.addService(serviceType, `${this.record.name} ${suffix}`, `sensor:${entityId}`);
|
|
194
|
-
service
|
|
195
|
-
|
|
196
|
+
service
|
|
197
|
+
.getCharacteristic(characteristic)
|
|
198
|
+
.onGet(() => read(this.getHomeAssistantState(entityId)));
|
|
199
|
+
this.discoveredSensorBindings.set(entityId, {
|
|
200
|
+
service,
|
|
201
|
+
characteristic,
|
|
202
|
+
read,
|
|
203
|
+
});
|
|
196
204
|
}
|
|
197
205
|
addDiscoveredSensorServices() {
|
|
198
206
|
const members = this.getDeviceMembers();
|
|
199
207
|
const find = (domain, deviceClass) => members.find((item) => {
|
|
200
208
|
const state = this.getHomeAssistantState(item.entityId);
|
|
201
|
-
return item.entityId.startsWith(`${domain}.`) &&
|
|
209
|
+
return (item.entityId.startsWith(`${domain}.`) &&
|
|
210
|
+
state?.attributes?.device_class === deviceClass);
|
|
202
211
|
});
|
|
203
212
|
const numeric = (deviceClass, serviceType, characteristic, suffix, minimum = 0) => {
|
|
204
213
|
const member = find("sensor", deviceClass);
|
|
@@ -212,19 +221,58 @@ export class HapGenericAccessory {
|
|
|
212
221
|
// Only device members reported by HA are exported. No guessed sensor names,
|
|
213
222
|
// values, or entities are created for HAP.
|
|
214
223
|
numeric("temperature", Service.TemperatureSensor, Characteristic.CurrentTemperature, "Temperatura");
|
|
215
|
-
if (this.record.hapProfile !== "humidifier" &&
|
|
224
|
+
if (this.record.hapProfile !== "humidifier" &&
|
|
225
|
+
this.record.hapProfile !== "dehumidifier") {
|
|
216
226
|
numeric("humidity", Service.HumiditySensor, Characteristic.CurrentRelativeHumidity, "Humedad");
|
|
217
227
|
}
|
|
218
228
|
numeric("illuminance", Service.LightSensor, Characteristic.CurrentAmbientLightLevel, "Iluminación", 0.0001);
|
|
219
229
|
numeric("battery", Service.Battery, Characteristic.BatteryLevel, "Batería");
|
|
220
230
|
const binaryMappings = [
|
|
221
|
-
[
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
231
|
+
[
|
|
232
|
+
"motion",
|
|
233
|
+
Service.MotionSensor,
|
|
234
|
+
Characteristic.MotionDetected,
|
|
235
|
+
"Movimiento",
|
|
236
|
+
(state) => state?.state === "on",
|
|
237
|
+
],
|
|
238
|
+
[
|
|
239
|
+
"door",
|
|
240
|
+
Service.ContactSensor,
|
|
241
|
+
Characteristic.ContactSensorState,
|
|
242
|
+
"Puerta",
|
|
243
|
+
(state) => state?.state === "on"
|
|
244
|
+
? Characteristic.ContactSensorState.CONTACT_NOT_DETECTED
|
|
245
|
+
: Characteristic.ContactSensorState.CONTACT_DETECTED,
|
|
246
|
+
],
|
|
247
|
+
[
|
|
248
|
+
"window",
|
|
249
|
+
Service.ContactSensor,
|
|
250
|
+
Characteristic.ContactSensorState,
|
|
251
|
+
"Ventana",
|
|
252
|
+
(state) => state?.state === "on"
|
|
253
|
+
? Characteristic.ContactSensorState.CONTACT_NOT_DETECTED
|
|
254
|
+
: Characteristic.ContactSensorState.CONTACT_DETECTED,
|
|
255
|
+
],
|
|
256
|
+
[
|
|
257
|
+
"moisture",
|
|
258
|
+
Service.LeakSensor,
|
|
259
|
+
Characteristic.LeakDetected,
|
|
260
|
+
"Fuga",
|
|
261
|
+
(state) => state?.state === "on"
|
|
262
|
+
? Characteristic.LeakDetected.LEAK_DETECTED
|
|
263
|
+
: Characteristic.LeakDetected.LEAK_NOT_DETECTED,
|
|
264
|
+
],
|
|
265
|
+
[
|
|
266
|
+
"smoke",
|
|
267
|
+
Service.SmokeSensor,
|
|
268
|
+
Characteristic.SmokeDetected,
|
|
269
|
+
"Humo",
|
|
270
|
+
(state) => state?.state === "on"
|
|
271
|
+
? Characteristic.SmokeDetected.SMOKE_DETECTED
|
|
272
|
+
: Characteristic.SmokeDetected.SMOKE_NOT_DETECTED,
|
|
273
|
+
],
|
|
226
274
|
];
|
|
227
|
-
for (const [deviceClass, serviceType, characteristic, suffix, read] of binaryMappings) {
|
|
275
|
+
for (const [deviceClass, serviceType, characteristic, suffix, read,] of binaryMappings) {
|
|
228
276
|
const member = find("binary_sensor", deviceClass);
|
|
229
277
|
if (member)
|
|
230
278
|
this.bindDiscoveredSensor(member.entityId, serviceType, characteristic, suffix, read);
|
|
@@ -236,20 +284,111 @@ export class HapGenericAccessory {
|
|
|
236
284
|
return primary;
|
|
237
285
|
const sensor = this.getDeviceMembers().find((member) => {
|
|
238
286
|
const state = this.getHomeAssistantState(member.entityId);
|
|
239
|
-
return member.entityId.startsWith("sensor.") &&
|
|
287
|
+
return (member.entityId.startsWith("sensor.") &&
|
|
288
|
+
state?.attributes?.device_class === "humidity");
|
|
240
289
|
});
|
|
241
290
|
const value = Number(sensor && this.getHomeAssistantState(sensor.entityId)?.state);
|
|
242
|
-
return Number.isFinite(value) && value >= 0 && value <= 100
|
|
291
|
+
return Number.isFinite(value) && value >= 0 && value <= 100
|
|
292
|
+
? value
|
|
293
|
+
: undefined;
|
|
294
|
+
}
|
|
295
|
+
getMediaEntityId() {
|
|
296
|
+
if (this.entityId.startsWith("media_player."))
|
|
297
|
+
return this.entityId;
|
|
298
|
+
const devId = this.platform.entities.get(this.entityId)
|
|
299
|
+
?.haDeviceInfo?.id;
|
|
300
|
+
if (devId) {
|
|
301
|
+
for (const [id, ent] of this.platform.entities.entries()) {
|
|
302
|
+
if (id.startsWith("media_player.") &&
|
|
303
|
+
ent?.haDeviceInfo?.id === devId) {
|
|
304
|
+
return id;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
const base = this.entityId.replace(/^[^.]+\./, "").split("_")[0];
|
|
309
|
+
for (const id of this.platform.entities.keys()) {
|
|
310
|
+
if (id.startsWith("media_player.") && id.includes(base))
|
|
311
|
+
return id;
|
|
312
|
+
}
|
|
313
|
+
return this.entityId;
|
|
314
|
+
}
|
|
315
|
+
getRemoteEntityId() {
|
|
316
|
+
const deviceId = this.platform.ha?.hassEntities?.get(this.entityId)?.device_id ??
|
|
317
|
+
this.platform.entities.get(this.entityId)?.haDeviceInfo?.id;
|
|
318
|
+
if (deviceId && this.platform.ha?.hassEntities) {
|
|
319
|
+
for (const entity of this.platform.ha.hassEntities.values()) {
|
|
320
|
+
if (entity.device_id === deviceId &&
|
|
321
|
+
entity.entity_id.startsWith("remote.")) {
|
|
322
|
+
return entity.entity_id;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
const members = this.getDeviceMembers();
|
|
327
|
+
const remote = members.find((m) => m.entityId.startsWith("remote."));
|
|
328
|
+
if (remote)
|
|
329
|
+
return remote.entityId;
|
|
330
|
+
const base = this.entityId.replace(/^[^.]+\./, "").split("_")[0];
|
|
331
|
+
for (const id of this.platform.ha?.hassStates?.keys() ??
|
|
332
|
+
this.platform.entities.keys()) {
|
|
333
|
+
if (id.startsWith("remote.") && id.includes(base))
|
|
334
|
+
return id;
|
|
335
|
+
}
|
|
336
|
+
return undefined;
|
|
243
337
|
}
|
|
244
|
-
|
|
338
|
+
getMuteSwitchEntityId() {
|
|
339
|
+
const deviceId = this.platform.ha?.hassEntities?.get(this.entityId)?.device_id ??
|
|
340
|
+
this.platform.entities.get(this.entityId)?.haDeviceInfo?.id;
|
|
341
|
+
if (deviceId && this.platform.ha?.hassEntities) {
|
|
342
|
+
for (const entity of this.platform.ha.hassEntities.values()) {
|
|
343
|
+
if (entity.device_id === deviceId &&
|
|
344
|
+
entity.entity_id.startsWith("switch.") &&
|
|
345
|
+
entity.entity_id.toLowerCase().includes("mute")) {
|
|
346
|
+
return entity.entity_id;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
const members = this.getDeviceMembers();
|
|
351
|
+
const sw = members.find((m) => m.entityId.startsWith("switch.") &&
|
|
352
|
+
m.entityId.toLowerCase().includes("mute"));
|
|
353
|
+
if (sw)
|
|
354
|
+
return sw.entityId;
|
|
355
|
+
const base = this.entityId.replace(/^[^.]+\./, "").split("_")[0];
|
|
356
|
+
for (const id of this.platform.ha?.hassStates?.keys() ??
|
|
357
|
+
this.platform.entities.keys()) {
|
|
358
|
+
if (id.startsWith("switch.") &&
|
|
359
|
+
id.toLowerCase().includes("mute") &&
|
|
360
|
+
id.includes(base))
|
|
361
|
+
return id;
|
|
362
|
+
}
|
|
363
|
+
return undefined;
|
|
364
|
+
}
|
|
365
|
+
getDeviceButton(action) {
|
|
366
|
+
const deviceId = this.platform.ha?.hassEntities?.get(this.entityId)?.device_id ??
|
|
367
|
+
this.platform.entities.get(this.entityId)?.haDeviceInfo?.id;
|
|
368
|
+
if (deviceId && this.platform.ha?.hassEntities) {
|
|
369
|
+
for (const entity of this.platform.ha.hassEntities.values()) {
|
|
370
|
+
if (entity.device_id === deviceId &&
|
|
371
|
+
entity.entity_id.startsWith("button.")) {
|
|
372
|
+
const lower = entity.entity_id.toLowerCase();
|
|
373
|
+
if (lower.endsWith(`_${action}`) || lower.endsWith(`.${action}`)) {
|
|
374
|
+
return entity.entity_id;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
return undefined;
|
|
380
|
+
}
|
|
381
|
+
async callHaWithResponseBudget(domain, service, data, targetEntityId) {
|
|
382
|
+
const target = targetEntityId || this.entityId;
|
|
245
383
|
const startedAt = Date.now();
|
|
246
384
|
const command = `${domain}.${service}`;
|
|
247
|
-
this.platform.log?.info?.(`[HAPCommandTrace][${
|
|
248
|
-
if (!this.platform.ha?.callService ||
|
|
385
|
+
this.platform.log?.info?.(`[HAPCommandTrace][${target}] start service=${command}`);
|
|
386
|
+
if (!this.platform.ha?.callService ||
|
|
387
|
+
this.platform.ha.connected === false) {
|
|
249
388
|
throw -70402; // HAP SERVICE_COMMUNICATION_FAILURE
|
|
250
389
|
}
|
|
251
390
|
const operation = Promise.resolve()
|
|
252
|
-
.then(() => this.platform.ha.callService(domain, service,
|
|
391
|
+
.then(() => this.platform.ha.callService(domain, service, target, data))
|
|
253
392
|
.then(() => ({ failed: false }), (error) => ({ failed: true, error }));
|
|
254
393
|
let timer;
|
|
255
394
|
const outcome = await Promise.race([
|
|
@@ -261,15 +400,17 @@ export class HapGenericAccessory {
|
|
|
261
400
|
if (timer)
|
|
262
401
|
clearTimeout(timer);
|
|
263
402
|
const report = (failed, late) => {
|
|
264
|
-
this.platform.log?.info?.(`[HAPCommandTrace][${
|
|
403
|
+
this.platform.log?.info?.(`[HAPCommandTrace][${target}] ${late ? "ha_finished_after_handler" : "handler_returned"} service=${command} elapsed_ms=${Date.now() - startedAt} outcome=${failed ? "failed" : "completed"}`);
|
|
265
404
|
if (failed) {
|
|
266
405
|
this.setReachability(false);
|
|
267
|
-
this.platform.recordEntityCommandFailure?.(
|
|
406
|
+
this.platform.recordEntityCommandFailure?.(target, `HAP: Home Assistant failed to execute ${command}.`);
|
|
268
407
|
}
|
|
269
408
|
};
|
|
270
409
|
if (outcome === undefined) {
|
|
271
|
-
this.platform.log?.info?.(`[HAPCommandTrace][${
|
|
272
|
-
void operation
|
|
410
|
+
this.platform.log?.info?.(`[HAPCommandTrace][${target}] handler_returned_pending service=${command} elapsed_ms=${Date.now() - startedAt}`);
|
|
411
|
+
void operation
|
|
412
|
+
.then((result) => report(result.failed, true))
|
|
413
|
+
.catch(() => undefined);
|
|
273
414
|
return;
|
|
274
415
|
}
|
|
275
416
|
report(outcome.failed, false);
|
|
@@ -280,8 +421,9 @@ export class HapGenericAccessory {
|
|
|
280
421
|
const [domain] = this.entityId.split(".");
|
|
281
422
|
const state = () => this.platform.entities.get(this.entityId)?.state;
|
|
282
423
|
const bindPower = (service, characteristic) => {
|
|
283
|
-
service
|
|
284
|
-
.
|
|
424
|
+
service
|
|
425
|
+
.getCharacteristic(characteristic)
|
|
426
|
+
.onGet(() => (state()?.state === "on" ? 1 : 0))
|
|
285
427
|
.onSet(async (value) => {
|
|
286
428
|
await this.callHaWithResponseBudget(domain, value ? "turn_on" : "turn_off");
|
|
287
429
|
});
|
|
@@ -297,18 +439,31 @@ export class HapGenericAccessory {
|
|
|
297
439
|
const service = this.accessory.getService(Service.Lightbulb);
|
|
298
440
|
if (service) {
|
|
299
441
|
bindPower(service, Characteristic.On);
|
|
300
|
-
service
|
|
301
|
-
.
|
|
302
|
-
.
|
|
442
|
+
service
|
|
443
|
+
.getCharacteristic(Characteristic.Brightness)
|
|
444
|
+
.onGet(() => Math.round(((Number(state()?.attributes?.brightness) || 0) * 100) / 255))
|
|
445
|
+
.onSet(async (value) => this.callHaWithResponseBudget("light", "turn_on", {
|
|
446
|
+
brightness_pct: Number(value),
|
|
447
|
+
}));
|
|
303
448
|
const color = () => state()?.attributes?.hs_color;
|
|
304
449
|
if (Array.isArray(color())) {
|
|
305
|
-
service
|
|
306
|
-
|
|
450
|
+
service
|
|
451
|
+
.getCharacteristic(Characteristic.Hue)
|
|
452
|
+
.onGet(() => Number(color()?.[0]) || 0);
|
|
453
|
+
service
|
|
454
|
+
.getCharacteristic(Characteristic.Saturation)
|
|
455
|
+
.onGet(() => Number(color()?.[1]) || 0);
|
|
307
456
|
const setColor = async () => this.callHaWithResponseBudget("light", "turn_on", {
|
|
308
|
-
hs_color: [
|
|
457
|
+
hs_color: [
|
|
458
|
+
Number(service.getCharacteristic(Characteristic.Hue).value || 0),
|
|
459
|
+
Number(service.getCharacteristic(Characteristic.Saturation)
|
|
460
|
+
.value || 0),
|
|
461
|
+
],
|
|
309
462
|
});
|
|
310
463
|
service.getCharacteristic(Characteristic.Hue).onSet(setColor);
|
|
311
|
-
service
|
|
464
|
+
service
|
|
465
|
+
.getCharacteristic(Characteristic.Saturation)
|
|
466
|
+
.onSet(setColor);
|
|
312
467
|
}
|
|
313
468
|
}
|
|
314
469
|
break;
|
|
@@ -322,21 +477,30 @@ export class HapGenericAccessory {
|
|
|
322
477
|
const min = Number(attrs.min ?? 0);
|
|
323
478
|
const max = Number(attrs.max ?? 100);
|
|
324
479
|
const step = Number(attrs.step ?? 1);
|
|
325
|
-
return {
|
|
480
|
+
return {
|
|
481
|
+
min,
|
|
482
|
+
max: max > min ? max : min + 1,
|
|
483
|
+
step: step > 0 ? step : 1,
|
|
484
|
+
};
|
|
326
485
|
};
|
|
327
486
|
const percentForValue = () => {
|
|
328
487
|
const { min, max } = range();
|
|
329
488
|
const value = Number(state()?.state);
|
|
330
|
-
return Math.max(0, Math.min(100, Math.round(((Number.isFinite(value) ? value : min) - min) * 100 /
|
|
489
|
+
return Math.max(0, Math.min(100, Math.round((((Number.isFinite(value) ? value : min) - min) * 100) /
|
|
490
|
+
(max - min))));
|
|
331
491
|
};
|
|
332
|
-
service
|
|
492
|
+
service
|
|
493
|
+
?.getCharacteristic(Characteristic.On)
|
|
333
494
|
.onGet(() => 1)
|
|
334
495
|
.onSet(async () => undefined);
|
|
335
|
-
service
|
|
496
|
+
service
|
|
497
|
+
?.getCharacteristic(Characteristic.Brightness)
|
|
336
498
|
.onGet(percentForValue)
|
|
337
499
|
.onSet(async (percent) => {
|
|
338
500
|
const { min, max, step } = range();
|
|
339
|
-
const raw = min +
|
|
501
|
+
const raw = min +
|
|
502
|
+
(Math.max(0, Math.min(100, Number(percent) || 0)) / 100) *
|
|
503
|
+
(max - min);
|
|
340
504
|
const value = Math.max(min, Math.min(max, Math.round((raw - min) / step) * step + min));
|
|
341
505
|
await this.callHaWithResponseBudget(domain, "set_value", { value });
|
|
342
506
|
});
|
|
@@ -346,9 +510,12 @@ export class HapGenericAccessory {
|
|
|
346
510
|
const service = this.accessory.getService(Service.Fanv2);
|
|
347
511
|
if (service) {
|
|
348
512
|
bindPower(service, Characteristic.Active);
|
|
349
|
-
service
|
|
513
|
+
service
|
|
514
|
+
.getCharacteristic(Characteristic.RotationSpeed)
|
|
350
515
|
.onGet(() => Number(state()?.attributes?.percentage) || 0)
|
|
351
|
-
.onSet(async (value) => this.callHaWithResponseBudget(domain, "set_percentage", {
|
|
516
|
+
.onSet(async (value) => this.callHaWithResponseBudget(domain, "set_percentage", {
|
|
517
|
+
percentage: Number(value),
|
|
518
|
+
}));
|
|
352
519
|
}
|
|
353
520
|
break;
|
|
354
521
|
}
|
|
@@ -359,17 +526,21 @@ export class HapGenericAccessory {
|
|
|
359
526
|
if (!service)
|
|
360
527
|
break;
|
|
361
528
|
const active = () => this.isValveActive(state());
|
|
362
|
-
service
|
|
363
|
-
.
|
|
529
|
+
service
|
|
530
|
+
.getCharacteristic(Characteristic.Active)
|
|
531
|
+
.onGet(() => (active() ? 1 : 0))
|
|
364
532
|
.onSet(async (value) => this.setValveActive(value === 1));
|
|
365
|
-
service
|
|
366
|
-
.
|
|
367
|
-
|
|
533
|
+
service
|
|
534
|
+
.getCharacteristic(Characteristic.InUse)
|
|
535
|
+
.onGet(() => (active() ? 1 : 0));
|
|
536
|
+
service
|
|
537
|
+
.getCharacteristic(Characteristic.SetDuration)
|
|
368
538
|
.onGet(() => this.valveSetDurationSeconds)
|
|
369
539
|
.onSet(async (value) => {
|
|
370
540
|
const raw = Number(value);
|
|
371
541
|
const seconds = Math.floor(raw);
|
|
372
|
-
const maximum = Number(service.getCharacteristic(Characteristic.SetDuration).props
|
|
542
|
+
const maximum = Number(service.getCharacteristic(Characteristic.SetDuration).props
|
|
543
|
+
?.maxValue ?? 86_400);
|
|
373
544
|
if (!Number.isFinite(raw) || seconds < 0 || seconds > maximum)
|
|
374
545
|
throw -70410;
|
|
375
546
|
this.valveSetDurationSeconds = seconds;
|
|
@@ -386,7 +557,8 @@ export class HapGenericAccessory {
|
|
|
386
557
|
service.updateCharacteristic(Characteristic.RemainingDuration, 0);
|
|
387
558
|
}
|
|
388
559
|
});
|
|
389
|
-
service
|
|
560
|
+
service
|
|
561
|
+
.getCharacteristic(Characteristic.RemainingDuration)
|
|
390
562
|
.onGet(() => this.getValveRemainingDuration());
|
|
391
563
|
break;
|
|
392
564
|
}
|
|
@@ -401,7 +573,8 @@ export class HapGenericAccessory {
|
|
|
401
573
|
case "humidifier":
|
|
402
574
|
case "dehumidifier": {
|
|
403
575
|
const svc = this.accessory.addService(Service.HumidifierDehumidifier, this.record.name);
|
|
404
|
-
svc
|
|
576
|
+
svc
|
|
577
|
+
.getCharacteristic(Characteristic.Active)
|
|
405
578
|
.onGet(() => {
|
|
406
579
|
const ent = this.platform.entities.get(this.entityId);
|
|
407
580
|
this.platform.log?.info?.(`[HAPCommandTrace][${this.entityId}] read characteristic=Active ha_state=${ent?.state?.state ?? "missing"}`);
|
|
@@ -412,33 +585,44 @@ export class HapGenericAccessory {
|
|
|
412
585
|
const active = value === 1;
|
|
413
586
|
await this.callHaWithResponseBudget(domain, active ? "turn_on" : "turn_off");
|
|
414
587
|
});
|
|
415
|
-
svc
|
|
588
|
+
svc
|
|
589
|
+
.getCharacteristic(Characteristic.CurrentHumidifierDehumidifierState)
|
|
416
590
|
.onGet(() => {
|
|
417
591
|
const ent = this.platform.entities.get(this.entityId);
|
|
418
592
|
if (ent?.state?.state !== "on")
|
|
419
593
|
return 1; // INACTIVE
|
|
420
594
|
return profile === "humidifier" ? 2 : 3; // HUMIDIFYING or DEHUMIDIFYING
|
|
421
595
|
});
|
|
422
|
-
svc
|
|
596
|
+
svc
|
|
597
|
+
.getCharacteristic(Characteristic.TargetHumidifierDehumidifierState)
|
|
423
598
|
.setValue(profile === "humidifier" ? 1 : 2)
|
|
424
599
|
.onGet(() => (profile === "humidifier" ? 1 : 2));
|
|
425
|
-
svc
|
|
600
|
+
svc
|
|
601
|
+
.getCharacteristic(Characteristic.CurrentRelativeHumidity)
|
|
426
602
|
.onGet(() => {
|
|
427
603
|
const current = this.getCurrentHumidity();
|
|
428
604
|
if (current !== undefined)
|
|
429
605
|
return current;
|
|
430
606
|
const target = Number(this.getHomeAssistantState(this.entityId)?.attributes?.humidity);
|
|
431
|
-
return Number.isFinite(target) && target >= 0 && target <= 100
|
|
607
|
+
return Number.isFinite(target) && target >= 0 && target <= 100
|
|
608
|
+
? target
|
|
609
|
+
: 0;
|
|
432
610
|
});
|
|
433
|
-
svc
|
|
611
|
+
svc
|
|
612
|
+
.getCharacteristic(Characteristic.RelativeHumidityHumidifierThreshold)
|
|
434
613
|
.onGet(() => {
|
|
435
|
-
const value = Number(this.platform.entities.get(this.entityId)?.state?.attributes
|
|
436
|
-
|
|
614
|
+
const value = Number(this.platform.entities.get(this.entityId)?.state?.attributes
|
|
615
|
+
?.humidity);
|
|
616
|
+
return Number.isFinite(value) && value >= 0 && value <= 100
|
|
617
|
+
? value
|
|
618
|
+
: 0;
|
|
437
619
|
})
|
|
438
620
|
.onSet(async (value) => {
|
|
439
621
|
const [domain] = this.entityId.split(".");
|
|
440
622
|
svc.updateCharacteristic(Characteristic.RelativeHumidityHumidifierThreshold, Number(value));
|
|
441
|
-
await this.callHaWithResponseBudget(domain, "set_humidity", {
|
|
623
|
+
await this.callHaWithResponseBudget(domain, "set_humidity", {
|
|
624
|
+
humidity: Number(value),
|
|
625
|
+
});
|
|
442
626
|
});
|
|
443
627
|
break;
|
|
444
628
|
}
|
|
@@ -457,12 +641,19 @@ export class HapGenericAccessory {
|
|
|
457
641
|
// ── Televisor ─────────────────────────────────────────────────────────
|
|
458
642
|
case "television": {
|
|
459
643
|
const tv = this.accessory.addService(Service.Television, this.record.name);
|
|
460
|
-
const
|
|
644
|
+
const targetMediaId = this.getMediaEntityId();
|
|
645
|
+
const mediaState = () => this.platform.entities.get(targetMediaId)?.state ??
|
|
646
|
+
this.platform.entities.get(this.entityId)?.state;
|
|
461
647
|
tv.setCharacteristic(Characteristic.ConfiguredName, this.record.name);
|
|
462
648
|
tv.setCharacteristic(Characteristic.SleepDiscoveryMode, Characteristic.SleepDiscoveryMode.ALWAYS_DISCOVERABLE);
|
|
463
649
|
tv.getCharacteristic(Characteristic.Active)
|
|
464
|
-
.onGet(() =>
|
|
465
|
-
|
|
650
|
+
.onGet(() => {
|
|
651
|
+
const st = String(mediaState()?.state ?? "off");
|
|
652
|
+
return ["off", "standby", "unavailable", "unknown"].includes(st)
|
|
653
|
+
? 0
|
|
654
|
+
: 1;
|
|
655
|
+
})
|
|
656
|
+
.onSet(async (value) => this.callHaWithResponseBudget("media_player", value ? "turn_on" : "turn_off", undefined, targetMediaId));
|
|
466
657
|
const sources = Array.isArray(mediaState()?.attributes?.source_list)
|
|
467
658
|
? mediaState().attributes.source_list
|
|
468
659
|
: [];
|
|
@@ -472,16 +663,143 @@ export class HapGenericAccessory {
|
|
|
472
663
|
.onSet(async (value) => {
|
|
473
664
|
const source = sources[Number(value) - 1];
|
|
474
665
|
if (source)
|
|
475
|
-
await this.callHaWithResponseBudget("media_player", "select_source", { source });
|
|
666
|
+
await this.callHaWithResponseBudget("media_player", "select_source", { source }, targetMediaId);
|
|
667
|
+
});
|
|
668
|
+
// RemoteKey characteristic for Control Center TV Remote (touchpad, buttons, playback)
|
|
669
|
+
tv.getCharacteristic(Characteristic.RemoteKey).onSet(async (value) => {
|
|
670
|
+
const RemoteKey = Characteristic.RemoteKey;
|
|
671
|
+
const remoteId = this.getRemoteEntityId();
|
|
672
|
+
const sendRemote = async (cmd, fallback) => {
|
|
673
|
+
if (remoteId) {
|
|
674
|
+
try {
|
|
675
|
+
await this.callHaWithResponseBudget("remote", "send_command", { command: [cmd] }, remoteId);
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
catch (err) {
|
|
679
|
+
this.platform.log?.warn?.(`[HAP][${this.entityId}] remote.send_command ${cmd} failed: ${err}`);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
if (fallback)
|
|
683
|
+
await fallback();
|
|
684
|
+
};
|
|
685
|
+
switch (value) {
|
|
686
|
+
case RemoteKey.REWIND:
|
|
687
|
+
await sendRemote("REWIND", () => this.callHaWithResponseBudget("media_player", "media_previous_track", undefined, targetMediaId).catch(() => { }));
|
|
688
|
+
break;
|
|
689
|
+
case RemoteKey.FAST_FORWARD:
|
|
690
|
+
await sendRemote("FAST_FORWARD", () => this.callHaWithResponseBudget("media_player", "media_next_track", undefined, targetMediaId).catch(() => { }));
|
|
691
|
+
break;
|
|
692
|
+
case RemoteKey.NEXT_TRACK:
|
|
693
|
+
await sendRemote("MEDIA_NEXT", () => this.callHaWithResponseBudget("media_player", "media_next_track", undefined, targetMediaId));
|
|
694
|
+
break;
|
|
695
|
+
case RemoteKey.PREVIOUS_TRACK:
|
|
696
|
+
await sendRemote("MEDIA_PREVIOUS", () => this.callHaWithResponseBudget("media_player", "media_previous_track", undefined, targetMediaId));
|
|
697
|
+
break;
|
|
698
|
+
case RemoteKey.ARROW_UP:
|
|
699
|
+
await sendRemote("DPAD_UP", async () => {
|
|
700
|
+
const btn = this.getDeviceButton("up");
|
|
701
|
+
if (btn)
|
|
702
|
+
await this.callHaWithResponseBudget("button", "press", undefined, btn);
|
|
703
|
+
});
|
|
704
|
+
break;
|
|
705
|
+
case RemoteKey.ARROW_DOWN:
|
|
706
|
+
await sendRemote("DPAD_DOWN", async () => {
|
|
707
|
+
const btn = this.getDeviceButton("down");
|
|
708
|
+
if (btn)
|
|
709
|
+
await this.callHaWithResponseBudget("button", "press", undefined, btn);
|
|
710
|
+
});
|
|
711
|
+
break;
|
|
712
|
+
case RemoteKey.ARROW_LEFT:
|
|
713
|
+
await sendRemote("DPAD_LEFT", async () => {
|
|
714
|
+
const btn = this.getDeviceButton("left");
|
|
715
|
+
if (btn)
|
|
716
|
+
await this.callHaWithResponseBudget("button", "press", undefined, btn);
|
|
717
|
+
});
|
|
718
|
+
break;
|
|
719
|
+
case RemoteKey.ARROW_RIGHT:
|
|
720
|
+
await sendRemote("DPAD_RIGHT", async () => {
|
|
721
|
+
const btn = this.getDeviceButton("right");
|
|
722
|
+
if (btn)
|
|
723
|
+
await this.callHaWithResponseBudget("button", "press", undefined, btn);
|
|
724
|
+
});
|
|
725
|
+
break;
|
|
726
|
+
case RemoteKey.SELECT:
|
|
727
|
+
await sendRemote("DPAD_CENTER", async () => {
|
|
728
|
+
const btn = this.getDeviceButton("select") ||
|
|
729
|
+
this.getDeviceButton("enter");
|
|
730
|
+
if (btn)
|
|
731
|
+
await this.callHaWithResponseBudget("button", "press", undefined, btn);
|
|
732
|
+
});
|
|
733
|
+
break;
|
|
734
|
+
case RemoteKey.BACK:
|
|
735
|
+
await sendRemote("BACK", async () => {
|
|
736
|
+
const btn = this.getDeviceButton("back") ||
|
|
737
|
+
this.getDeviceButton("return");
|
|
738
|
+
if (btn)
|
|
739
|
+
await this.callHaWithResponseBudget("button", "press", undefined, btn);
|
|
740
|
+
});
|
|
741
|
+
break;
|
|
742
|
+
case RemoteKey.EXIT:
|
|
743
|
+
await sendRemote("HOME", async () => {
|
|
744
|
+
const btn = this.getDeviceButton("home") ||
|
|
745
|
+
this.getDeviceButton("exit");
|
|
746
|
+
if (btn)
|
|
747
|
+
await this.callHaWithResponseBudget("button", "press", undefined, btn);
|
|
748
|
+
});
|
|
749
|
+
break;
|
|
750
|
+
case RemoteKey.PLAY_PAUSE:
|
|
751
|
+
await this.callHaWithResponseBudget("media_player", "media_play_pause", undefined, targetMediaId).catch(() => sendRemote("MEDIA_PLAY_PAUSE"));
|
|
752
|
+
break;
|
|
753
|
+
case RemoteKey.INFORMATION:
|
|
754
|
+
await sendRemote("MENU", async () => {
|
|
755
|
+
const btn = this.getDeviceButton("menu") ||
|
|
756
|
+
this.getDeviceButton("info");
|
|
757
|
+
if (btn)
|
|
758
|
+
await this.callHaWithResponseBudget("button", "press", undefined, btn);
|
|
759
|
+
});
|
|
760
|
+
break;
|
|
761
|
+
}
|
|
476
762
|
});
|
|
477
763
|
const speaker = this.accessory.addService(Service.TelevisionSpeaker, `${this.record.name} Audio`);
|
|
478
|
-
speaker.setCharacteristic(Characteristic.
|
|
479
|
-
speaker.
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
764
|
+
speaker.setCharacteristic(Characteristic.Active, Characteristic.Active.ACTIVE);
|
|
765
|
+
speaker.setCharacteristic(Characteristic.VolumeControlType, Characteristic.VolumeControlType.RELATIVE_WITH_CURRENT);
|
|
766
|
+
const muteSwitchId = this.getMuteSwitchEntityId();
|
|
767
|
+
speaker
|
|
768
|
+
.getCharacteristic(Characteristic.Mute)
|
|
769
|
+
.onGet(() => {
|
|
770
|
+
const isMediaMuted = Boolean(mediaState()?.attributes?.is_volume_muted);
|
|
771
|
+
const isSwitchMuted = muteSwitchId
|
|
772
|
+
? this.getHomeAssistantState(muteSwitchId)?.state === "on"
|
|
773
|
+
: false;
|
|
774
|
+
return isMediaMuted || isSwitchMuted;
|
|
775
|
+
})
|
|
776
|
+
.onSet(async (value) => {
|
|
777
|
+
const isMuted = Boolean(value);
|
|
778
|
+
if (muteSwitchId) {
|
|
779
|
+
await this.callHaWithResponseBudget("switch", isMuted ? "turn_on" : "turn_off", undefined, muteSwitchId).catch(() => { });
|
|
780
|
+
}
|
|
781
|
+
await this.callHaWithResponseBudget("media_player", "volume_mute", { is_volume_muted: isMuted }, targetMediaId).catch(() => { });
|
|
782
|
+
});
|
|
783
|
+
speaker
|
|
784
|
+
.getCharacteristic(Characteristic.Volume)
|
|
483
785
|
.onGet(() => Math.round((Number(mediaState()?.attributes?.volume_level) || 0) * 100))
|
|
484
|
-
.onSet(async (value) => this.callHaWithResponseBudget("media_player", "volume_set", { volume_level: Number(value) / 100 }));
|
|
786
|
+
.onSet(async (value) => this.callHaWithResponseBudget("media_player", "volume_set", { volume_level: Number(value) / 100 }, targetMediaId));
|
|
787
|
+
speaker
|
|
788
|
+
.getCharacteristic(Characteristic.VolumeSelector)
|
|
789
|
+
.onSet(async (value) => {
|
|
790
|
+
const inc = value === Characteristic.VolumeSelector.INCREMENT;
|
|
791
|
+
const remoteId = this.getRemoteEntityId();
|
|
792
|
+
try {
|
|
793
|
+
await this.callHaWithResponseBudget("media_player", inc ? "volume_up" : "volume_down", undefined, targetMediaId);
|
|
794
|
+
}
|
|
795
|
+
catch {
|
|
796
|
+
if (remoteId) {
|
|
797
|
+
await this.callHaWithResponseBudget("remote", "send_command", {
|
|
798
|
+
command: [inc ? "VOLUME_UP" : "VOLUME_DOWN"],
|
|
799
|
+
}, remoteId).catch(() => { });
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
});
|
|
485
803
|
tv.addLinkedService(speaker);
|
|
486
804
|
sources.forEach((source, index) => {
|
|
487
805
|
const input = this.accessory.addService(Service.InputSource, source, `input:${index + 1}`);
|
|
@@ -512,8 +830,12 @@ export class HapGenericAccessory {
|
|
|
512
830
|
const svc = this.accessory.addService(Service.Valve, this.record.name);
|
|
513
831
|
const initialState = this.getHomeAssistantState(this.entityId);
|
|
514
832
|
const initialActive = this.isValveActive(initialState);
|
|
515
|
-
svc
|
|
516
|
-
|
|
833
|
+
svc
|
|
834
|
+
.getCharacteristic(Characteristic.Active)
|
|
835
|
+
.setValue(initialActive ? 1 : 0);
|
|
836
|
+
svc
|
|
837
|
+
.getCharacteristic(Characteristic.InUse)
|
|
838
|
+
.setValue(initialActive ? 1 : 0);
|
|
517
839
|
svc.setCharacteristic(Characteristic.ValveType, valveType);
|
|
518
840
|
break;
|
|
519
841
|
}
|
|
@@ -539,7 +861,9 @@ export class HapGenericAccessory {
|
|
|
539
861
|
svc
|
|
540
862
|
.getCharacteristic(Characteristic.TargetDoorState)
|
|
541
863
|
.setValue(Characteristic.TargetDoorState.CLOSED);
|
|
542
|
-
svc
|
|
864
|
+
svc
|
|
865
|
+
.getCharacteristic(Characteristic.ObstructionDetected)
|
|
866
|
+
.setValue(false);
|
|
543
867
|
break;
|
|
544
868
|
}
|
|
545
869
|
// ── Timbre / Videoportero ─────────────────────────────────────────────
|
|
@@ -563,20 +887,14 @@ export class HapGenericAccessory {
|
|
|
563
887
|
svc
|
|
564
888
|
.getCharacteristic(Characteristic.TargetHeaterCoolerState)
|
|
565
889
|
.setValue(0);
|
|
566
|
-
svc
|
|
567
|
-
.getCharacteristic(Characteristic.CurrentTemperature)
|
|
568
|
-
.setValue(20);
|
|
890
|
+
svc.getCharacteristic(Characteristic.CurrentTemperature).setValue(20);
|
|
569
891
|
break;
|
|
570
892
|
}
|
|
571
893
|
// ── Termostato HAP ────────────────────────────────────────────────────
|
|
572
894
|
case "thermostat_hap": {
|
|
573
895
|
const svc = this.accessory.addService(Service.Thermostat, this.record.name);
|
|
574
|
-
svc
|
|
575
|
-
|
|
576
|
-
.setValue(20);
|
|
577
|
-
svc
|
|
578
|
-
.getCharacteristic(Characteristic.TargetTemperature)
|
|
579
|
-
.setValue(21);
|
|
896
|
+
svc.getCharacteristic(Characteristic.CurrentTemperature).setValue(20);
|
|
897
|
+
svc.getCharacteristic(Characteristic.TargetTemperature).setValue(21);
|
|
580
898
|
svc
|
|
581
899
|
.getCharacteristic(Characteristic.CurrentHeatingCoolingState)
|
|
582
900
|
.setValue(0);
|
|
@@ -627,12 +945,8 @@ export class HapGenericAccessory {
|
|
|
627
945
|
// ── Persiana HAP ──────────────────────────────────────────────────────
|
|
628
946
|
case "window_covering_hap": {
|
|
629
947
|
const svc = this.accessory.addService(Service.WindowCovering, this.record.name);
|
|
630
|
-
svc
|
|
631
|
-
|
|
632
|
-
.setValue(0);
|
|
633
|
-
svc
|
|
634
|
-
.getCharacteristic(Characteristic.TargetPosition)
|
|
635
|
-
.setValue(0);
|
|
948
|
+
svc.getCharacteristic(Characteristic.CurrentPosition).setValue(0);
|
|
949
|
+
svc.getCharacteristic(Characteristic.TargetPosition).setValue(0);
|
|
636
950
|
svc
|
|
637
951
|
.getCharacteristic(Characteristic.PositionState)
|
|
638
952
|
.setValue(Characteristic.PositionState.STOPPED);
|
|
@@ -661,9 +975,7 @@ export class HapGenericAccessory {
|
|
|
661
975
|
// ── Sensor de movimiento ──────────────────────────────────────────────
|
|
662
976
|
case "motion_sensor_hap": {
|
|
663
977
|
const svc = this.accessory.addService(Service.MotionSensor, this.record.name);
|
|
664
|
-
svc
|
|
665
|
-
.getCharacteristic(Characteristic.MotionDetected)
|
|
666
|
-
.setValue(false);
|
|
978
|
+
svc.getCharacteristic(Characteristic.MotionDetected).setValue(false);
|
|
667
979
|
break;
|
|
668
980
|
}
|
|
669
981
|
// ── Sensor de contacto ────────────────────────────────────────────────
|
|
@@ -717,9 +1029,7 @@ export class HapGenericAccessory {
|
|
|
717
1029
|
// ── Sensor temperatura ────────────────────────────────────────────────
|
|
718
1030
|
case "temperature_sensor_hap": {
|
|
719
1031
|
const svc = this.accessory.addService(Service.TemperatureSensor, this.record.name);
|
|
720
|
-
svc
|
|
721
|
-
.getCharacteristic(Characteristic.CurrentTemperature)
|
|
722
|
-
.setValue(20);
|
|
1032
|
+
svc.getCharacteristic(Characteristic.CurrentTemperature).setValue(20);
|
|
723
1033
|
break;
|
|
724
1034
|
}
|
|
725
1035
|
// ── Sensor humedad ────────────────────────────────────────────────────
|
|
@@ -859,16 +1169,45 @@ export class HapGenericAccessory {
|
|
|
859
1169
|
this.isPublished = false;
|
|
860
1170
|
}
|
|
861
1171
|
handlesEntityId(entityId) {
|
|
862
|
-
return entityId === this.entityId ||
|
|
1172
|
+
return (entityId === this.entityId ||
|
|
1173
|
+
this.getDeviceMembers().some((member) => member.entityId === entityId));
|
|
863
1174
|
}
|
|
864
1175
|
updateFromHassState(state, sourceEntityId = this.entityId) {
|
|
865
1176
|
try {
|
|
866
1177
|
if (sourceEntityId !== this.entityId) {
|
|
867
|
-
if ((this.record.hapProfile === "humidifier" ||
|
|
1178
|
+
if ((this.record.hapProfile === "humidifier" ||
|
|
1179
|
+
this.record.hapProfile === "dehumidifier") &&
|
|
868
1180
|
state?.attributes?.device_class === "humidity") {
|
|
869
1181
|
const humidity = Number(state?.state);
|
|
870
1182
|
if (Number.isFinite(humidity) && humidity >= 0 && humidity <= 100) {
|
|
871
|
-
this.accessory
|
|
1183
|
+
this.accessory
|
|
1184
|
+
.getService(Service.HumidifierDehumidifier)
|
|
1185
|
+
?.updateCharacteristic(Characteristic.CurrentRelativeHumidity, humidity);
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
if (this.record.hapProfile === "television") {
|
|
1189
|
+
const muteSwitchId = this.getMuteSwitchEntityId();
|
|
1190
|
+
const targetMediaId = this.getMediaEntityId();
|
|
1191
|
+
if (sourceEntityId === muteSwitchId) {
|
|
1192
|
+
const isMuted = state?.state === "on";
|
|
1193
|
+
this.accessory
|
|
1194
|
+
.getService(Service.TelevisionSpeaker)
|
|
1195
|
+
?.updateCharacteristic(Characteristic.Mute, isMuted);
|
|
1196
|
+
}
|
|
1197
|
+
else if (sourceEntityId === targetMediaId) {
|
|
1198
|
+
const isOn = state?.state &&
|
|
1199
|
+
!["off", "standby", "unavailable", "unknown"].includes(state.state);
|
|
1200
|
+
this.accessory
|
|
1201
|
+
.getService(Service.Television)
|
|
1202
|
+
?.updateCharacteristic(Characteristic.Active, isOn ? 1 : 0);
|
|
1203
|
+
this.accessory
|
|
1204
|
+
.getService(Service.TelevisionSpeaker)
|
|
1205
|
+
?.updateCharacteristic(Characteristic.Mute, Boolean(state?.attributes?.is_volume_muted));
|
|
1206
|
+
if (state?.attributes?.volume_level !== undefined) {
|
|
1207
|
+
this.accessory
|
|
1208
|
+
.getService(Service.TelevisionSpeaker)
|
|
1209
|
+
?.updateCharacteristic(Characteristic.Volume, Math.round(Number(state.attributes.volume_level) * 100));
|
|
1210
|
+
}
|
|
872
1211
|
}
|
|
873
1212
|
}
|
|
874
1213
|
const binding = this.discoveredSensorBindings.get(sourceEntityId);
|
|
@@ -889,16 +1228,20 @@ export class HapGenericAccessory {
|
|
|
889
1228
|
const on = state?.state === "on";
|
|
890
1229
|
switch (this.record.hapProfile) {
|
|
891
1230
|
case "switch_hap":
|
|
892
|
-
this.accessory
|
|
1231
|
+
this.accessory
|
|
1232
|
+
.getService(Service.Switch)
|
|
1233
|
+
?.updateCharacteristic(Characteristic.On, on);
|
|
893
1234
|
break;
|
|
894
1235
|
case "outlet_hap":
|
|
895
|
-
this.accessory
|
|
1236
|
+
this.accessory
|
|
1237
|
+
.getService(Service.Outlet)
|
|
1238
|
+
?.updateCharacteristic(Characteristic.On, on);
|
|
896
1239
|
break;
|
|
897
1240
|
case "lightbulb_hap": {
|
|
898
1241
|
const light = this.accessory.getService(Service.Lightbulb);
|
|
899
1242
|
light?.updateCharacteristic(Characteristic.On, on);
|
|
900
1243
|
if (state?.attributes?.brightness !== undefined)
|
|
901
|
-
light?.updateCharacteristic(Characteristic.Brightness, Math.round(Number(state.attributes.brightness) * 100 / 255));
|
|
1244
|
+
light?.updateCharacteristic(Characteristic.Brightness, Math.round((Number(state.attributes.brightness) * 100) / 255));
|
|
902
1245
|
if (Array.isArray(state?.attributes?.hs_color)) {
|
|
903
1246
|
light?.updateCharacteristic(Characteristic.Hue, Number(state.attributes.hs_color[0]) || 0);
|
|
904
1247
|
light?.updateCharacteristic(Characteristic.Saturation, Number(state.attributes.hs_color[1]) || 0);
|
|
@@ -912,7 +1255,7 @@ export class HapGenericAccessory {
|
|
|
912
1255
|
const max = Number(attrs.max ?? 100);
|
|
913
1256
|
const value = Number(state?.state);
|
|
914
1257
|
const percent = max > min && Number.isFinite(value)
|
|
915
|
-
? Math.max(0, Math.min(100, Math.round((value - min) * 100 / (max - min))))
|
|
1258
|
+
? Math.max(0, Math.min(100, Math.round(((value - min) * 100) / (max - min))))
|
|
916
1259
|
: 0;
|
|
917
1260
|
light?.updateCharacteristic(Characteristic.On, true);
|
|
918
1261
|
light?.updateCharacteristic(Characteristic.Brightness, percent);
|
|
@@ -926,10 +1269,27 @@ export class HapGenericAccessory {
|
|
|
926
1269
|
break;
|
|
927
1270
|
}
|
|
928
1271
|
case "television": {
|
|
929
|
-
this.
|
|
930
|
-
this.
|
|
931
|
-
|
|
932
|
-
this.
|
|
1272
|
+
const targetMediaId = this.getMediaEntityId();
|
|
1273
|
+
const targetState = targetMediaId === this.entityId
|
|
1274
|
+
? state
|
|
1275
|
+
: this.platform.entities.get(targetMediaId)?.state;
|
|
1276
|
+
const isOn = targetState?.state &&
|
|
1277
|
+
!["off", "standby", "unavailable", "unknown"].includes(targetState.state);
|
|
1278
|
+
this.accessory
|
|
1279
|
+
.getService(Service.Television)
|
|
1280
|
+
?.updateCharacteristic(Characteristic.Active, isOn ? 1 : 0);
|
|
1281
|
+
const muteSwitchId = this.getMuteSwitchEntityId();
|
|
1282
|
+
const isSwitchMuted = muteSwitchId
|
|
1283
|
+
? this.getHomeAssistantState(muteSwitchId)?.state === "on"
|
|
1284
|
+
: false;
|
|
1285
|
+
this.accessory
|
|
1286
|
+
.getService(Service.TelevisionSpeaker)
|
|
1287
|
+
?.updateCharacteristic(Characteristic.Mute, Boolean(targetState?.attributes?.is_volume_muted || isSwitchMuted));
|
|
1288
|
+
if (targetState?.attributes?.volume_level !== undefined) {
|
|
1289
|
+
this.accessory
|
|
1290
|
+
.getService(Service.TelevisionSpeaker)
|
|
1291
|
+
?.updateCharacteristic(Characteristic.Volume, Math.round(Number(targetState.attributes.volume_level) * 100));
|
|
1292
|
+
}
|
|
933
1293
|
break;
|
|
934
1294
|
}
|
|
935
1295
|
}
|
|
@@ -954,13 +1314,16 @@ export class HapGenericAccessory {
|
|
|
954
1314
|
catch { }
|
|
955
1315
|
}
|
|
956
1316
|
isValveProfile() {
|
|
957
|
-
return this.record.hapProfile === "valve_irrigation" ||
|
|
1317
|
+
return (this.record.hapProfile === "valve_irrigation" ||
|
|
958
1318
|
this.record.hapProfile === "valve_faucet" ||
|
|
959
|
-
this.record.hapProfile === "valve_shower";
|
|
1319
|
+
this.record.hapProfile === "valve_shower");
|
|
960
1320
|
}
|
|
961
1321
|
isValveActive(state) {
|
|
962
1322
|
const value = String(state?.state ?? "").toLowerCase();
|
|
963
|
-
return value === "open" ||
|
|
1323
|
+
return (value === "open" ||
|
|
1324
|
+
value === "opening" ||
|
|
1325
|
+
value === "closing" ||
|
|
1326
|
+
value === "on");
|
|
964
1327
|
}
|
|
965
1328
|
syncValveState(state) {
|
|
966
1329
|
const service = this.accessory.getService(Service.Valve);
|
|
@@ -980,7 +1343,9 @@ export class HapGenericAccessory {
|
|
|
980
1343
|
this.armValveDurationTicker(Number(this.record.valveDeadlineAt));
|
|
981
1344
|
}
|
|
982
1345
|
}
|
|
983
|
-
else if (active &&
|
|
1346
|
+
else if (active &&
|
|
1347
|
+
this.valveSetDurationSeconds > 0 &&
|
|
1348
|
+
this.valveDeadlineMs === undefined) {
|
|
984
1349
|
// A configured HAP duration also applies when the valve is opened outside
|
|
985
1350
|
// HomeKit. Persist it before starting the close countdown.
|
|
986
1351
|
const deadline = Date.now() + this.valveSetDurationSeconds * 1000;
|
|
@@ -1006,8 +1371,12 @@ export class HapGenericAccessory {
|
|
|
1006
1371
|
}
|
|
1007
1372
|
const domain = this.entityId.split(".")[0];
|
|
1008
1373
|
const service = domain === "valve"
|
|
1009
|
-
?
|
|
1010
|
-
|
|
1374
|
+
? active
|
|
1375
|
+
? "open_valve"
|
|
1376
|
+
: "close_valve"
|
|
1377
|
+
: active
|
|
1378
|
+
? "turn_on"
|
|
1379
|
+
: "turn_off";
|
|
1011
1380
|
if (active && this.valveSetDurationSeconds > 0) {
|
|
1012
1381
|
await this.persistValveDeadline(Date.now() + this.valveSetDurationSeconds * 1000);
|
|
1013
1382
|
}
|
|
@@ -1039,7 +1408,10 @@ export class HapGenericAccessory {
|
|
|
1039
1408
|
return Math.max(0, Math.ceil((this.valveDeadlineMs - Date.now()) / 1000));
|
|
1040
1409
|
}
|
|
1041
1410
|
isValidValveDuration(value) {
|
|
1042
|
-
return typeof value === "number" &&
|
|
1411
|
+
return (typeof value === "number" &&
|
|
1412
|
+
Number.isInteger(value) &&
|
|
1413
|
+
value >= 0 &&
|
|
1414
|
+
value <= 86_400);
|
|
1043
1415
|
}
|
|
1044
1416
|
restoreValveDurationTimer() {
|
|
1045
1417
|
if (!this.isValveProfile())
|
|
@@ -1075,7 +1447,8 @@ export class HapGenericAccessory {
|
|
|
1075
1447
|
clearValveDurationTimer(persist = true) {
|
|
1076
1448
|
this.stopValveDurationTicker();
|
|
1077
1449
|
this.valveClosePending = false;
|
|
1078
|
-
const hadDeadline = this.record.valveDeadlineAt !== undefined ||
|
|
1450
|
+
const hadDeadline = this.record.valveDeadlineAt !== undefined ||
|
|
1451
|
+
this.record.valveCloseAttempts !== undefined;
|
|
1079
1452
|
delete this.record.valveDeadlineAt;
|
|
1080
1453
|
delete this.record.valveCloseAttempts;
|
|
1081
1454
|
if (persist && hadDeadline)
|
|
@@ -1106,7 +1479,9 @@ export class HapGenericAccessory {
|
|
|
1106
1479
|
const currentValue = String(currentState?.state ?? "").toLowerCase();
|
|
1107
1480
|
if (["closed", "off", "idle", "closing"].includes(currentValue)) {
|
|
1108
1481
|
this.clearValveDurationTimer();
|
|
1109
|
-
this.accessory
|
|
1482
|
+
this.accessory
|
|
1483
|
+
.getService(Service.Valve)
|
|
1484
|
+
?.updateCharacteristic(Characteristic.RemainingDuration, 0);
|
|
1110
1485
|
return;
|
|
1111
1486
|
}
|
|
1112
1487
|
let lastError;
|
|
@@ -1117,13 +1492,18 @@ export class HapGenericAccessory {
|
|
|
1117
1492
|
try {
|
|
1118
1493
|
const state = this.getHomeAssistantState(this.entityId);
|
|
1119
1494
|
const value = String(state?.state ?? "").toLowerCase();
|
|
1120
|
-
if (value === "unavailable" ||
|
|
1495
|
+
if (value === "unavailable" ||
|
|
1496
|
+
value === "unknown" ||
|
|
1497
|
+
!value ||
|
|
1498
|
+
this.platform.ha?.connected === false) {
|
|
1121
1499
|
lastError = new Error("Home Assistant valve state is unavailable");
|
|
1122
1500
|
break;
|
|
1123
1501
|
}
|
|
1124
1502
|
if (["closed", "off", "idle", "closing"].includes(value)) {
|
|
1125
1503
|
this.clearValveDurationTimer();
|
|
1126
|
-
this.accessory
|
|
1504
|
+
this.accessory
|
|
1505
|
+
.getService(Service.Valve)
|
|
1506
|
+
?.updateCharacteristic(Characteristic.RemainingDuration, 0);
|
|
1127
1507
|
return;
|
|
1128
1508
|
}
|
|
1129
1509
|
if (!this.isValveActive(state))
|
|
@@ -1150,7 +1530,9 @@ export class HapGenericAccessory {
|
|
|
1150
1530
|
this.valveClosePending = false;
|
|
1151
1531
|
this.valveDeadlineMs = undefined;
|
|
1152
1532
|
await this.platform.saveHapAccessoryRecords?.();
|
|
1153
|
-
this.accessory
|
|
1533
|
+
this.accessory
|
|
1534
|
+
.getService(Service.Valve)
|
|
1535
|
+
?.updateCharacteristic(Characteristic.RemainingDuration, 0);
|
|
1154
1536
|
return;
|
|
1155
1537
|
}
|
|
1156
1538
|
catch (error) {
|
|
@@ -1175,32 +1557,40 @@ export class HapGenericAccessory {
|
|
|
1175
1557
|
supportsAlarmNight() {
|
|
1176
1558
|
const night = Characteristic.SecuritySystemTargetState.NIGHT_ARM;
|
|
1177
1559
|
const characteristic = this.getSecuritySystemService()?.getCharacteristic(Characteristic.SecuritySystemTargetState);
|
|
1178
|
-
return Number.isInteger(night) &&
|
|
1560
|
+
return (Number.isInteger(night) &&
|
|
1179
1561
|
Array.isArray(characteristic?.props?.validValues) &&
|
|
1180
|
-
characteristic.props.validValues.includes(night);
|
|
1562
|
+
characteristic.props.validValues.includes(night));
|
|
1181
1563
|
}
|
|
1182
1564
|
mapAlarmMode(value) {
|
|
1183
1565
|
switch (value) {
|
|
1184
|
-
case "disarmed":
|
|
1185
|
-
|
|
1186
|
-
case "
|
|
1566
|
+
case "disarmed":
|
|
1567
|
+
return Characteristic.SecuritySystemCurrentState.DISARMED;
|
|
1568
|
+
case "armed_home":
|
|
1569
|
+
return Characteristic.SecuritySystemCurrentState.STAY_ARM;
|
|
1570
|
+
case "armed_away":
|
|
1571
|
+
return Characteristic.SecuritySystemCurrentState.AWAY_ARM;
|
|
1187
1572
|
case "armed_night":
|
|
1188
1573
|
return this.supportsAlarmNight()
|
|
1189
1574
|
? Characteristic.SecuritySystemCurrentState.NIGHT_ARM
|
|
1190
1575
|
: undefined;
|
|
1191
|
-
default:
|
|
1576
|
+
default:
|
|
1577
|
+
return undefined;
|
|
1192
1578
|
}
|
|
1193
1579
|
}
|
|
1194
1580
|
mapAlarmTarget(value) {
|
|
1195
1581
|
switch (value) {
|
|
1196
|
-
case "disarmed":
|
|
1197
|
-
|
|
1198
|
-
case "
|
|
1582
|
+
case "disarmed":
|
|
1583
|
+
return Characteristic.SecuritySystemTargetState.DISARM;
|
|
1584
|
+
case "armed_home":
|
|
1585
|
+
return Characteristic.SecuritySystemTargetState.STAY_ARM;
|
|
1586
|
+
case "armed_away":
|
|
1587
|
+
return Characteristic.SecuritySystemTargetState.AWAY_ARM;
|
|
1199
1588
|
case "armed_night":
|
|
1200
1589
|
return this.supportsAlarmNight()
|
|
1201
1590
|
? Characteristic.SecuritySystemTargetState.NIGHT_ARM
|
|
1202
1591
|
: undefined;
|
|
1203
|
-
default:
|
|
1592
|
+
default:
|
|
1593
|
+
return undefined;
|
|
1204
1594
|
}
|
|
1205
1595
|
}
|
|
1206
1596
|
getAlarmCurrentState() {
|