Rejestracja Arduino

marcin_77
Posty: 15
Rejestracja: ndz sie 08, 2021 1:23 pm

Zgodnie z Waszymi sugestiami, teraz mój kod wygląda następująco:

Kod: Zaznacz cały

/*
  Copyright (C) AC SOFTWARE SP. Z O.O.
  
  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version 2
  of the License, or (at your option) any later version.
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.
  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

#include <SuplaDevice.h>
#include <supla/control/relay.h>
#include <supla/control/sequence_button.h>

// Choose proper network interface for your card:
#ifdef ARDUINO_ARCH_AVR
  // Arduino Mega with EthernetShield W5100:
  #include <supla/network/ethernet_shield.h>
  // Ethernet MAC address
  uint8_t mac[6] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05};
  Supla::EthernetShield ethernet(mac);

  // Arduino Mega with ENC28J60:
  // #include <supla/network/ENC28J60.h>
  // Supla::ENC28J60 ethernet(mac);
#elif defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
  // ESP8266 and ESP32 based board:
  #include <supla/network/esp_wifi.h>
  Supla::ESPWifi wifi("your_wifi_ssid", "your_wifi_password");
#endif


void setup() {

  Serial.begin(115200);

  // Replace the falowing GUID with value that you can retrieve from https://www.supla.org/arduino/get-guid
  char GUID[SUPLA_GUID_SIZE] = {0x3E,0x0D,0xF4,0x1C,0xE3,0x0E,0x45,0x0B,0xC6,0x28,0x8C,0xAD,0xB4,0xFA,0xAA,0x88};

  // Replace the following AUTHKEY with value that you can retrieve from: https://www.supla.org/arduino/get-authkey
  char AUTHKEY[SUPLA_AUTHKEY_SIZE] = {0x3E,0x8E,0xF8,0x12,0x06,0xF2,0x0F,0xD8,0xB2,0xE5,0x69,0xF4,0x70,0x4B,0x78,0x05};
 
  /*
   * Having your device already registered at cloud.supla.org,
   * you want to change CHANNEL sequence or remove any of them,
   * then you must also remove the device itself from cloud.supla.org.
   * Otherwise you will get "Channel conflict!" error.
   */
    
  auto secretRelay = new Supla::Control::Relay(30, false); // Low level trigger relay on pin 30 
  auto alarmRelay = new Supla::Control::Relay(31, false);  // Low level trigger relay on pin 31
  auto seqButton = new Supla::Control::SequenceButton(28, true, true); // Button on pin 28 with internal pullUp 
                                                                       // and LOW is considered as "pressed" state

  // Sequence of lenghts [ms] of button being presset, released, pressed, released, etc.
  // Aplication will print on Serial recorded sequence, so use it to record your rhythm and put it here
  uint16_t sequence[30] = {90, 590, 90, 140, 90, 290, 90, 230, 90, 140, 90};

  seqButton->setSequence(sequence);
  seqButton->setMargin(0.5);  // we allow +- 50% deviation of state length compared to matching sequence

  // Button will trigger secretRelay when correct rhythm will be detected or alarmRelay otherwise
  seqButton->addAction(Supla::TURN_ON, secretRelay, Supla::ON_SEQUENCE_MATCH);
  seqButton->addAction(Supla::TURN_ON, alarmRelay, Supla::ON_SEQUENCE_DOESNT_MATCH);
 
  /*
   * SuplaDevice Initialization.
   * Server address is available at https://cloud.supla.org 
   * If you do not have an account, you can create it at https://cloud.supla.org/account/create
   * SUPLA and SUPLA CLOUD are free of charge
   * 
   */
 
  SuplaDevice.begin(GUID,              // Global Unique Identifier 
                    "192.168.1.6",  // SUPLA server address
                    "pi@raspberrypi",   // Email address used to login to Supla Cloud
                    AUTHKEY);          // Authorization key
    
}

void loop() {
  SuplaDevice.iterate();
}
Niestety nadal ten sam problem.
Awatar użytkownika
Goral64
Posty: 3129
Rejestracja: pt gru 27, 2019 6:22 pm
Lokalizacja: Żerniki Wrocławskie
Kontakt:

marcin_77 pisze: ndz sie 08, 2021 6:41 pm Niestety nadal ten sam problem.
A co w logach?
Jakim adresem email logujesz się na swój serwer supla?
Widzimy się na Supla Offline Party Season 2 :D

Obrazek
marcin_77
Posty: 15
Rejestracja: ndz sie 08, 2021 1:23 pm

Loguję się tym samym adresem co jest ustawiony w Arduino, czyli pi@raspberrypi
Czy Supla-server poza /var/log/messages i /var/log/syslog gdzieś jeszcze wyrzuca logi?
Awatar użytkownika
lesny8
Posty: 2802
Rejestracja: pn gru 11, 2017 9:43 pm

