Open Haxhi03 opened 4 years ago
Have you tried the TV example sketch for Sinric Pro? You should be able to copy the code from existing sketch into this and get it to work without any issues
https://github.com/sinricpro/esp8266-esp32-sdk/blob/master/examples/TV/TV.ino
On Sat, 30 May 2020 at 4:11 PM Haxhi03 notifications@github.com wrote:
Anyone knows how to add IR signals to TV sketch in Sinric Pro. I tried with sinric and it works, but I have my temperature sensor in Sinric Pro so I wanted to use the Temp sensor and the TV in Sinric Pro.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/422, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZAZZT3ZRLFGFKN4OMRVU3RUDETPANCNFSM4NOTS4WA .
i use the tv example of sinric pro and i want to add the ir signals
You have to implent the IR function in all necessary callback functions (onPowerState, onSkipChannel etc etc...). This highly depends to your TV model (what IR codes are necessary) and which IR library you are using.
Do you have a working example for sending IR commands to your TV (independent to SinricPro) ?
on sinric it works but i want to transfer the ir signals to sinric prp
Sending IR signals is independent to the used Sinric version. Do you have a specific question? Maybe you can show your code and comment the lines where you have problems.
i use the example code for tv of sinric pro and i wanted to put ir signals to that code, but i don't know how to do that
First of all you need to know how to send IR codes and what codes you TV needs. The Arduino-IRemote library might be the place to start about sending IR-Codes.
Then put your code into each callback function right after the Serial.printf
.
Example:
bool onMute(const String &deviceId, bool &mute) {
Serial.printf("TV volume is %s\r\n", mute?"muted":"unmuted");
// Put your ir-send code for mute / unmute (dependent to the mute variable) here
tvMuted = mute; // set tvMuted state
return true;
}
ok but for channels an for volume?
#include <ESP8266WiFi.h>
#include <WiFi.h>
IRsend irsend(IR_LED);
uint16_t TV_POWER_H[68] = {4500,4450,550,1700,550,1650,600,1650,550,550,550,550,550,550,550,550,550,600,550,1650,550,1700,550,1650,550,550,550,550,550,600,550,550,550,550,600,500,550,1700,550,550,550,550,550,550,550,600,550,550,550,550,600,1600,600,550,550,1650,550,1700,550,1650,550,1650,600,1650,550,1650,600,}; uint16_t TV_INPUT_H[68] = {4500,4450,550,1700,500,1700,550,1650,550,600,550,550,550,550,550,550,550,600,500,1700,550,1700,500,1700,550,550,550,600,500,600,500,600,550,550,550,1700,500,600,550,550,500,600,550,550,550,600,500,600,550,550,550,550,550,1700,550,1650,550,1700,500,1700,550,1650,550,1700,550,1650,550,}; uint16_t TV_VOLUP_H[68] = {4500,4450,550,1650,550,1700,550,1650,550,550,550,600,550,550,550,550,550,550,550,1700,550,1650,550,1700,500,600,550,550,550,550,550,600,500,600,550,1650,550,1700,500,1700,550,550,550,600,500,600,550,550,550,550,550,550,550,600,500,600,550,1650,550,1700,550,1650,550,1700,550,1650,550,}; uint16_t TV_VOLDOWN_H[68] = {4500,4450,550,1700,500,1700,550,1650,550,600,550,550,500,600,550,550,550,600,500,1700,550,1700,500,1700,550,550,550,550,550,600,500,600,550,550,550,1650,550,1700,550,550,550,1700,500,600,550,550,550,550,550,550,550,600,550,550,550,1650,550,600,500,1700,550,1700,500,1700,550,1650,550,}; uint16_t TV_OK_H[68] = {4500,4450,550,1700,550,1650,550,1700,550,550,550,550,550,550,550,600,550,550,550,1650,550,1700,550,1650,550,600,500,600,550,550,550,600,500,600,550,550,550,550,550,550,550,1650,550,600,550,1650,550,1650,600,550,550,1650,600,1650,550,1650,600,550,550,1650,550,550,550,600,550,1650,550,}; uint16_t TV_MUTE_H[68] = {4500,4450,550,1650,550,1700,550,1650,550,600,550,550,550,550,550,600,500,600,500,1700,550,1650,550,1700,550,550,550,600,500,550,550,600,550,550,550,1650,600,1650,550,1650,550,1700,550,550,550,600,500,600,550,550,550,550,550,550,550,600,500,600,550,1650,550,1650,600,1650,550,1650,550,}; uint16_t TV_UP_H[68] = {4500,4450,550,1650,600,1650,550,1650,600,550,550,550,550,550,550,550,550,600,550,1650,550,1650,600,1600,600,550,550,550,550,600,550,550,550,550,550,550,550,1650,550,600,550,550,550,1650,600,550,550,550,550,550,550,1650,600,550,550,1650,550,1650,600,550,550,1650,600,1600,600,1650,550,}; uint16_t TV_DOWN_H[68] = {4500,4450,550,1650,600,1650,550,1650,550,600,550,550,550,550,550,550,550,600,550,1650,550,1650,550,1700,550,550,550,550,550,600,550,550,550,550,550,550,550,550,550,600,550,550,550,1650,550,600,550,550,550,550,550,1650,600,1650,550,1650,550,1700,550,550,550,1650,600,1650,550,1650,550,}; uint16_t TV_1[68] = {4500,4450,550,1700,550,1650,550,1650,550,600,550,550,550,550,550,550,550,600,550,1650,550,1650,550,1700,550,550,550,550,550,600,550,550,550,550,550,550,600,500,550,1700,550,550,550,550,550,600,550,550,550,550,550,1650,550,1700,550,550,550,1700,550,1650,550,1650,600,1650,550,1650,550,}; uint16_t TV_2[68] = {4450,4500,550,1700,500,1700,500,1700,550,550,550,600,500,600,500,600,550,550,550,1700,500,1700,500,1700,550,600,550,550,500,600,550,550,550,600,500,1700,550,600,500,1700,550,550,550,550,550,550,550,600,500,600,550,550,550,1700,500,600,500,1750,500,1700,500,1700,550,1700,500,1700,550,}; uint16_t TV_3[68] = {4450,4450,550,1700,550,1700,500,1700,550,550,550,550,550,600,500,600,500,600,550,1650,550,1700,550,1650,550,550,550,600,550,550,550,550,550,550,550,600,500,1700,550,1650,550,600,550,550,550,550,550,550,550,600,500,1700,500,600,550,550,550,1700,550,1650,550,1700,550,1650,550,1700,550,}; uint16_t TV_4[68] = {4450,4500,500,1700,550,1700,500,1700,550,550,550,600,500,600,500,600,500,600,550,1700,500,1700,550,1700,500,600,500,600,500,600,550,600,500,600,500,600,500,600,550,600,500,1700,500,600,500,600,550,600,450,600,550,1700,550,1700,550,1650,550,550,550,1700,500,1700,550,1700,500,1700,500,}; uint16_t TV_5[68] = {4450,4500,550,1650,550,1700,500,1700,500,600,550,550,550,550,550,600,500,600,550,1700,500,1700,500,1750,500,600,500,600,500,600,550,550,550,600,500,1700,550,550,550,550,550,1700,500,600,550,550,550,600,500,600,500,600,500,1750,500,1700,500,600,550,1700,500,1700,550,1650,550,1700,500,}; uint16_t TV_6[68] = {4450,4500,500,1700,500,1750,500,1700,500,600,550,600,500,600,500,600,500,600,500,1750,500,1700,500,1750,500,600,500,600,500,600,500,600,550,600,500,600,500,1700,550,550,550,1700,500,600,500,600,550,600,500,550,550,1700,550,600,500,1700,500,600,500,1750,500,1700,500,1700,550,1700,500,}; uint16_t TV_7[68] = {4450,4500,550,1650,550,1700,550,1650,550,550,550,600,550,550,550,550,550,550,550,1700,550,1650,550,1700,500,600,550,550,550,550,550,600,500,600,550,550,550,550,550,1700,500,1700,550,550,550,550,550,600,550,550,550,1650,550,1700,550,550,550,550,550,1700,550,1650,550,1700,500,1700,550,}; uint16_t TV_8[68] = {4450,4500,550,1700,500,1700,500,1750,500,600,500,600,500,600,500,600,500,650,500,1750,450,1700,550,1700,500,600,550,550,550,600,500,600,550,550,500,1750,500,600,550,1650,550,1700,450,650,500,600,550,550,550,550,550,600,500,1700,500,600,550,600,500,1700,500,1700,550,1700,550,1650,550,}; uint16_t TV_9[68] = {4450,4500,550,1700,500,1700,550,1700,500,600,500,600,500,600,550,600,500,600,500,1700,500,1750,500,1700,550,550,550,600,500,600,500,600,550,550,550,550,550,1700,550,1650,550,1700,500,600,500,600,550,600,450,650,500,1750,500,600,500,600,450,650,500,1700,550,1700,500,1700,550,1700,500,}; uint16_t TV_0[68] = {4450,4500,500,1700,500,1750,500,1700,550,600,500,600,500,600,500,600,550,550,550,1700,500,1700,550,1700,500,600,500,600,550,550,550,600,500,600,500,1700,550,550,550,600,500,600,500,1700,550,600,500,600,500,600,500,600,500,1750,500,1700,500,1750,500,600,500,1700,550,1700,500,1700,500,};
bool tvPowerState; unsigned int tvVolume; unsigned int tvChannel; bool tvMuted;
// channelNames used to convert channelNumber into channelName // please put in your TV channel names // channel numbers starts counting from 0! // so "ZDF" is channel 2 const char* channelNames[] = { "A/V", "Rai 1", "Rai 2", "Rai 3", "Rete 4", "Canali 5", "Italia 1", "La 7", "8", "9", };
// map channelNumbers used to convert channelName into channelNumber // This map is initialized in "setupChannelNumbers()" function by using the "channelNames" array std::map<String, unsigned int> channelNumbers;
void setupChannelNumbers() { for (unsigned int i=0; i < MAX_CHANNELS; i++) { channelNumbers[channelNames[i]] = i; } }
// TV device callbacks
bool onAdjustVolume(const String &deviceId, int &volumeDelta) { tvVolume += volumeDelta; // calcualte new absolute volume Serial.printf("Volume changed about %i to %i\r\n", volumeDelta, tvVolume); volumeDelta = tvVolume; // return new absolute volume return true; }
bool onChangeChannel(const String &deviceId, String &channel) { tvChannel = channelNumbers[channel]; // save new channelNumber in tvChannel variable Serial.printf("Change channel to \"%s\" (channel number %d)\r\n", channel.c_str(), tvChannel); return true; }
bool onChangeChannelNumber(const String& deviceId, int channelNumber, String& channelName) { tvChannel = channelNumber; // update tvChannel to new channel number if (tvChannel < 0) tvChannel = 0; if (tvChannel > MAX_CHANNELS-1) tvChannel = MAX_CHANNELS-1;
channelName = channelNames[tvChannel]; // return the channelName
Serial.printf("Change to channel to %d (channel name \"%s\")\r\n", tvChannel, channelName.c_str()); return true; }
bool onMediaControl(const String &deviceId, String &control) { Serial.printf("MediaControl: %s\r\n", control.c_str()); if (control == "Play") {} // do whatever you want to do here if (control == "Pause") {} // do whatever you want to do here if (control == "Stop") {} // do whatever you want to do here if (control == "StartOver") {} // do whatever you want to do here if (control == "Previous") {} // do whatever you want to do here if (control == "Next") {} // do whatever you want to do here if (control == "Rewind") {} // do whatever you want to do here if (control == "FastForward") {} // do whatever you want to do here return true; }
bool onMute(const String &deviceId, bool &mute) { Serial.printf("TV volume is %s\r\n", mute?"muted":"unmuted"); irsend.sendRaw(TV_MUTE_H, 68, 38); tvMuted = mute; // set tvMuted state return true; }
bool onPowerState(const String &deviceId, bool &state) { Serial.printf("TV turned %s\r\n", state?"on":"off"); irsend.sendRaw(TV_POWER_H, 68, 38); tvPowerState = state; // set powerState return true; }
bool onSelectInput(const String &deviceId, String &input) { Serial.printf("Input changed to %s\r\n", input.c_str()); return true; }
bool onSetVolume(const String &deviceId, int &volume) { Serial.printf("Volume set to: %i\r\n", volume); if tvVolume < volume tvVolume = volume; // update tvVolume return true; }
bool onSkipChannels(const String &deviceId, const int channelCount, String &channelName) { tvChannel += channelCount; // calculate new channel number if (tvChannel < 0) tvChannel = 0; if (tvChannel > MAX_CHANNELS-1) tvChannel = MAX_CHANNELS-1; channelName = String(channelNames[tvChannel]); // return channel name
Serial.printf("Skip channel: %i (number: %i / name: \"%s\")\r\n", channelCount, tvChannel, channelName.c_str());
return true; }
// setup function for WiFi connection void setupWiFi() { Serial.printf("\r\n[Wifi]: Connecting"); WiFi.begin(WIFI_SSID, WIFI_PASS);
while (WiFi.status() != WL_CONNECTED) { Serial.printf("."); delay(250); } IPAddress localIP = WiFi.localIP(); Serial.printf("connected!\r\n[WiFi]: IP-Address is %d.%d.%d.%d\r\n", localIP[0], localIP[1], localIP[2], localIP[3]); }
// setup function for SinricPro void setupSinricPro() { // add device to SinricPro SinricProTV& myTV = SinricPro[TV_ID];
// set callback functions to device myTV.onAdjustVolume(onAdjustVolume); myTV.onChangeChannel(onChangeChannel); myTV.onChangeChannelNumber(onChangeChannelNumber); myTV.onMediaControl(onMediaControl); myTV.onMute(onMute); myTV.onPowerState(onPowerState); myTV.onSelectInput(onSelectInput); myTV.onSetVolume(onSetVolume); myTV.onSkipChannels(onSkipChannels);
// setup SinricPro SinricPro.onConnected([](){ Serial.printf("Connected to SinricPro\r\n"); }); SinricPro.onDisconnected([](){ Serial.printf("Disconnected from SinricPro\r\n"); }); SinricPro.begin(APP_KEY, APP_SECRET); }
// main setup function void setup() { Serial.begin(BAUD_RATE); irsend.begin(); Serial.printf("\r\n\r\n"); Serial.printf("%d channels configured\r\n", MAX_CHANNELS);
setupWiFi(); setupSinricPro(); setupChannelNumbers(); }
void loop() { SinricPro.handle(); }
ok but for channels an for volume?
Please check the documention. For channels use
For volume use
i already red it but i didn't find how to add the signals
Ok, but now everything is clear?
no
cause i don't know how to add ir signals to volume and channel
What do you mean by "add ir signals" ?
There are a lot of ir-codes defined in your sketch!
For example switch to channel number 23 the onChangeChannelNumber
callback gets called with 23 as channel parameter. So you have to send the IR-codes for 2
, 3
and OK
ok thank you
i solved for channel, but the bool setVolume i can't set it.
Ok, what's exact the problem with volume?
the problem is tha if i say Alexa set television volume to 20, the volume raised to 100
What does the serial monitor print if you set the volume to 20%? If it prints 20%, the problem is outside of sinric pro.
it's outside of sinric pro can you help me if i post the code ?
Because it depends very much on the TV, I think you just have to try it yourself.
You have to find the correct IR code(s) some TVs use the same IR code to increase / decrease
On Sat, 6 Jun 2020 at 9:16 PM Haxhi03 notifications@github.com wrote:
it's outside of sinric pro can you help me if i post the code ?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/422#issuecomment-640067768, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZAZZR3HV2JSY5UC4OK5OTRVJFUJANCNFSM4NOTS4WA .
I was able to TV IR example in sinric. However, I am unable to use Sinric Pro. For simplicity purpose, I started with Temperature sensor in Sinric Pro. But it shows errors related websocket libraries. I am using same libraries which are suggested in documentation. Kindly help
To be able to help you we need more information! Please provide us at least the error log and information about
Since it is related to SinricPro, please open a new issue in the SinricPro repository and provide the above information there.
@laxmru @sivar2311 Websocket 2.1.4 seems not compatible anymore with ESP32 latest core. Updating to 2.2.0 seems to fix the compiling errors
To be able to help you we need more information! Please provide us at least the error log and information about
- the version of the installed webSocket library
- the platform (ESP8266 / ESP32)?
- the IDE used
- the Espressif SDK version used
- the used Arduino Core version
Since it is related to SinricPro, please open a new issue in the SinricPro repository and provide the above information there.
I have solved this problem using Nodemcu V1 board. Earlier I was using Arduino UNO with ESP8266 module. The new problem which am facing is the temperature value gets updated at the time of uploading sketch. For example, I get 31 ° as soon as I upload the sketch and then it doesn't change. It doesn't refresh after that. If I restart the Nodemcu it changes to 1 °. The error message I get in serial monito is "DHT reading failed"
the problem is tha if i say Alexa set television volume to 20, the volume raised to 100
It could be because it has maximum 20 levels of volume.
You need to map the percentage volume level (0..100) to real volume levels (0..20). Use the arduino map function for this.
Anyone knows how to add IR signals to TV sketch in Sinric Pro. I tried with sinric and it works, but I have my temperature sensor in Sinric Pro so I wanted to use the Temp sensor and the TV in Sinric Pro.
have you managed to add ir signal to sketch sinricpro.
does anyone has Sinric pro TV sketch with ir codes . i have working sketch for sinric but i want to upgrade to Sinric pro. please can someone help.
I am currently working on a youtube tutorial for exactly this. Planning on dropping it in a couple of weeks. https://www.youtube.com/channel/UCQlMVtTTtNYMCdhDZO5dGuw
Thanks boss
On Wed, Feb 3, 2021, 12:52 AM Joshthynne notifications@github.com wrote:
I am currently working on a youtube tutorial for exactly this. Planning on dropping it in a couple of weeks. https://www.youtube.com/channel/UCQlMVtTTtNYMCdhDZO5dGuw
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kakopappa/sinric/issues/422#issuecomment-771910078, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMFWMHLLXOF2TNENTIU5ERDS5BGITANCNFSM4NOTS4WA .
A good, easy to follow tutorial for combining all of your IR remotes into one simple board, which integrates into Alexa via SinricPro. https://youtu.be/nh5adggIJYo
Anyone knows how to add IR signals to TV sketch in Sinric Pro. I tried with sinric and it works, but I have my temperature sensor in Sinric Pro so I wanted to use the Temp sensor and the TV in Sinric Pro.