khoih-prog / SinricPro_Generic

Simple way to control your IOT development boards like ESP8226, ESP32, Arduino SAMD21, Adafruit SAMD21, SAMD51, nRF52, STM32, Teensy, SAM DUE with Amazon Alexa or Google Home
28 stars 7 forks source link

Integrate with Sinric Pro #1

Closed kakopappa closed 4 years ago

kakopappa commented 4 years ago

Hi there,

We noticed you have done an excellent job and we like to talk about the possibility of integrating this to Sinric Pro SDK in the future.

Thanks -Aruna

khoih-prog commented 4 years ago

Hi @kakopappa

Thanks for your nice words. I just knew about your great library last week. And I have to say I'm so impressed with your works that I had to port it to every boards I know possible to run SinricPro and Alexa.

The original works and credits are all yours. I just add a small touch to make it easier for other people to use.

Please feel free to integrate it into your Sinric Pro SDK whenever you'd like. I'm glad if you can do that.

Best Regards,

KH

kakopappa commented 4 years ago

Hi

Thank you

Can you please drop an email to support@sinric.com when you have time? I like to talk about the integration in details and joining the team if you are interested

Thanks

On Mon, 25 May 2020 at 12:58 PM Khoi Hoang notifications@github.com wrote:

Hi @kakopappa https://github.com/kakopappa

Thanks for your nice words. I just knew about your great library last week. And I have to say I'm so impressed with your works that I had to port it to every boards I know possible to run SinricPro and Alexa.

The original works and credits are all yours. I just add a small touch to make it easier for other people to use.

Please feel free to integrate it into your Sinric Pro SDK whenever you'd like. I'm glad if you can do that.

Best Regards,

KH

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/khoih-prog/SinricPro_Generic/issues/1#issuecomment-633391758, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZAZZXVCIVEXADEPJZPNJ3RTICH5ANCNFSM4NJGPB7Q .

khoih-prog commented 4 years ago

Thanks for your invitation.

I'm sorry I'm a retiree now, and just do these works for fun as long as I still can, without any financial interest. Therefore I won't be able to join your team.

The source code is in public domain, and your team can use that to integrate into the SDK. I certainly can give some limited help and advice whenever necessary, with the price of several more free SinricPro devices so that I can test more easily ;-) !!!

Your company being successful and providing some good services to the community are all I'm happy to see .

Best Regards,

KH

kakopappa commented 4 years ago

got it. Please send me your sinric pro email id so I can add free devices to your account.

tcpipchip commented 4 years ago

@khoih-prog

Very very happy to know that Sinric Pro company is interested in SINRIC PRO libs!!!!!

Very very nice news in a few days :)

Btw, u-blox nina b302 working nice with PRO with ETHERNET and WIFININA. WIZNET already in BRAZIL.

tcpipchip commented 4 years ago

@kakopappa

https://loja.smartcore.com.br/pagina/blog-faq-familia-nina-u-blox-wifi-ble.html

Look at end of BLOGS list :)

khoih-prog commented 4 years ago

Hello Khoi, I just wanted to let you know that I have added 10 free devices to your account for testing. Let me know if you have any issues or suggestions to improve our service. We looked at your repo and came to the conclusion that we are lacking the expertise on how to integrate this to the master branch. We are familiar with ESP8266 and ESP32 boards but not the other board type. If you could give us step by step instructions or send a pull request we appreciate it. I understand you are retiree now, and just do these for fun. Our team also doing this in their spare time without any financial interest. Thank you for your help. -Aruna

Hi Aruna,

I'll try the best to guide you into the process of testing and merging the code, although my time to spend here is limited.

Option 1

Hereafter are my suggestions of the steps you'd take

A) Clone to a local library. Follow instructions to install board packages' patches as well as libraries' patches.

The newly supported boards are more complicated to use than ESP, as they rely on many other new or separate libraries, which are not provided along with the board packages as ESP boards do.

This is the harder work, but will pay off as the number of users will be much bigger, using many more types of boards and networks.