1. Stara chmura.
2. Protokół dla niej za wysoki
3. E-mail nie przechodzi walidacji
:P
Czekam na kolejne Supla Offline Party 👍
Awatar użytkownika
Goral64
Posty: 3129
Rejestracja: pt gru 27, 2019 6:22 pm
Lokalizacja: Żerniki Wrocławskie
Kontakt:

marcin_77 pisze: ndz sie 08, 2021 7:32 pm Loguję się tym samym adresem co jest ustawiony w Arduino, czyli pi@raspberrypi
Czy Supla-server poza /var/log/messages i /var/log/syslog gdzieś jeszcze wyrzuca logi?
Ja mam na dockerze, więc nie wiem. Pokaż logi z arduino, jak poprzednio.
Widzimy się na Supla Offline Party Season 2 :D

Obrazek
marcin_77
Posty: 15
Rejestracja: ndz sie 08, 2021 1:23 pm

lesny8 pisze: ndz sie 08, 2021 7:46 pm 1. Stara chmura.
2. Protokół dla niej za wysoki
3. E-mail nie przechodzi walidacji
:P
Gdzie znajdę nowszą wersję supla-cloud? Możliwe, że wersja dla Raspberry nie jest już rozwijana? (mam na myśli obraz karty SD).
Czy supla-docker na GitHub będzie najświeższa?
marcin_77
Posty: 15
Rejestracja: ndz sie 08, 2021 1:23 pm

Goral64 pisze: ndz sie 08, 2021 7:53 pm
marcin_77 pisze: ndz sie 08, 2021 7:32 pm Loguję się tym samym adresem co jest ustawiony w Arduino, czyli pi@raspberrypi
Czy Supla-server poza /var/log/messages i /var/log/syslog gdzieś jeszcze wyrzuca logi?
Ja mam na dockerze, więc nie wiem. Pokaż logi z arduino, jak poprzednio.
Więc chyba u siebie też uruchomię na dockerze i pewnie nie będzie problemu...
Awatar użytkownika
Goral64
Posty: 3129
Rejestracja: pt gru 27, 2019 6:22 pm
Lokalizacja: Żerniki Wrocławskie
Kontakt:

lesny8 pisze: ndz sie 08, 2021 7:46 pm 1. Stara chmura.
2. Protokół dla niej za wysoki
3. E-mail nie przechodzi walidacji
:P
Skoro Supla jest z najnowszego repo, a SuplaDevice jest nowa z protokołem 12, pozostaje pkt 3: nie przechodzi walidacji adres email, bo pi@raspberypi to nie jest pełny format internetowy.
@marcin_77 może spróbuj użyć jakiegoś rzeczywistego swojego adresu email do logowania i użycia w kodzie arduino?
@pzygmunt supla-server weryfikuje format adresu email do logowania?
Widzimy się na Supla Offline Party Season 2 :D

Obrazek
Awatar użytkownika
lesny8
Posty: 2802
Rejestracja: pn gru 11, 2017 9:43 pm

Goral64 pisze: ndz sie 08, 2021 8:00 pm
lesny8 pisze: ndz sie 08, 2021 7:46 pm 1. Stara chmura.
2. Protokół dla niej za wysoki
3. E-mail nie przechodzi walidacji
:P
Skoro Supla jest z najnowszego repo, a SuplaDevice jest nowa z protokołem 12, pozostaje pkt 3: nie przechodzi walidacji adres email, bo pi@raspberypi to nie jest pełny format internetowy.
@marcin_77 może spróbuj użyć jakiegoś rzeczywistego swojego adresu email do logowania i użycia w kodzie arduino?
@pzygmunt supla-server weryfikuje format adresu email do logowania?
Kolega pobrał gotowy obraz systemu z Suplą ze strony na kartę dla RPi, ten obraz jest przestarzaly i swoją drogą powinien być ze strony zdjęty. Jak kolega nie zaktualizował instancji ręcznie, to ma wersję prawdopodobnie v2.2
Co do walidacji, jeśli dobrze pamiętam, kiedy zaczynałem przygodę z Suplą, to tez miałem z tym userem problem (brak prawidłowej nazwy domeny, w domenie musi być kropka), dlatego dodalem sobie nowe konto ze swoim adresem mail i tak już zostało.
@marcin_77
Zainstaluj czysty OS na RPi, zainstaluj pip3, curl, git, docker, docker-compose, pobierz repo supla-docker z githuba i uruchom skrypt. Ciesz się Suplą 😉
Czekam na kolejne Supla Offline Party 👍
marcin_77
Posty: 15
Rejestracja: ndz sie 08, 2021 1:23 pm

I tak właśnie zamierzam zrobić :-)
Dziękuję wszystkim za pomoc.
ODPOWIEDZ

Wróć do „supla-server”