Skip to content

Commit

Permalink
feat: add more channels to input map
Browse files Browse the repository at this point in the history
Closes #2. Closes #2.
  • Loading branch information
mattmattmatt committed Feb 3, 2019
1 parent 0805196 commit dab143f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ npm i node-red-contrib-avr-pioneer -S

## Usage

Provides two palette nodes – one to send control commands to a Pioneer AVR, and one to receive messages when receiver's state changes.
Currently provides one palette node – one to send control commands to a Pioneer AVR.

![](https://github.com/mattmattmatt/node-red-contrib-avr-pioneer/blob/master/tooling/nodes.png?raw=true)
![](https://cldup.com/T5692bE_OT.png)


### Output node
Expand All @@ -37,7 +37,7 @@ Sets the state of the receiver.
| `on` | Sets the `on` state where the value is `true` or `false` |
| `muted` | Sets the `muted` state where the value is `true` or `false` |
| `volume` | Sets the volume from `0` to `74`, or whatever your receiver's maximum is |
| `channel` | Sets the active input channel, must be one of `CD`, `TUNER`, `DVD`, `TV`, `SAT/CBL`, `VIDEO`, `DVR/BDR`, `IPOD/USB`, `BD`, `ADAPTER`, `NETRADIO`, `MEDIA SERVER`, `FAVORITE`, `GAME` |
| `channel` | Sets the active input channel, must be one of `PHONO`, `CD`, `TUNER`, `TAPE`, `DVD`, `TV`, `SAT/CBL`, `SAT`, `CBL`, `CABLE`, `VIDEO`, `MULTI CH IN`, `USB-DAC`, `VIDEO2`, `DVR/BDR`, `DVR`, `BDR`, `IPOD/USB`, `USB`, `IPOD`, `XM RADIO`, `HDMI1`, `HDMI2`, `HDMI3`, `HDMI4`, `HDMI5`, `HDMI6`, `BD`, `MEDIA GALLERY`, `SIRIUS`, `HDMI CYCLE`, `ADAPTER`, `HDMI7`, `HDMI8`, `NETRADIO`, `SIRIUSXM`, `PANDORA`, `MEDIA SERVER`, `MEDIA`, `FAVORITE`, `MHL`, `GAME`, `SPOTIFY`.<br> [See source](https://github.com/mattmattmatt/node-red-contrib-avr-pioneer/blob/master/src/PioneerAvrOut.js#L5) for more info on input codes. |

#### Example payloads

Expand Down
2 changes: 1 addition & 1 deletion pioneer-avr-out.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ <h3>Inputs</h3>
<dt>payload.volume <span class="property-type">number</span></dt>
<dd></dd>
<dt>payload.channel <span class="property-type">enum</span></dt>
<dd>One of <code>CD</code>, <code>TUNER</code>, <code>DVD</code>, <code>TV</code>, <code>SAT/CBL</code>, <code>VIDEO</code>, <code>DVR/BDR</code>, <code>IPOD/USB</code>, <code>BD</code>, <code>ADAPTER</code>, <code>NETRADIO</code>, <code>MEDIA SERVER</code>, <code>FAVORITE</code>, <code>GAME</code></dd>
<dd>One of <code>PHONO</code>, <code>CD</code>, <code>TUNER</code>, <code>TAPE</code>, <code>DVD</code>, <code>TV</code>, <code>SAT/CBL</code>, <code>SAT</code>, <code>CBL</code>, <code>CABLE</code>, <code>VIDEO</code>, <code>MULTI CH IN</code>, <code>USB-DAC</code>, <code>VIDEO2</code>, <code>DVR/BDR</code>, <code>DVR</code>, <code>BDR</code>, <code>IPOD/USB</code>, <code>USB</code>, <code>IPOD</code>, <code>XM RADIO</code>, <code>HDMI1</code>, <code>HDMI2</code>, <code>HDMI3</code>, <code>HDMI4</code>, <code>HDMI5</code>, <code>HDMI6</code>, <code>BD</code>, <code>MEDIA GALLERY</code>, <code>SIRIUS</code>, <code>HDMI CYCLE</code>, <code>ADAPTER</code>, <code>HDMI7</code>, <code>HDMI8</code>, <code>NETRADIO</code>, <code>SIRIUSXM</code>, <code>PANDORA</code>, <code>MEDIA SERVER</code>, <code>MEDIA</code>, <code>FAVORITE</code>, <code>MHL</code>, <code>GAME</code>, <code>SPOTIFY</code></dd>
</dl>

<h4>Example inputs</h4>
Expand Down
43 changes: 43 additions & 0 deletions src/PioneerAvrOut.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,87 @@ import { isJson, parse, random } from './utils';
const MSG_INTERVAL_MS = 180;

const channelToInput = {
PHONO: '00',
CD: '01',
TUNER: '02',
TAPE: '03',
DVD: '04',
TV: '05',
'SAT/CBL': '06',
SAT: '06',
CBL: '06',
CABLE: '06',
VIDEO: '10',
'MULTI CH IN': '12',
'USB-DAC': '13',
VIDEO2: '14',
'DVR/BDR': '15',
DVR: '15',
BDR: '15',
'IPOD/USB': '17',
USB: '17',
IPOD: '17',
'XM RADIO': '18',
HDMI1: '19',
HDMI2: '20',
HDMI3: '21',
HDMI4: '22',
HDMI5: '23',
HDMI6: '24',
BD: '25',
'MEDIA GALLERY': '26',
SIRIUS: '27',
'HDMI CYCLE': '31',
ADAPTER: '33',
HDMI7: '34',
HDMI8: '35',
NETRADIO: '38',
SIRIUSXM: '40',
PANDORA: '41',
'MEDIA SERVER': '44',
MEDIA: '44',
FAVORITE: '45',
MHL: '48',
GAME: '49',
SPOTIFY: '57',
};

const inputToChannel = {
'00': 'PHONO',
'01': 'CD',
'02': 'TUNER',
'03': 'TAPE',
'04': 'DVD',
'05': 'TV',
'06': 'SAT/CBL',
'10': 'VIDEO',
'12': 'MULTI CH IN',
'13': 'USB-DAC',
'14': 'VIDEO2',
'15': 'DVR/BDR',
'17': 'IPOD/USB',
'18': 'XM RADIO',
'19': 'HDMI1',
'20': 'HDMI2',
'21': 'HDMI3',
'22': 'HDMI4',
'23': 'HDMI5',
'24': 'HDMI6',
'25': 'BD',
'26': 'MEDIA GALLERY',
'27': 'SIRIUS',
'31': 'HDMI CYCLE',
'33': 'ADAPTER',
'34': 'HDMI7',
'35': 'HDMI8',
'38': 'NETRADIO',
'40': 'SIRIUSXM',
'41': 'PANDORA',
'44': 'MEDIA SERVER',
'45': 'FAVORITE',
'48': 'MHL',
'49': 'GAME',
'57': 'SPOTIFY',
};

export default function PioneerAvrOut(RED) {
Expand Down

0 comments on commit dab143f

Please sign in to comment.