Skip to content

Commit

Permalink
release 4.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
grzegorz914 committed Jan 2, 2024
1 parent a65b57d commit fa01c17
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## The properties *inputs.displayType* and *surrounds.displayType* are removed.
## Note - after update to 3.15.x need remove the accessory frome Home app and add it again.

## [4.5.0] - (02.01.2024)
## Changes
- added possibility to disable prefix name for buttons and sensors [#215](https://github.com/grzegorz914/homebridge-denon-tv/issues/215)
- config schema updated
- cleanup

## [4.4.0] - (29.12.2023)
## Changes
- added possibility to select display inputs order, possible by `None`, `Alphabetically Name`, `Alphabetically Reference`
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,15 @@ Tested with Denon AVR-X6300H, Denon AVR-X2700H, Denon AVR-3311CI, Marantz SR8012
| `buttons.name` | Here set *Button Name* which You want expose to the *Homebridge/HomeKit*. |
| `buttons.reference` | Here choice function for additional control button for Main Zone. |
| `buttons.displayType` | Here select display type in HomeKit app, possible `-1 - None/Disabled`, `0 - Outlet`, `1 - Switch`.|
| `buttons.namePrefix` | Here enable/disable the accessory name as a prefix for button name.|
| `sensorPower`| If enabled, then the Power will be exposed as a `Contact Sensor` to use with automations. |
| `sensorVolume`| If enabled, then the Volume will be exposed as a `Contact Sensor` to use with automations. |
| `sensorMute`| If enabled, then the Mute will be exposed as a `Contact Sensor` to use with automations. |
| `sensorInput`| If enabled, then the Input will be exposed as a `Contact Sensor` to use with automations. |
| `sensorInputs.name` | Here set own *Name* which You want expose to the *Homebridge/HomeKit* for this sensor. |
| `sensorInputs.reference` | Here set *Reference* like `CBL/SAT`, `GAME` to be exposed as `Contact Sensor` active on switch to this Input. |
| `sensorInputs.displayType` | Here select sensor type to be exposed in HomeKit app, `-1 - None/Disabled`, `0 - Motion Sensor`, `1 - Occupancy Sensor`, `2 - Contact Sensor`. |
| `sensorInputs.namePrefix` | Here enable/disable the accessory name as a prefix for sensor name.|
| `enableDebugMode` | If enabled, deep log will be present in homebridge console. |
| `disableLogInfo` | If enabled, disable log info, all values and state will not be displayed in Homebridge log console. |
| `disableLogDeviceInfo` | If enabled, add ability to disable log device info by every connections device to the network. |
Expand Down
20 changes: 18 additions & 2 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4441,6 +4441,13 @@
],
"description": "Here select display type in HomeKit app.",
"required": true
},
"namePrefix": {
"title": "Prefix",
"type": "boolean",
"default": false,
"description": "Here enable/disable the accessory name as a prefix for button name.",
"required": true
}
}
}
Expand Down Expand Up @@ -4525,6 +4532,13 @@
],
"description": "Here select sensor type to be exposed in HomeKit app.",
"required": true
},
"namePrefix": {
"title": "Prefix",
"type": "boolean",
"default": false,
"description": "Here enable/disable the accessory name as a prefix for sensor name.",
"required": true
}
}
}
Expand Down Expand Up @@ -4838,7 +4852,8 @@
"items": [
"devices[].buttons[].name",
"devices[].buttons[].reference",
"devices[].buttons[].displayType"
"devices[].buttons[].displayType",
"devices[].buttons[].namePrefix"
]
}
]
Expand Down Expand Up @@ -4877,7 +4892,8 @@
"items": [
"devices[].sensorInputs[].name",
"devices[].sensorInputs[].reference",
"devices[].sensorInputs[].displayType"
"devices[].sensorInputs[].displayType",
"devices[].sensorInputs[].namePrefix"
]
}
]
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"displayName": "Denon TV",
"name": "homebridge-denon-tv",
"version": "4.4.4",
"version": "4.5.0",
"description": "Homebridge plugin to control Denon/Marantz AV Receivers.",
"license": "MIT",
"author": "grzegorz914",
Expand Down Expand Up @@ -42,8 +42,8 @@
"heos"
],
"funding": {
"type" : "github",
"url" : "https://github.com/sponsors/grzegorz914"
"type": "github",
"url": "https://github.com/sponsors/grzegorz914"
},
"contributors": [],
"scripts": {
Expand Down
9 changes: 6 additions & 3 deletions sample-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@
{
"name": "MASTER POWER ON",
"reference": "0PWON",
"displayType": -1
"displayType": -1,
"namePrefix": false
},
{
"name": "ZM POWER ON",
"reference": "0ZMON",
"displayType": -1
"displayType": -1,
"namePrefix": false
}
],
"sensorPower": false,
Expand All @@ -60,7 +62,8 @@
{
"name": "Tuner Sat",
"reference": "CBL/SAT",
"displayType": -1
"displayType": -1,
"namePrefix": false
}
],
"enableDebugMode": false,
Expand Down
12 changes: 10 additions & 2 deletions src/denondevice.js
Original file line number Diff line number Diff line change
Expand Up @@ -1049,13 +1049,17 @@ class DenonDevice extends EventEmitter {
//get display type
const sensorInputDisplayType = sensorInput.displayType >= 0 ? sensorInput.displayType : -1;

//get button reference
const namePrefix = sensorInput.namePrefix ?? false;

if (sensorInputDisplayType >= 0) {
if (sensorInputName && sensorInputReference) {
const name = namePrefix ? `${accessoryName} ${sensorInputName}` : sensorInputName;
const serviceType = [Service.MotionSensor, Service.OccupancySensor, Service.ContactSensor][sensorInputDisplayType];
const characteristicType = [Characteristic.MotionDetected, Characteristic.OccupancyDetected, Characteristic.ContactSensorState][sensorInputDisplayType];
const sensorInputService = new serviceType(`${accessoryName} ${sensorInputName}`, `Sensor ${i}`);
sensorInputService.addOptionalCharacteristic(Characteristic.ConfiguredName);
sensorInputService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} ${sensorInputName}`);
sensorInputService.setCharacteristic(Characteristic.ConfiguredName, name);
sensorInputService.getCharacteristic(characteristicType)
.onGet(async () => {
const state = this.power ? (this.reference === sensorInputReference) : false;
Expand Down Expand Up @@ -1093,12 +1097,16 @@ class DenonDevice extends EventEmitter {
//get button display type
const buttonDisplayType = button.displayType >= 0 ? button.displayType : -1;

//get button reference
const namePrefix = button.namePrefix ?? false;

if (buttonDisplayType >= 0) {
if (buttonName && buttonReference) {
const serviceType = [Service.Outlet, Service.Switch][buttonDisplayType];
const name = namePrefix ? `${accessoryName} ${buttonName}` : buttonName;
const buttonService = new serviceType(`${this.sZoneName} ${buttonName}`, `Button ${i}`);
buttonService.addOptionalCharacteristic(Characteristic.ConfiguredName);
buttonService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} ${buttonName}`);
buttonService.setCharacteristic(Characteristic.ConfiguredName, name);
buttonService.getCharacteristic(Characteristic.On)
.onGet(async () => {
const state = false;
Expand Down

0 comments on commit fa01c17

Please sign in to comment.