google-home: observe ciao issues

This commit is contained in:
Koushik Dutta
2023-01-03 13:07:08 -08:00
parent 17c09c69ae
commit d3121dd366
4 changed files with 32 additions and 41 deletions

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/google-home",
"version": "0.0.53",
"version": "0.0.55",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/google-home",
"version": "0.0.53",
"version": "0.0.55",
"dependencies": {
"@googleapis/homegraph": "^2.0.0",
"@homebridge/ciao": "^1.1.5",
@@ -42,21 +42,23 @@
},
"../../sdk": {
"name": "@scrypted/sdk",
"version": "0.2.1",
"version": "0.2.53",
"dev": true,
"license": "ISC",
"dependencies": {
"@babel/preset-typescript": "^7.16.7",
"@babel/preset-typescript": "^7.18.6",
"adm-zip": "^0.4.13",
"axios": "^0.21.4",
"babel-loader": "^8.2.3",
"babel-loader": "^9.1.0",
"babel-plugin-const-enum": "^1.1.0",
"esbuild": "^0.15.9",
"ncp": "^2.0.0",
"raw-loader": "^4.0.2",
"rimraf": "^3.0.2",
"tmp": "^0.2.1",
"webpack": "^5.74.0",
"ts-loader": "^9.4.2",
"typescript": "^4.9.4",
"webpack": "^5.75.0",
"webpack-bundle-analyzer": "^4.5.0"
},
"bin": {
@@ -69,11 +71,11 @@
"scrypted-webpack": "bin/scrypted-webpack.js"
},
"devDependencies": {
"@types/node": "^16.11.1",
"@types/node": "^18.11.18",
"@types/stringify-object": "^4.0.0",
"stringify-object": "^3.3.0",
"ts-node": "^10.4.0",
"typedoc": "^0.23.15"
"typedoc": "^0.23.21"
}
},
"../sdk": {
@@ -628,9 +630,9 @@
}
},
"node_modules/qs": {
"version": "6.10.1",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz",
"integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==",
"version": "6.11.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
"integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
"dependencies": {
"side-channel": "^1.0.4"
},
@@ -786,12 +788,12 @@
"@scrypted/sdk": {
"version": "file:../../sdk",
"requires": {
"@babel/preset-typescript": "^7.16.7",
"@types/node": "^16.11.1",
"@babel/preset-typescript": "^7.18.6",
"@types/node": "^18.11.18",
"@types/stringify-object": "^4.0.0",
"adm-zip": "^0.4.13",
"axios": "^0.21.4",
"babel-loader": "^8.2.3",
"babel-loader": "^9.1.0",
"babel-plugin-const-enum": "^1.1.0",
"esbuild": "^0.15.9",
"ncp": "^2.0.0",
@@ -799,9 +801,11 @@
"rimraf": "^3.0.2",
"stringify-object": "^3.3.0",
"tmp": "^0.2.1",
"ts-loader": "^9.4.2",
"ts-node": "^10.4.0",
"typedoc": "^0.23.15",
"webpack": "^5.74.0",
"typedoc": "^0.23.21",
"typescript": "^4.9.4",
"webpack": "^5.75.0",
"webpack-bundle-analyzer": "^4.5.0"
}
},
@@ -1199,9 +1203,9 @@
"integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg=="
},
"qs": {
"version": "6.10.1",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz",
"integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==",
"version": "6.11.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
"integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
"requires": {
"side-channel": "^1.0.4"
}

View File

@@ -48,5 +48,5 @@
"@types/lodash": "^4.14.168",
"@types/url-parse": "^1.4.3"
},
"version": "0.0.53"
"version": "0.0.55"
}

View File

@@ -97,7 +97,7 @@ class GoogleHome extends ScryptedDeviceBase implements HttpRequestHandler, Engin
}
systemManager.listen((source, details) => {
if (source && details.changed && details.property)
if (source && details.property)
this.queueReportState(source);
});
@@ -105,9 +105,6 @@ class GoogleHome extends ScryptedDeviceBase implements HttpRequestHandler, Engin
if (eventDetails.eventInterface !== ScryptedInterface.ScryptedDevice)
return;
if (!eventDetails.changed)
return;
if (!eventDetails.property)
return;
@@ -144,6 +141,12 @@ class GoogleHome extends ScryptedDeviceBase implements HttpRequestHandler, Engin
port: url.port,
}
});
service.on('name-change', d => {
this.console.log('name-change', d)
});
service.on('hostname-change', d => {
this.console.log('hostname-change', d)
});
service.advertise();
});
}

View File

@@ -29,29 +29,13 @@ addSupportedType({
if (!device.binaryState)
return {};
// store and compare the timestamp of this binary state
const detectionTimestamp = systemManager.getSystemState()?.[device.id]?.[ScryptedInterfaceProperty.binaryState]?.stateTime;
// can this happen?
if (!detectionTimestamp) {
console.warn(ScryptedInterfaceProperty.binaryState, 'timestamp is missing?')
return {};
}
// existing event.
if (notificationsState[ScryptedInterfaceProperty.binaryState] === detectionTimestamp)
return {};
// new event
notificationsState[ScryptedInterfaceProperty.binaryState] = detectionTimestamp;
const ret = {
ObjectDetection: {
objects: {
"unfamiliar": 1
},
priority: 0,
detectionTimestamp,
detectionTimestamp: Date.now(),
}
}
return ret;