Skip to content

Commit

Permalink
v2.4.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjdhjd committed Sep 30, 2024
1 parent 5656054 commit 4bd610c
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 72 deletions.
4 changes: 4 additions & 0 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file. This project uses [semantic versioning](https://semver.org/).

## 2.4.0 (2024-09-30)
* Behavior change: HBR will now ensure HomeKit accessory names are compliant with [HomeKit's naming guidelines](https://developer.apple.com/design/human-interface-guidelines/homekit#Help-people-choose-useful-names). Invalid characters will be replaced with a space, and multiple spaces will be squashed.
* Housekeeping.

## 2.3.3 (2024-09-24)
* Improvement: better name resolution.
* Housekeeping.
Expand Down
1 change: 1 addition & 0 deletions homebridge-ui/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ <h5>Introduction</h5>
Plugins by <a target="_blank" href="https://github.com/hjdhjd">HJD</a>:

<ul dir="auto">
<li><a target="_blank" href="https://github.com/hjdhjd/homebridge-comed-hourlypricing">homebridge-comed-hourlypricing: HomeKit integration for ComEd Hourly Pricing customers.</a></li>
<li><a target="_blank" href="https://github.com/hjdhjd/homebridge-hunter-hydrawise">homebridge-hunter-hydrawise: Hunter Hydrawise integration for HomeKit.</a></li>
<li><a target="_blank" href="https://github.com/hjdhjd/homebridge-ratgdo">homebridge-ratgdo: Ratgdo (non-myQ Liftmaster and Chamberlain) garage door and gate opener support for HomeKit</a></li>
<li><a target="_blank" href="https://github.com/hjdhjd/homebridge-unifi-access">homebridge-unifi-access: HomeKit integration for the UniFi Access ecosystem</a></li>
Expand Down
118 changes: 59 additions & 59 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "homebridge-ratgdo",
"displayName": "Homebridge Ratgdo",
"version": "2.3.3",
"version": "2.4.0",
"description": "HomeKit integration for LiftMaster and Chamberlain garage door openers, without requiring myQ.",
"license": "ISC",
"repository": {
Expand Down Expand Up @@ -33,18 +33,18 @@
"devDependencies": {
"@stylistic/eslint-plugin": "^2.8.0",
"@types/eventsource": "^1.1.15",
"@types/node": "^22.6.1",
"@types/node": "^22.7.4",
"eslint": "9.11.1",
"homebridge": "^1.8.4",
"shx": "^0.3.4",
"typescript": "^5.6.2",
"typescript-eslint": "^8.7.0"
"typescript-eslint": "^8.8.0"
},
"dependencies": {
"@adobe/fetch": "^4.1.9",
"@homebridge/plugin-ui-utils": "^1.0.3",
"bonjour-service": "^1.2.1",
"eventsource": "^2.0.2",
"homebridge-plugin-utils": "^1.8.2"
"homebridge-plugin-utils": "^1.9.0"
}
}
16 changes: 9 additions & 7 deletions src/ratgdo-device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
import { API, CharacteristicValue, HAP, PlatformAccessory } from "homebridge";
import { FetchError, fetch } from "@adobe/fetch";
import { HomebridgePluginLogging, acquireService, validService } from "homebridge-plugin-utils";
import { HomebridgePluginLogging, acquireService, validService, validateName } from "homebridge-plugin-utils";
import { RATGDO_MOTION_DURATION, RATGDO_OCCUPANCY_DURATION } from "./settings.js";
import { RatgdoDevice, RatgdoReservedNames, RatgdoVariant } from "./ratgdo-types.js";
import { RatgdoOptions } from "./ratgdo-options.js";
Expand Down Expand Up @@ -1293,21 +1293,21 @@ export class RatgdoAccessory {
// We use the garage door service as the natural proxy for the name.
let name = this.accessory.getService(this.hap.Service.GarageDoorOpener)?.getCharacteristic(this.hap.Characteristic.ConfiguredName).value as string;

if(name.length) {
if(name?.length) {

return name;
}

name = this.accessory.getService(this.hap.Service.GarageDoorOpener)?.getCharacteristic(this.hap.Characteristic.Name).value as string;

if(name.length) {
if(name?.length) {

return name;
}

name = this.accessory.displayName;

if(name.length) {
if(name?.length) {

return name;
}
Expand All @@ -1325,11 +1325,13 @@ export class RatgdoAccessory {
// Utility function to set the current accessory name of this device.
private set accessoryName(name: string) {

const cleanedName = validateName(name);

// Set all the internally managed names within Homebridge to the new accessory name.
this.accessory.displayName = name;
this.accessory._associatedHAPAccessory.displayName = name;
this.accessory.displayName = cleanedName;
this.accessory._associatedHAPAccessory.displayName = cleanedName;

// Set all the HomeKit-visible names.
this.accessory.getService(this.hap.Service.AccessoryInformation)?.updateCharacteristic(this.hap.Characteristic.Name, name);
this.accessory.getService(this.hap.Service.AccessoryInformation)?.updateCharacteristic(this.hap.Characteristic.Name, cleanedName);
}
}
4 changes: 2 additions & 2 deletions src/ratgdo-platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
import { API, APIEvent, DynamicPlatformPlugin, HAP, Logging, PlatformAccessory, PlatformConfig } from "homebridge";
import { Bonjour, Service } from "bonjour-service";
import { FeatureOptions, MqttClient } from "homebridge-plugin-utils";
import { FeatureOptions, MqttClient, validateName } from "homebridge-plugin-utils";
import { PLATFORM_NAME, PLUGIN_NAME, RATGDO_AUTODISCOVERY_INTERVAL, RATGDO_AUTODISCOVERY_PROJECT_NAMES, RATGDO_AUTODISCOVERY_TYPES, RATGDO_HEARTBEAT_DURATION,
RATGDO_HEARTBEAT_INTERVAL, RATGDO_MQTT_TOPIC } from "./settings.js";
import { RatgdoOptions, featureOptionCategories, featureOptions } from "./ratgdo-options.js";
Expand Down Expand Up @@ -375,7 +375,7 @@ export class RatgdoPlatform implements DynamicPlatformPlugin {
// It's a new device - let's add it to HomeKit.
if(!accessory) {

accessory = new this.api.platformAccessory(device.name, uuid);
accessory = new this.api.platformAccessory(validateName(device.name), uuid);

// Register this accessory with Homebridge and add it to the accessory array so we can track it.
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
Expand Down

0 comments on commit 4bd610c

Please sign in to comment.