Skip to content

Commit

Permalink
Merge branch 'beta-0.12.3' into ipv4mapped2ipv6-hap
Browse files Browse the repository at this point in the history
  • Loading branch information
donavanbecker authored Jun 28, 2024
2 parents c2b70b8 + 7089876 commit f4e3227
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ All notable changes to `hap-nodejs` will be documented in this file. This projec
- AdaptiveLightingController fix & improvement (#1038) (@Shaquu)
- Minor fixes to recording logging and one change in logging. (#1040) (@hjdhjd)
- Fix Build Issues (#1041) (@NorthernMan54)
- Bridged core and core cleanup (#1048) (@Shaquu)
- Correct log spacing
- Updated and fixed `typedoc` config file
- Updated dependencies
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

<a href="https://www.npmjs.com/package/hap-nodejs"><img title="npm version" src="https://badgen.net/npm/v/hap-nodejs" ></a>
<a href="https://www.npmjs.com/package/hap-nodejs/v/beta"><img title="npm version beta" src="https://badgen.net/npm/v/hap-nodejs/beta" ></a>
<a href="https://www.npmjs.com/package/hap-nodejs/v/alpha"><img title="npm version apha" src="https://badgen.net/npm/v/hap-nodejs/alpha" ></a><br>
<a href="https://www.npmjs.com/package/hap-nodejs"><img title="npm downloads" src="https://badgen.net/npm/dt/hap-nodejs" ></a>
<a href="https://github.com/homebridge/HAP-NodeJS/actions/workflows/build.yml"><img title="Node Build" src="https://github.com/homebridge/HAP-NodeJS/actions/workflows/build.yml/badge.svg" ></a>
<a href='https://coveralls.io/github/homebridge/HAP-NodeJS'><img src='https://coveralls.io/repos/github/homebridge/HAP-NodeJS/badge.svg' alt='Coverage Status' /></a>
Expand Down
11 changes: 5 additions & 6 deletions src/BridgedCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import { Accessory, AccessoryEventTypes, AccessoryLoader, Bridge, Categories, HA

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");

// Initialize our storage system
storage.initSync();
Expand Down Expand Up @@ -42,9 +43,7 @@ const signals = { "SIGINT": 2, "SIGTERM": 15 } as Record<string, number>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Object.keys(signals).forEach((signal: any) => {
process.on(signal, () => {
bridge.unpublish();
setTimeout(()=> {
process.exit(128 + signals[signal]);
}, 1000);
bridge.unpublish()
.then(() => setTimeout(() => process.exit(128 + signals[signal]), 1000));
});
});
18 changes: 7 additions & 11 deletions src/Core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import { AccessoryLoader, HAPLibraryVersion } from "./";

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");

// Initialize our storage system
storage.initSync();
Expand All @@ -26,13 +27,13 @@ accessories.forEach((accessory) => {
// @ts-expect-error: Core/BridgeCore API
if (!accessory.username) {
throw new Error("Username not found on accessory '" + accessory.displayName +
"'. Core.js requires all accessories to define a unique 'username' property.");
"'. Core.js requires all accessories to define a unique 'username' property.");
}

// @ts-expect-error: Core/BridgeCore API
if (!accessory.pincode) {
throw new Error("Pincode not found on accessory '" + accessory.displayName +
"'. Core.js requires all accessories to define a 'pincode' property.");
"'. Core.js requires all accessories to define a 'pincode' property.");
}

// publish this Accessory on the local network
Expand All @@ -50,12 +51,7 @@ const signals = { "SIGINT": 2, "SIGTERM": 15 } as Record<string, number>;
// 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

0 comments on commit f4e3227

Please sign in to comment.