done
UNIXSOCK=/var/run/powersensordaemon/cmd.sock
-VALID_ONOFF_IDS="decke lichter all werkzeug labor dart logo idee deckehinten deckevorne"
-VALID_SEND_IDS="stereo ymhvolup ymhvoldown ymhcd ymhwdtv ymhtuner"
+VALID_ONOFF_IDS="decke ambientlights lichter all werkzeug labor dart logo idee deckehinten deckevorne"
+VALID_SEND_IDS="ymhpoweron ymhpoweroff ymhvolup ymhvoldown ymhcd ymhwdtv ymhtuner ymhvolmute ymhmenu ymhplus ymhminus ymhtest ymhtimelevel ymheffect ymhprgup ymhprgdown ymhtunplus ymhtunabcde ymhtape ymhvcr ymhextdec"
[ "$POWER" == "send" ] && POWER=on
DESC_werkzeug="Werkzeug LEDs"
DESC_stereo="Reciever On/Off"
+DESC_ambientlights="Ambient Lichter"
DESC_labor="Labor Licht"
DESC_dart="Dart Scheibe"
DESC_logo="Logo"
DESC_decke="Deckenlichter"
DESC_lichter="Alle Lichter"
DESC_all="Alles"
+DESC_ymhpoweron="Reciever On"
+DESC_ymhpoweroff="Reciever Off"
DESC_ymhvolup="VolumeUp"
DESC_ymhvoldown="VolumeDown"
DESC_ymhcd="Input CD"
DESC_ymhwdtv="Input WDlxTV"
DESC_ymhtuner="Input Tuner"
-
+DESC_ymhvolmute="Mute"
+DESC_ymhmenu="Menu"
+DESC_ymhplus="+"
+DESC_ymhminus="-"
+DESC_ymhtest="Test"
+DESC_ymhtimelevel="Time/Levels"
+DESC_ymheffect="DSP Effect Toggle"
+DESC_ymhprgup="DSP Up"
+DESC_ymhprgdown="DSP Down"
+DESC_ymhtunplus="Tuner +"
+DESC_ymhtunabcde="Tuner ABCDE"
+DESC_ymhtape="Tape"
+DESC_ymhvcr="VCR"
+DESC_ymhextdec="ExtDec Toggle"
echo "Content-type: text/html"
echo ""
echo "<html>"
//********************************************************************//
// IR Codes, 32 bit, NEC
const int YAMAHA_CODE_BITS = 32;
-const char YAMAHA_CODE_BASE = 0x000000005EA10000;
+const unsigned long int YAMAHA_CODE_BASE = 0x0000000005EA10000;
const char YAMAHA_POWER_TOGGLE =0xF8; //Power On/Off
const char YAMAHA_POWER_OFF =0x78; //Power Off !!!
const char YAMAHA_DVD_SPDIF =0xE8; //Input Toggle DVD Auto / DVD Analog
const char YAMAHA_SAT_SPDIFF =0x2A; //Input Toggle Sat-DTV Auto / Sat-DTV Analog
const char YAMAHA_AUX =0xAA; //Input AUX (mode)
-const char YAMAHA_VCR_1 =0xF0; //Input VCR
+const char YAMAHA_VCR =0xF0; //Input VCR
const char YAMAHA_EXT51DEC =0xE1; //Input Ext. Decoder On/Off
const char YAMAHA_TUNER_PLUS =0x08; //Tuner Next Station 1-7 (of A1 - E7)
const char YAMAHA_PLUS =0x4A; //unteres Steuerkreuz: Taste Rechts (Plus)
const char YAMAHA_MINUS =0xCA; //unteres Steuerkreuz: Taste Links (Minus)
const char YAMAHA_MENU =0x39; // Menu: Settings
-const char YAMAHA_TEST =0xA1 // Test Sounds
+const char YAMAHA_TEST =0xA1; // Test Sounds
const char YAMAHA_TIME_LEVEL =0x19; //Settings for Delay, Subwfs, Right Surround, Left Surround, Center
const char YAMAHA_TIME_LEVEL2 =0x61; //(also) Settings for Delay, Subwfs, Right Surround, Left Surround, Center
const char YAMAHA_TIME_LEVEL3 =0x99; //(also) Settings for Delay, Subwfs, Right Surround, Left Surround, Center
const char YAMAHA_P5 =0xFB; //P5 PRT (1 Main Bypass)? (1587674115)
-void send_std_nec_ir_signal(char codebyte)
+void send_yamaha_ir_signal(char codebyte)
{
unsigned long int code = codebyte & 0xFF;
code <<= 8;
sensorEchoCommand(command);
printLightLevel();
}
+ else if (command == '0')
+ send_yamaha_ir_signal(YAMAHA_POWER_OFF);
else if (command == '1')
- {
- irsend.sendNEC(YAMAHA_POWER,YAMAHA_CODE_BITS);
- Serial.println("Ok");
- }
+ send_yamaha_ir_signal(YAMAHA_POWER_TOGGLE);
else if (command == '2')
- {
- irsend.sendNEC(YAMAHA_CD,YAMAHA_CODE_BITS);
- Serial.println("Ok");
- }
+ send_yamaha_ir_signal(YAMAHA_VOLUME_UP);
else if (command == '3')
- {
- irsend.sendNEC(YAMAHA_DVD_SPDIF,YAMAHA_CODE_BITS);
- Serial.println("Ok");
- }
+ send_yamaha_ir_signal(YAMAHA_VOLUME_DOWN);
else if (command == '4')
- {
- irsend.sendNEC(YAMAHA_TUNER,YAMAHA_CODE_BITS);
- Serial.println("Ok");
- }
+ send_yamaha_ir_signal(YAMAHA_MUTE);
else if (command == '5')
- {
- irsend.sendNEC(YAMAHA_VOLUME_UP,YAMAHA_CODE_BITS);
- Serial.println("Ok");
- }
+ send_yamaha_ir_signal(YAMAHA_CD);
else if (command == '6')
- {
- irsend.sendNEC(YAMAHA_VOLUME_DOWN,YAMAHA_CODE_BITS);
- Serial.println("Ok");
- }
+ send_yamaha_ir_signal(YAMAHA_TUNER);
else if (command == '7')
- {
- irsend.sendNEC(YAMAHA_MUTE,YAMAHA_CODE_BITS);
- Serial.println("Ok");
- }
+ send_yamaha_ir_signal(YAMAHA_DVD_SPDIF);
+ else if (command == '8')
+ send_yamaha_ir_signal(YAMAHA_MENU);
+ else if (command == '+')
+ send_yamaha_ir_signal(YAMAHA_PLUS);
+ else if (command == '-')
+ send_yamaha_ir_signal(YAMAHA_MINUS);
+ else if (command == '§')
+ send_yamaha_ir_signal(YAMAHA_TEST);
+ else if (command == '$')
+ send_yamaha_ir_signal(YAMAHA_TIME_LEVEL);
+ else if (command == '%')
+ send_yamaha_ir_signal(YAMAHA_EFFECT_TOGGLE);
+ else if (command == '&')
+ send_yamaha_ir_signal(YAMAHA_PRG_DOWN);
+ else if (command == '/')
+ send_yamaha_ir_signal(YAMAHA_PRG_UP);
+ else if (command == '(')
+ send_yamaha_ir_signal(YAMAHA_TUNER_PLUS);
+ else if (command == ')')
+ send_yamaha_ir_signal(YAMAHA_TUNER_ABCDE);
+ else if (command == '9')
+ send_yamaha_ir_signal(YAMAHA_TAPE);
+ else if (command == '?')
+ send_yamaha_ir_signal(YAMAHA_VCR);
+ else if (command == '=')
+ send_yamaha_ir_signal(YAMAHA_EXT51DEC);
else
Serial.println("Error: unknown command");
}