Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bridged core and core cleanup #1048

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/BridgedCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

console.log(`HAP-NodeJS v${HAPLibraryVersion()} starting...`);

console.warn("DEPRECATION NOTICE: The use of Core and BridgeCore are deprecated and are scheduled to be remove in October 2020. " +
"For more information and some guidance on how to migrate, have a look at https://github.com/homebridge/HAP-NodeJS/wiki/Deprecation-of-Core-and-BridgeCore");
console.warn("DEPRECATION NOTICE: The use of Core and BridgeCore is deprecated and is scheduled to be removed in a future version.");
console.warn("For more information and some guidance on how to migrate, have a look at https://github.com/homebridge/HAP-NodeJS/wiki/Deprecation-of-Core-and-BridgeCore");

Check warning on line 10 in src/BridgedCore.ts

View workflow job for this annotation

GitHub Actions / lint / ESLint

This line has a length of 170. Maximum allowed is 160

// Initialize our storage system
storage.initSync();
Expand Down Expand Up @@ -42,9 +42,7 @@
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Object.keys(signals).forEach((signal: any) => {
process.on(signal, () => {
bridge.unpublish();
Shaquu marked this conversation as resolved.
Show resolved Hide resolved
setTimeout(()=> {
process.exit(128 + signals[signal]);
}, 1000);
bridge.unpublish()
.then(() => setTimeout(() => process.exit(128 + signals[signal]), 1000));
});
});
13 changes: 4 additions & 9 deletions src/Core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

console.log(`HAP-NodeJS v${HAPLibraryVersion()} starting...`);

console.warn("DEPRECATION NOTICE: The use of Core and BridgeCore are deprecated and are scheduled to be remove in October 2020. " +
"For more information and some guidance on how to migrate, have a look at https://github.com/homebridge/HAP-NodeJS/wiki/Deprecation-of-Core-and-BridgeCore");
console.warn("DEPRECATION NOTICE: The use of Core and BridgeCore is deprecated and is scheduled to be removed in a future version.");
console.warn("For more information and some guidance on how to migrate, have a look at https://github.com/homebridge/HAP-NodeJS/wiki/Deprecation-of-Core-and-BridgeCore");

Check warning on line 10 in src/Core.ts

View workflow job for this annotation

GitHub Actions / lint / ESLint

This line has a length of 170. Maximum allowed is 160

// Initialize our storage system
storage.initSync();
Expand Down Expand Up @@ -50,12 +50,7 @@
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Object.keys(signals).forEach((signal: any) => {
process.on(signal, () => {
for (let i = 0; i < accessories.length; i++) {
accessories[i].unpublish();
}

setTimeout(() => {
process.exit(128 + signals[signal]);
}, 1000);
Promise.all(accessories.map(a => a.unpublish()))
.then(() => setTimeout(() => process.exit(128 + signals[signal]), 1000));
});
});
4 changes: 2 additions & 2 deletions src/accessories/Sprinkler_accessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const SPRINKLER = {
const sprinklerUUID = uuid.generate("hap-nodejs:accessories:sprinkler");

// This is the Accessory that we'll return to HAP-NodeJS that represents our fake motionSensor.
const sprinkler = exports.accessory = new Accessory("💦 Sprinkler", sprinklerUUID);
const sprinkler = exports.accessory = new Accessory("Sprinkler", sprinklerUUID);

// Add properties for publishing (in case we're using Core.js and not BridgedCore.js)
// @ts-expect-error: Core/BridgeCore API
Expand All @@ -44,7 +44,7 @@ sprinkler.pincode = "123-44-567";
sprinkler.category = Categories.SPRINKLER;

// Add the actual Valve Service and listen for change events from iOS.
const sprinklerService = sprinkler.addService(Service.Valve, "💦 Sprinkler");
const sprinklerService = sprinkler.addService(Service.Valve, "Sprinkler");

// Sprinkler Controll
function openVentile() {
Expand Down
Loading