From 12e3d8d96696bb3eb89762137f005238faee5972 Mon Sep 17 00:00:00 2001 From: kuestess Date: Tue, 19 Sep 2023 20:01:32 -0400 Subject: [PATCH] Fix for target keypads feature --- CHANGELOG.md | 3 +++ README.md | 1 + package.json | 2 +- src/InsteonLocalAccessory.ts | 11 ++++++++--- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d1eb9e..168988a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog All notable changes to this project will be documented in this file. +## [0.5.11] - 2023-09-19 +### Fixed +- Fix for target keypads feature (#300) ## [0.5.10] - 2023-07-29 ### Enhanced diff --git a/README.md b/README.md index 3049e04..ef2368f 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ Devices are also defined in the config.json as follows: - `targetKeypadID`: this is an array `["",""]` of Insteon keypad(s), whose scene button LED you would like to set accoridngly to the state of the device. See additional notes below on Target Keypad LED. - `targetKeypadBtn`: this is an array `["button_letter","button_letter"]` of Insteon keypad button(s), 'A' - 'H', that corresponds to the array from `targetKeypadID`. See additional notes below on Target Keypad LED. - `targetKeypadSixBtn`: this is an array `[true/false, true/false]` of Insteon keypad button layout, that corresponds to the array from `targetKeypadID`. `true` denote a 6-button keypad, while `false` denotes an 8-button keypad. See additional notes below on Target Keypad LED. + - `targetKeypadFourBtn`: similar to `targetKeypadSixBtn` above but for a 4-button (i3) keypad. `true` denotes a 4-button keypad, while `false` denotes an 8-button keypad. See additional notes below on Target Keypad LED. - `disabled`: set to true to disable Insteon communication for a device (defaults to false). Device will still appear in Home (or other apps), but can't be controlled. Good to use for 'seasonal' devices. - `groupMembers`: comma-delimited list of Insteon IDs that are linked to this device (optional, for devices with on/off states like dimmers and switches); member device status will be automatically updated after the device is turned on or off diff --git a/package.json b/package.json index ca259d4..434c79c 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "private": false, "displayName": "InsteonLocal", "name": "homebridge-platform-insteonlocal", - "version": "0.5.10", + "version": "0.5.11", "description": "Insteon platform plugin with local control for homebridge: https://github.com/nfarina/homebridge", "license": "ISC", "repository": { diff --git a/src/InsteonLocalAccessory.ts b/src/InsteonLocalAccessory.ts index a675ee7..d3a6528 100644 --- a/src/InsteonLocalAccessory.ts +++ b/src/InsteonLocalAccessory.ts @@ -67,6 +67,7 @@ export class InsteonLocalAccessory { currentTemp: any; targetTemp: any; refresh: number; + targetKeypadFourBtn: any; constructor( private readonly platform: InsteonLocalPlatform, @@ -89,6 +90,7 @@ export class InsteonLocalAccessory { this.targetKeypadID = this.device.targetKeypadID || []; this.targetKeypadSixBtn = this.device.targetKeypadSixBtn || []; + this.targetKeypadFourBtn = this.device.targetKeypadFourBtn || []; this.targetKeypadBtn = this.device.targetKeypadBtn || []; this.setTargetKeypadCount = 0; @@ -1402,12 +1404,15 @@ export class InsteonLocalAccessory { //this.log.debug(' index1 = ' + index1) - if(this.six_btn == true){ + if(this.targetKeypadSixBtn[index1] == true){ buttonArray = six_buttonArray; - } else if (this.four_btn == true){ + this.log.debug(' Using 6-button keypad layout'); + } else if(this.targetKeypadFourBtn[index1] == true){ buttonArray = four_buttonArray; - } else { + this.log.debug(' Using 4-button keypad layout'); + }else { buttonArray = eight_buttonArray; + this.log.debug(' Using 8-button keypad layout'); } const buttonNumber = buttonArray[this.targetKeypadBtn[index1]];