B) Then have some people test to verify everything is working: compile, upload, function / feature tests. The tests will be done on many boards as possible (even I've tried here on many boards / shields already).

These are the boards @tcpipchip and I have tested to verify they're working with SinricPro

  1. nRF52 using W5100, W5500, ENC28J60 and WiFiNINA
  2. Arduino Nano 33 IoT (SAMD21 with WiFiNINA)
  3. Adafruit SAMD21/SAMD51 boards with W5x00, ENC28J60 Ethernet
  4. Arduino SAM DUE board with W5x00, ENC28J60 Ethernet.

The other supported boards (STM32, Teensy, etc) are verified by compiling only. But the underlying libraries are solid and we didn't think creating any issue.

But as a rule, your team has to verify using many boards and examples as possible.

C) If everything is tested and OK, you can just use the new library (or SDK) as is to replace the previous ESP SDK because the SinricPro_Generic library also supports ESP as well.

D) You can also create a new repo (eg. SinricPro_New SDK ), the make Pull-Request yourself the verified portion of the SinricPro_Generic library

Simpler option

Certainly you can keep it simple for users as follows:

  1. Keep the same ESP SDK
  2. Use the new SinricPro_Generic library as another SDK for more advanced users who use different boards than ESP and are willing to do extra steps.
tcpipchip commented 4 years ago

NINA B302 still working with ENC28J60 and WIFININA

Waiting for WIZNET board

tcpipchip commented 4 years ago

Khoi,

Hi

Got the WIZNET

Some links broken! i Cant test

my model is w5100

For example in the https://github.com/khoih-prog/EthernetWebServer

To fix EthernetLarge library, just copy these following files into the EthernetLarge library directory to overwrite the old files: Ethernet.h Ethernet.cpp EthernetServer.cpp w5100.h w5100.cpp

Those are broken

tcpipchip commented 4 years ago

Found...but links brokens

tcpipchip commented 4 years ago

Still not success with W5100 + NINA B302 Can you send the INO configurated to WIZNET W5100 ? And wich LIBS must i have to update ? Thanks!!!

khoih-prog commented 4 years ago

Got the WIZNET Some links broken! i Cant test

Just fixed.

tcpipchip commented 4 years ago

@khoih-prog when have time, help me with those question. WIZNET mounted! Thanks!

khoih-prog commented 4 years ago

These are some of the additional test results we've done so far

  1. nRF52 (NRF52840_ITSYBITSY) with ENC28J60 using nRF52_Ethernet_Switch
Starting nRF52_Ethernet_Switch on NRF52840_ITSYBITSY
[SINRIC_PRO] =========================
[SINRIC_PRO] Default SPI pinout:
[SINRIC_PRO] MOSI: 24
[SINRIC_PRO] MISO: 23
[SINRIC_PRO] SCK: 25
[SINRIC_PRO] SS: 5
[SINRIC_PRO] =========================
[SINRIC_PRO] Use default CS/SS pin :  10
Index = 0
ENC28J60_CONTROL_CS =10
SS =5
SPI_MOSI =24
SPI_MISO =23
SPI_SCK =25
IP-Address is 192.168.2.83
Connected to SinricPro
Device **** turned on (via SinricPro)
Device **** turn off (via SinricPro)
  1. SAMD21 NANO_33_IOT with WiFiNINA using sketch SAMD_WiFiNINA_MultiSwitch_beginner
Starting SAMD_WiFiNINA_MultiSwitch_beginner on SAMD NANO_33_IOT

[Wifi]: Connecting
WiFi-begin: return1 = 3
WiFi-begin: return2 = 3

[WiFi]: IP-Address is 192.168.2.46
Connected to SinricPro
Device 2 turned on
Device 3 turned on
Device 4 turned on
Device 1 turned on
Device 2 turned off
Device 1 turned off
Device 3 turned off
Device 4 turned off
  1. SAMD21 NANO_33_IOT with WiFiNINA using sketch SAMD_WiFiNINA_TV
Starting SAMD_WiFiNINA_TV on SAMD NANO_33_IOT
12 channels configured

[Wifi]: Connecting
WiFi-begin: return1 = 3
WiFi-begin: return2 = 3

