Skip to content

Commit

Permalink
InputController
Browse files Browse the repository at this point in the history
  • Loading branch information
NorthernMan54 committed Sep 23, 2024
1 parent 237cc3e commit b9f24a6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 27 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ All notable changes to this project will be documented in this file. This projec

- Update `filter` to accept a list of addresses and ports ie "192.168.1.11:51551, 192.168.1.11:46047"
- Add config option `enhancedSkip` to allow the wording `Alexa, tv skip` when watching youtube via appletv-enhanced to push the select button on the remote.
- Add support for Homebridge 2.0
- When using appletv-enhanced, added ability to change apps with the wording `Alexa, switch to `app` on the TV.`

## 0.7.0 (2023-05-30)

Expand Down
22 changes: 1 addition & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,27 +370,7 @@ Sometimes during troubleshooting I need a dump of your homebridge accessories. P
curl -X PUT http://127.0.0.1:51826/accessories --header "Content-Type:Application/json" --header "authorization: 031-45-154"
```

If needed during plugin startup with the debug option enabled ( this is available with version 0.5.64 ), the plugin will log the unique command for each homebridge instance in your setup, including child bridges.

The entries in the log file look like this for each homebridge instance.

```
alexaActions Homebridge Accessory Information Dump for Hue B509
alexaActions curl -X PUT http://192.168.1.11:40889/accessories --header "Content-Type:Application/json" --header "authorization: 031-45-154"
alexaActions
alexaActions Homebridge Accessory Information Dump for Alexa E33F
alexaActions curl -X PUT http://192.168.1.11:33019/accessories --header "Content-Type:Application/json" --header "authorization: 031-45-154"
alexaActions
alexaActions Homebridge Accessory Information Dump for Tuner 8723
alexaActions curl -X PUT http://192.168.1.11:45397/accessories --header "Content-Type:Application/json" --header "authorization: 031-45-154"
alexaActions
alexaActions Homebridge Accessory Information Dump for Tasmota 5019
alexaActions curl -X PUT http://192.168.1.11:38859/accessories --header "Content-Type:Application/json" --header "authorization: 031-45-154"
alexaActions
alexaActions Homebridge Accessory Information Dump for homebridge-tuya BF07
alexaActions curl -X PUT http://192.168.1.11:36323/accessories --header "Content-Type:Application/json" --header "authorization: 031-45-154"
alexaActions
```
When your running under child bridges it can be tricky to find the ip address and port number of the child bridge and I found the easiest method is to leverage the [Discovery - DNS-SD Browser](https://apps.apple.com/ca/app/discovery-dns-sd-browser/id1381004916?mt=12) app, and look under _hap._tcp. for the child bridge. The child bridge name should mention the name of the plugin.

# Roadmap

Expand Down
25 changes: 19 additions & 6 deletions lib/parse/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ function stateToProperties(statusObject, hbResponse) {
"timeOfSample": now.toISOString(),
"uncertaintyInMilliseconds": 500
});
}
}
break;
default:
debug("ERROR: statusReport unknown/handled device", element, reportState);
Expand Down Expand Up @@ -270,11 +270,13 @@ function mergeCookies(into, from) {
}

function mergeInputCookies(into, from) {
// console.log("mergeInputCookies", into, from, this);
// debug("into", JSON.parse(into['Active Identifier']).iid);
var inputs = {};
var activeIdentifier = JSON.parse(into['Active Identifier']).iid;
var i = 0;
for (var cookie in from) {
// debug("mergeInputCookies", cookie, from[cookie]);
// console.log("mergeInputCookies", cookie, from[cookie]);
switch (cookie) {
case "Channel":
case "ReportState":
Expand All @@ -285,7 +287,8 @@ function mergeInputCookies(into, from) {
if (cookie.substring(0, 10) === "Station - ") {
into[cookie.substring(10)] = JSON.stringify(input);
} else {
into[cookie] = JSON.stringify(input);
// console.log("mergeInputCookies", cookie, input);
into[inputArray[i++]] = JSON.stringify(input);
}
}

Expand All @@ -311,6 +314,12 @@ function mergeCapabilities(into, from) {
}
}

// Valid InputController Values

// AUX 1, AUX 2, AUX 3, AUX 4, AUX 5, AUX 6, AUX 7, BLURAY, CABLE, CD, COAX 1, COAX 2, COMPOSITE 1, DVD, GAME, HD RADIO, HDMI 1, HDMI 2, HDMI 3, HDMI 4, HDMI 5, HDMI 6, HDMI 7, HDMI 8, HDMI 9, HDMI 10, HDMI ARC, INPUT 1, INPUT 2, INPUT 3, INPUT 4, INPUT 5, INPUT 6, INPUT 7, INPUT 8, INPUT 9, INPUT 10, IPOD, LINE 1, LINE 2, LINE 3, LINE 4, LINE 5, LINE 6, LINE 7, MEDIA PLAYER, OPTICAL 1, OPTICAL 2, PHONO, PLAYSTATION, PLAYSTATION 3, PLAYSTATION 4, SATELLITE, SMARTCAST, TUNER, TV, USB DAC, VIDEO 1, VIDEO 2, VIDEO 3, XBOX

const inputArray = ["AUX 1", "AUX 2", "AUX 3", "AUX 4", "AUX 5", "AUX 6", "AUX 7", "HDMI 1", "HDMI 2", "HDMI 3", "HDMI 4", "HDMI 5", "HDMI 6", "HDMI 7", "HDMI 8", "HDMI 9", "HDMI 10", "HDMI ARC", "INPUT 1", "INPUT 2", "INPUT 3", "INPUT 4", "INPUT 5", "INPUT 6", "INPUT 7", "INPUT 8", "INPUT 9", "INPUT 10", "LINE 1", "LINE 2", "LINE 3", "LINE 4", "LINE 5", "LINE 6", "LINE 7", "MEDIA PLAYER", "OPTICAL 1", "OPTICAL 2", "PHONO", "PLAYSTATION", "PLAYSTATION 3", "PLAYSTATION 4", "SATELLITE", "SMARTCAST", "TUNER", "TV", "USB DAC", "VIDEO 1", "VIDEO 2", "VIDEO 3", "XBOX", "BLURAY", "CABLE", "CD", "COAX 1", "COAX 2", "COMPOSITE 1", "DVD", "GAME", "HD RADIO", "IPOD"];

function lookupCapabilities(capability, options, operations, devices) {
var response = [];
switch (capability) {
Expand Down Expand Up @@ -347,10 +356,14 @@ function lookupCapabilities(capability, options, operations, devices) {
supported = supported.filter(function (item) {
return item.substring(0, 10) !== 'Station - ';
});

// console.log("Supported Inputs", capability, options, operations, devices, this);

var inputs = [];
supported.forEach((item, i) => {
inputs.push({
name: item
name: inputArray[i],
friendNames: [item]
});
});

Expand Down Expand Up @@ -1078,7 +1091,7 @@ function round(value, precision) {

function inputs(options, accessories) {
// Create input controller Object

// console.log("Inputs(", options, accessories);
options.inputs.forEach(function (input) {
// debug("Input", input);
var inputs = [];
Expand All @@ -1087,7 +1100,7 @@ function inputs(options, accessories) {
// Find endpoint that should be part of the input

input.devices.forEach(function (device) {
// debug("Device", device);


cookies = Object.assign(cookies, _getCookie(device, accessories));

Expand Down

0 comments on commit b9f24a6

Please sign in to comment.