From 711d57632091e6bdab52d2d3fe2d2ac8f13664bf Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Thu, 20 Jan 2022 23:21:54 -0800 Subject: [PATCH] homekit: thermostat temp display unit. intercom cleanup. --- plugins/homekit/package-lock.json | 4 ++-- plugins/homekit/package.json | 2 +- plugins/homekit/src/types/camera.ts | 4 +++- plugins/homekit/src/types/thermostat.ts | 10 ++++++++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/plugins/homekit/package-lock.json b/plugins/homekit/package-lock.json index ab9bbb83c..c770cc75b 100644 --- a/plugins/homekit/package-lock.json +++ b/plugins/homekit/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/homekit", - "version": "0.0.166", + "version": "0.0.170", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/homekit", - "version": "0.0.166", + "version": "0.0.170", "dependencies": { "hap-nodejs": "file:../../external/HAP-NodeJS", "lodash": "^4.17.21", diff --git a/plugins/homekit/package.json b/plugins/homekit/package.json index bffc32256..69f8c6e93 100644 --- a/plugins/homekit/package.json +++ b/plugins/homekit/package.json @@ -40,5 +40,5 @@ "@types/qrcode": "^1.4.1", "@types/url-parse": "^1.4.3" }, - "version": "0.0.166" + "version": "0.0.170" } diff --git a/plugins/homekit/src/types/camera.ts b/plugins/homekit/src/types/camera.ts index 9eaf5525f..42186802c 100644 --- a/plugins/homekit/src/types/camera.ts +++ b/plugins/homekit/src/types/camera.ts @@ -23,7 +23,6 @@ import { CharacteristicEventTypes, DataStreamConnection, Service, WithUUID } fro import { RecordingManagement } from 'hap-nodejs/src/lib/camera'; import { defaultObjectDetectionContactSensorTimeout } from '../camera-mixin'; import os from 'os'; -import { levelToFfmpeg, profileToFfmpeg } from './camera/camera-utils'; const { log, mediaManager, deviceManager, systemManager } = sdk; @@ -77,6 +76,8 @@ addSupportedType({ session.videoReturn?.close(); session.audioReturn?.close(); session.rtpSink?.destroy(); + if (twoWayAudio) + device.stopIntercom(); } @@ -186,6 +187,7 @@ addSupportedType({ const msos = await device.getVideoStreamOptions(); selectedStream = msos.find(mso => mso.name === streamingChannel); } + console.log('isHomeKitHub', isHomeKitHub, 'selected stream', selectedStream?.name || 'Default/undefined'); const tryReconfigureBitrate = () => { if (!isHomeKitHub) diff --git a/plugins/homekit/src/types/thermostat.ts b/plugins/homekit/src/types/thermostat.ts index 7d2dcb695..80f33f432 100644 --- a/plugins/homekit/src/types/thermostat.ts +++ b/plugins/homekit/src/types/thermostat.ts @@ -94,8 +94,14 @@ addSupportedType({ bindCharacteristic(device, ScryptedInterface.TemperatureSetting, service, Characteristic.CoolingThresholdTemperature, () => Math.max(device.thermostatSetpointHigh || 0, 10)); - bindCharacteristic(device, ScryptedInterface.TemperatureSetting, service, Characteristic.TemperatureDisplayUnits, - () => device.temperatureUnit === TemperatureUnit.C ? Characteristic.TemperatureDisplayUnits.CELSIUS : Characteristic.TemperatureDisplayUnits.FAHRENHEIT); + bindCharacteristic(device, ScryptedInterface.Thermometer, service, Characteristic.TemperatureDisplayUnits, + () => device.temperatureUnit === TemperatureUnit.F ? Characteristic.TemperatureDisplayUnits.FAHRENHEIT : Characteristic.TemperatureDisplayUnits.CELSIUS); + + service.getCharacteristic(Characteristic.TemperatureDisplayUnits) + .on(CharacteristicEventTypes.SET, (value: CharacteristicValue, callback: CharacteristicSetCallback) => { + callback(); + device.setTemperatureUnit(value === Characteristic.TemperatureDisplayUnits.FAHRENHEIT ? TemperatureUnit.F : TemperatureUnit.C); + }); bindCharacteristic(device, ScryptedInterface.Thermometer, service, Characteristic.CurrentTemperature, () => device.temperature || 0);