[WiFi]: IP-Address is 192.168.2.46
Connected to SinricPro
TV turned off
TV turned on
Volume set to:  50
TV volume is unmuted
TV volume is muted
TV turned on
Volume set to:  65
TV turned on
MediaControl: play
MediaControl: pause
TV turned off
TV turned on
TV turned on
TV volume is unmuted
TV turned off
  1. SAMD21 NANO_33_IOT with WiFiNINA using sketch SAMD_WiFiNINA_Light
Starting SAMD_WiFiNINA_Light on SAMD NANO_33_IOT
Setup color temperature lookup table
colorTemperatureIndex[2200] = 0
colorTemperatureIndex[2700] = 1
colorTemperatureIndex[4000] = 2
colorTemperatureIndex[5500] = 3
colorTemperatureIndex[7000] = 4

[Wifi]: ConnectingWiFi-begin: return1 = 3
WiFi-begin: return2 = 3
[WiFi]: IP-Address is 192.168.2.46
Connected to SinricPro
Device **** turned on (via SinricPro)
Device **** turn off (via SinricPro)
Device **** brightness level changed to 70
Device **** brightness level changed to 25
Device **** color changed to 160, 112, 112(RGB)
Device **** color changed to 218, 23, 23(RGB)
Device **** color changed to 236, 214, 214(RGB)
Device **** turn off (via SinricPro)
Device **** turned on (via SinricPro)
Device**** brightness level changed to 65
  1. nRF52 (NINA_B302_ublox) with ENC28J60 using nRF52_Ethernet_Switch
Starting nRF52_Ethernet_Switch on NINA_B302_ublox
[SINRIC_PRO] =========================
[SINRIC_PRO] Default SPI pinout:
[SINRIC_PRO] MOSI: 25
[SINRIC_PRO] MISO: 24
[SINRIC_PRO] SCK: 26
[SINRIC_PRO] SS: 4
[SINRIC_PRO] =========================
[SINRIC_PRO] Use default CS/SS pin : 10
Index = 1
ENC28J60_CONTROL_CS =0
SS =4
SPI_MOSI =25
SPI_MISO =24
SPI_SCK =26
Connected!
[Ethernet]: IP-Address is 192.168.100.45
Connected to SinricPro
khoih-prog commented 4 years ago
  1. SAMD51 ADAFRUIT_ITSYBITSY_M4_EXPRESS with W5500 Ethernet using sketch SAMD_Ethernet_TV

