Skip to content

Commit

Permalink
Updates to support homebridge-automation (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
NorthernMan54 authored Dec 4, 2024
1 parent 1538265 commit 757b698
Show file tree
Hide file tree
Showing 7 changed files with 414 additions and 204 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

All notable changes to `@homebridge/hap-client` will be documented in this file. This project tries to adhere to [Semantic Versioning](http://semver.org/).

## v2.0.5 (2024-12-04)

### Changed

- updated dependencies
- Added refresh of 'values' field when refreshServiceCharacteristics or getCharacteristic is used
- Added new setCharacteristic option, setCharacteristicByType which finds characteristic by type for setting.
- Added new getResource request to retrieve snapshot images from camera's
- Minor tweak to serviceName, and if the name is blank, use the name value from Accessory Information
- Fixed issue of error handler triggering an error when attempting to connect to a homebridge instance that is down
- Added restart of monitor when client connections close
- Added console logging if a logger is not provided

## v2.0.4 (2024-11-07)

### Changed
Expand Down
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,46 @@

A client for an insecure HAP-NodeJS instance. Provides a Typescript based interface based on the homekit accessory protocol, allowing the creation of clients able to connect to and control Homebridge devices.

# API

```
const { HapClient } = require('@homebridge/hap-client');
this.hapClient = new HapClient({
config: { debug: true },
pin: config.username,
logger: this.log,
});
this.monitor = await this.hapClient.monitorCharacteristics(services?: ServiceType[]); // Creates event monitors for all event capabable Homebridge services. If a list of services is, this list is used rather than all
```

## hap-client Events

```
this.hapClient.on('instance-discovered', this.instanceDiscovered(instance: HapInstance)); // Emitted during discovery for each HB instance discovered
this.hapClient.on('instance-configuration-changed', this.instanceChanged(instance: HapInstance)); // Emitted during discovery for each HB instance change
this.hapClient.on('discovery-terminated', this.discoveryTerminated()); // Instance discovery was terminated
this.hapClient.on('discovery-ended', this.discoveryEnded()); // Emitted when discovery has ended ( 60 Seconds )
this.monitor.on('service-update', this.serviceUpdate(services)); // Emitted when a characteristic change is received from a homebridge service
this.monitor.on('monitor-close', this.monitorClose(instance, hadError)); // Emitted when the connection to a homebridge service is closed ( likely a restart )
this.monitor.on('monitor-error', this.monitorError(instance, error)); // Emitted when the connection to a homebridge service has an error ( likely a restart )
this.monitor.on('monitor-refresh', this.monitorRefresh(instance, error)); // Emitted when the connection to a homebridge instance has been refreshed ( Triggered when an instance is discovered and its port, configuration number or name has changed)
```


# Dependant Applications

- homebridge-config-ui-x
- homebridge-gsh
- node-red-contrib-homebridge-automation

- [NPM Dependants](https://www.npmjs.com/package/@homebridge/hap-client?activeTab=dependents)

Expand Down
Loading

0 comments on commit 757b698

Please sign in to comment.