sinricpro / esp8266-esp32-sdk

Library for https://sinric.pro - simple way to connect your device to Alexa, Google Home, SmartThings and cloud
https://sinric.pro
Other
231 stars 124 forks source link

SinricPro TV Example #23

Closed soufianechekroud closed 4 years ago

soufianechekroud commented 4 years ago

Hi sinric developers! I want de tell you thank you for your job, it's a magic. I'am a sinric user and i want to switch to the pro version, so is it possible to use "TV/AC examples" to send IR codes using ESP, and how can i modify the sketch to send IR code to each commande if it is possible. Thank's

sivar2311 commented 4 years ago

Sure it is possible. Just include the IR-Library you favour and change the onChangeChannel / onChangeChannelNumber callback to send the IR codes your TV needs.

soufianechekroud commented 4 years ago

Thank's for your fast reply, can you give me a simple example

sivar2311 commented 4 years ago

Which IR module and IR library do you use?

soufianechekroud commented 4 years ago

I used ESP32/ESP8266 with IR Emmiter with Kakopappa TV example. Libraires : "IRremoteESP8266" and "IRsend". now i try yhe "TV code" for SinricPro, it's work in serial monitor fine but i want to send ir codes in each commande.

sivar2311 commented 4 years ago

Ok, so show me the code you use to send IR code to switch to a specific channel. Alexa supports switching channels by using a channel name like "NBC" or by a number.

soufianechekroud commented 4 years ago

In my case i dont need channel names or numbers, i need only to switch channel up or down ! using your code example and IR codes like that " TV_POWER_H = 0xF10EF6; "

Your example

thanks

sivar2311 commented 4 years ago

You dont have to send me my own example back here ;) Okay, so you only want to switch UP and DOWN. Then you only have to use the onSkipChannelscallback. The parameter channelCount will be -1 when you want to switch "down" and +1 if you want to switch "UP".

Edit1--- If channelCount = -1, send your "down IR command" If channelCount = +1, send your "up IR command" ---Edit1

Just try to set channelNameto "" and channelCount to 0. Alexa awaits a real channel name and the channel number here...

Edit2: You can also use the onChannelNumber callback. You only have to translate the given channel number into a series of IR commands, corresponding to the number IR codes on your remote control. And i think you have to send an "OK" IR command or something like that that will do the final switch on your TV. This will enable you to say "Alexa, switch TV to channel 21"... then in your sketch the onChangeChannelNumber gets called with parameter channelNumber = 21. Your Sketch have to send IR commands for "2", "1", "OK" then

sivar2311 commented 4 years ago

Can you please provide a "small" codesnippet how you would send an "UP" or "DOWN" or even a number IR-Command?

sivar2311 commented 4 years ago

Closed because requested information was not delivered

Joshthynne commented 3 years ago

I am currently working on a tutorial to do exactly this, i shall upload it in a couple of weeks. https://www.youtube.com/channel/UCQlMVtTTtNYMCdhDZO5dGuw