Starting SAMD_Ethernet_TV on ADAFRUIT_ITSYBITSY_M4_EXPRESS
12 channels configured
Index = 7
_pinCS = 0
W5100 init, using SS_PIN_DEFAULT = 10, new ss_pin = 10, W5100Class::ss_pin = 10
W5100::init: W5500, SSIZE =4096
Connected!
[Ethernet]: IP-Address is 192.168.2.79
Connected to SinricPro
TV turned on
TV turned off
TV turned on
TV turned off
TV turned on
Volume set to:  65
TV volume is muted
TV volume is unmuted
TV turned off
TV turned on
TV turned off
TV turned on
TV turned off
TV turned on
TV volume is muted
Skip channel: 1 (number: 1 / name: "CTV"
TV volume is unmuted
TV volume is muted
Volume set to:  36
Skip channel: -1 (number: 0 / name: "A/V"
Volume set to:  59
  1. SAM DUE with W5100 Ethernet using sketch Generic_Ethernet_TV
Starting Generic_Ethernet_TV
12 channels configured
Index = 18
_pinCS = 0
W5100 init, using SS_PIN_DEFAULT = 10, new ss_pin = 10, W5100Class::ss_pin = 10
W5100::init: W5100, SSIZE =4096
Connected!
[Ethernet]: IP-Address is 192.168.2.81
Connected to SinricPro
TV turned on
TV turned off
Volume set to:  80
Volume set to:  15
TV volume is muted
TV volume is unmuted
MediaControl: play
MediaControl: pause
TV turned off
tcpipchip commented 4 years ago
[SINRIC_PRO] SS: 5
[SINRIC_PRO] =========================
[SINRIC_PRO] Use default CS/SS pin :  10
Index = 0
ENC28J60_CONTROL_CS =10

Not clear to me! Which is the pin that controls the W5100, 10 or 5 ?

which is the difference between CS and SS ?

tcpipchip commented 4 years ago

testing the webserver

Starting AdvancedServer on NINA_B302_ublox
[ETHERNET_WEBSERVER] =========== USE_ETHERNET ===========
[ETHERNET_WEBSERVER] Default SPI pinout:
[ETHERNET_WEBSERVER] MOSI: 25
[ETHERNET_WEBSERVER] MISO: 24
[ETHERNET_WEBSERVER] SCK: 26
[ETHERNET_WEBSERVER] SS: 4
[ETHERNET_WEBSERVER] =========================
[ETHERNET_WEBSERVER] Unknown board setCsPin: 10
_pinCS = 0
W5100 init, using SS_PIN_DEFAULT = 10, new ss_pin = 10, W5100Class::ss_pin = 10
no chip :-(
=========================
Currently Used SPI pinout:
MOSI:25
MISO:24
SCK:26
SS:4
=========================
Using mac index = 13
Connected! IP address: 0.0.0.0
HTTP EthernetWebServer is @ IP : 255.255.255.255
.......... .......... .......... .......... 

Which pin is really controlling the CS of W5100 ? Not yet clear!

khoih-prog commented 4 years ago

Hi @kakopappa

Did you decide on which option to go? Do you need anything to integrate, just tell.

I still prefer the easy option, and just some small modifications and upload, you can have everything ready. I think I can help you to handle this easier way.

kakopappa commented 4 years ago

@khoih-prog

Yes, I spoke with Boris and we decided to go with the "Simpler option". We will link your repo from the readme and credit your work.

Our only concern is maintaining two repositories as we go on and how to keep these up to date.

khoih-prog commented 4 years ago

@kakopappa , @sivar2311

Hi Boris, So nice to know you and your great impressive work. I love the way you design C++ classes and document them.

Hi Aruna, Boris

I suggest you make your local repo at your SinricPro site. Boris will make PR to update ESP SDK after verifying the code still working OK on ESP. I personally tested but just to be sure nothing is broken.

From that time on, 95% of the code will be the same so that maintaining is much easier. Only some configurations / libraries- packages mods are not necessary for ESP SDK and can be kept in separate folders. etc.

Boris will then just have mods in Generic code for future versions (because that will be sure to run on ESP, just follow some basic rules).

Whenever we have a new version, just duplicate the shared code from Generic to ESP.

Regards,

PS:

Another way can be

  1. Shared codes are placed in ESP SDK
  2. Codes for Generic will link to and get basic codes from ESP SDK and add some extra codes necessary only for Generic.
khoih-prog commented 4 years ago

More tests

  1. nRF52 (NRF52840_ITSYBITSY) with ENC28J60 using nRF52_Ethernet_DimSwitch
Starting nRF52_Ethernet_DimSwitch on NRF52840_ITSYBITSY
Index = 17
ENC28J60_CONTROL_CS =10
SS =5
SPI_MOSI =24
SPI_MISO =23
SPI_SCK =25
Connected!
[Ethernet]: IP-Address is 192.168.2.83
Connected to SinricPro
Device **** power turned on
Device **** power turned off
Device **** power level level changed to 75
Device **** power turned on
Device **** power level level changed to 20
Device **** power turned off
Device **** power turned on
  1. nRF52 (NRF52840_ITSYBITSY) with ENC28J60 using nRF52_Ethernet_Lock
Starting nRF52_Ethernet_Lock on NRF52840_ITSYBITSY
Index = 11
ENC28J60_CONTROL_CS =10
SS =5
SPI_MOSI =24
SPI_MISO =23
SPI_SCK =25
Connected!
[Ethernet]: IP-Address is 192.168.2.84
Connected to SinricPro
Device **** locked
Device **** unlocked
Device **** unlocked
Device **** locked
sivar2311 commented 4 years ago

Hello khoih-prog and thanks for the nice words :) And: respect for your good work! Unfortunately I have no experience with the generic version. I am thinking about how we can implement it the easiest way. Since your version is not a fork, I can't easily see the necessary changes. It seems to me to be partly very extensive and complex. Therefore at this point again: RESPECT!

khoih-prog commented 4 years ago

Hi @sivar2311

You're so humble and make me ashamed. I just put a very small touch around your code, and keep 99.9% intact. All yours. The changes are not important, logically and systematically, just enough to satisfy the compiler. From my heart: RESPECT

Regards,

khoih-prog commented 4 years ago

Hi @kakopappa

I'm writing a PM to your email regarding my critical thoughts about your business / technical model. Hopefully it will somehow help you all. Hopefully will finish tonight and send.

khoih-prog commented 4 years ago

Hi @kakopappa , @sivar2311 , @tcpipchip

This SinricPro_Generic Library has just been included into Arduino IDE Library Manager.

Selection_415

tcpipchip commented 4 years ago

Tomorrow i will test in other nina b302 that i got!

Enviado do meu iPhone

Em 31 de mai de 2020, às 18:59, Khoi Hoang notifications@github.com<mailto:notifications@github.com> escreveu:

Hi @kakopappahttps://github.com/kakopappa , @sivar2311https://github.com/sivar2311 , @tcpipchiphttps://github.com/tcpipchip

This SinricPro_Generic Libraryhttps://github.com/khoih-prog/SinricPro_Generic has just been included into Arduino IDE Library Manager.

[Selection_415]https://user-images.githubusercontent.com/57012152/83363563-5ff46580-a368-11ea-9c21-e52330103204.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/khoih-prog/SinricPro_Generic/issues/1#issuecomment-636536486, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACXUZTDWNGWGNB2CCKW5QSTRULHLNANCNFSM4NJGPB7Q.

khoih-prog commented 4 years ago

Hi @kakopappa , @sivar2311 , @tcpipchip

I've just published WebSockets2_Generic to enable boards such as ESP8266/ESP32, nRF52, SAMD21/SAMD51, SAM DUE, etc using WiFiNINA or W5x00 Ethernet to access SINRIC services. More supports for STM32F, Teensy boards, Ethernet ENC28J60/LAN8742A/LAN8720 and ESP8266/ESP32-AT modules/shields will be added soon.

This is terminal debug output when running SAMD-Client_SINRIC on SAMD21 Nano-33-IoT with WiFiNINA

Starting WebSockets2_Generic SAMD-Client_SINRIC on SAMD NANO_33_IOT
..Connected to Wifi, Connecting to WebSockets Server @iot.sinric.com
WebsocketsClient::generateHandshake: base64Authorization = ****
WebsocketsClient::generateHandshake: handshake = GET / HTTP/1.1
Host: iot.sinric.com
Sec-WebSocket-Key: ****
apikey: 11111111-2222-3333-4444-555555555555
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Version: 13
User-Agent: TinyWebsockets Client
Authorization: Basic ****
WebsocketsClient::connect: base64Authorization = ****
WebsocketsClient::doestStartsWith: str = HTTP/1.1 101 Switching Protocols
WebsocketsClient::doestStartsWith: prefix = HTTP/1.1 101
WebsocketsClient::parseHandshakeResponse: key = Server
WebsocketsClient::parseHandshakeResponse: value = nginx/1.10.3 (Ubuntu)
WebsocketsClient::parseHandshakeResponse: key = Date
WebsocketsClient::parseHandshakeResponse: value = Mon, 13 Jul 2020 18:54:28 GMT
WebsocketsClient::parseHandshakeResponse: key = Connection
WebsocketsClient::parseHandshakeResponse: value = upgrade
WebsocketsClient::parseHandshakeResponse: key = Upgrade
WebsocketsClient::parseHandshakeResponse: value = websocket
WebsocketsClient::parseHandshakeResponse: key = Sec-WebSocket-Accept
WebsocketsClient::parseHandshakeResponse: value = ****
Connected!
Got Message: {"deviceId":"012345678901234567890123","action":"setPowerState","value":"ON"}
Turn on device id: 012345678901234567890123
Got Message: {"deviceId":"012345678901234567890123","action":"setPowerState","value":"OFF"}
Turn off Device ID: 012345678901234567890123
kakopappa commented 4 years ago

Thank you for your hard work on this project. Much appreciated!

tcpipchip commented 4 years ago

Very nice @khoih-prog

integration going very fine!

khoih-prog commented 4 years ago

@kakopappa

WebSocket endpoint for Sinric Pro (https://sinric.pro) it should be ws.sinric.pro

I just made examples for connecting to Sinric. For SinricPro, I think it's better to use Boris Jaeger's SinricPro library or this SinricPro_Generic Library

khoih-prog commented 3 years ago

Just release v2.7.0 to sync with your SinricPro v2.7.0

kakopappa commented 3 years ago

Thank you so much for your continuous effort

On Tue, 6 Oct 2020 at 2:01 AM Khoi Hoang notifications@github.com wrote:

Just release v2.7.0 to sync with your SinricPro v2.7.0 https://github.com/sinricpro/esp8266-esp32-sdk/releases/tag/2.7.0

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/khoih-prog/SinricPro_Generic/issues/1#issuecomment-703827327, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZAZZTMX6Y5CPWAOBBGM73SJIJ2HANCNFSM4NJGPB7Q .

khoih-prog commented 3 years ago

Just added the support to Realtek RTL8720DN WiFi, used in SeeedStudio SEEED_WIO_TERMINAL, to WebSockets_Generic Library which is relied on by this SinricPro_Generic Library


New in v2.3.2

  1. Add support to Realtek RTL8720DN WiFi using Seeed_Arduino_rpcWiFi and Seeed_Arduino_rpcUnified libraries. This RTL8720DN supports Dual-Band 2.4GHz / 5GHz Wi-Fi (802.11 a/b/g/n) as well as BLE/BLE 5.0 and is currently used in SeeedStudio SEEED_WIO_TERMINAL.
  2. Add examples for SeeedStudio SEEED_WIO_TERMINAL and update all examples
  3. Add Version string definition

WebSockets_Generic v2.3.2

tcpipchip commented 3 years ago

will run o RTL8710 ?

khoih-prog commented 3 years ago

@tcpipchip

Possibly if RTL8710 has similar features to RTL8720DN and can use the same Seeed_Arduino_rpcWiFi and Seeed_Arduino_rpcUnified libraries.

Can you check to be sure, and test if you have time. I'm currently very busy with something else to look at RTL8710.

tcpipchip commented 3 years ago

Just curious!

khoih-prog commented 3 years ago

A new version v2.7.4 to support SeeedStudio WIO-Terminal has just been released.

Cheers,

=========================================

Releases v2.7.4

  1. Sync with v2.7.4 of original SinricPro library. Check Change Log for more details.
  2. Add examples and support to WIO Terminal, and in general boards with Realtek RTL8720DN WiFi using Seeed_Arduino_rpcWiFi and Seeed_Arduino_rpcUnified libraries. This RTL8720DN supports Dual-Band 2.4GHz / 5GHz Wi-Fi (802.11 a/b/g/n) as well as BLE/BLE 5.0. To be used with WebSockets_Generic v2.3.2+.
khoih-prog commented 3 years ago

Just to inform that RP2040-based boards are now supported, using WiFiNINA or Ethernet W5x00/ENC28J60


Releases v2.8.1

  1. Add support to RP2040-based boards, such as Nano_RP2040_Connect, RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, using Arduino-mbed RP2040 core.
  2. Add support to RP2040-based boards, such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, using Earle Philhower's arduino-pico core
  3. Add Table of Contents
tcpipchip commented 3 years ago

very nice @khoih-prog

khoih-prog commented 2 years ago

Hi @kakopappa and @sivar2311

Just published a new SinricPro_Generic v2.8.5 to add support to many boards, such as Portenta_H7, W5100S, W5100S-EVB-Pico, etc.

Still don't have time to keep up with the new Sinric_Pro SDK. Will update shortly.


Version 2.8.5

  1. Use Ethernet_Generic library as default for W5x00 Ethernet.
  2. Add support to Portenta_H7
  3. Add support to WIZNet W5100S, such as WIZnet Ethernet HAT and W5100S-EVB-Pico
  4. Update Packages' Patches