Posiadam uruchomiony SUPLA-CLOUD w sieci LAN z najnowszego obrazu dla Raspberry z Waszej strony.
Podczas próby podłączenia nowego urządzenia (Arduino Mega 2560) Arduino nie pojawia się w sekcji "urządzenia we/wy", a monitor portu szeregowego Arduino wyświetla następujący log:
Kod: Zaznacz cały
Connecting to network...
DHCP connection result: 1
localIP: 192.168.1.7
subnetMask: 255.255.255.0
gatewayIP: 192.168.1.100
dnsServerIP: 192.168.1.100
Using Supla protocol version 12
Current status: [5] SuplaDevice initialized
Establishing connection with: 192.168.1.6 (port: 2015)
Connected to Supla Server
Current status: [10] Register in progress
Sending: [53 55 50 4C 41 C 1 0 0 0 45 0 0 0 7A 2 0 0 31 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 61 30 31 33 0 0 0 0 0 0 0 0 0 0 0 0 31 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 41 52 44 55 49 4E 4F 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0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duino zostały wcześniej wprowadzone poprawne ustawienia (GUID, Serwer, ID lokalizacji, Hasło lokalizacji).
Rozumiem, że GUID i Hasło lokalizacji podajemy szesnastkowo? Zresztą, nawet wprowadzając te wartości jako tekst, jest ten sam problem.
Mój kod Arduino (wg przykładu SequenceButton) :
Kod: Zaznacz cały
#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] = {0x31};
// Replace the following AUTHKEY with value that you can retrieve from: https://www.supla.org/arduino/get-authkey
char AUTHKEY[SUPLA_AUTHKEY_SIZE] = {0x61,0x30,0x31,0x33};
/*
* 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
"1", // Email address used to login to Supla Cloud
AUTHKEY); // Authorization key
}
void loop() {
SuplaDevice.iterate();
}
Dodam jeszcze, że ten sam kod (z odpowiednimi danymi logowania) działa bez problemu na Waszym cloudzie (svr9.suppla.org).