Problem z DS18B20 w trybie parasite na ESP8266

Marian1544
Posts: 64
Joined: Sat Aug 28, 2021 4:45 pm

Post

Chyba to jest jakoś głębiej poblokowane w aktualny SD.
Wygenerowałem nowe GUID i AUTHKEY i użyłem funkcji:
SuplaDevice.setGUID(GUID);
SuplaDevice.setAuthKey(AUTHKEY);
SuplaDevice.setEmail(SUPLA_EMAIL);
SuplaDevice.setServer(SUPLA_SERVER);
SuplaDevice.begin();

Ale na serwie dalej pojawia się inne GUID, pewnie to po MACu, więc to jakaś grubsza sprawa.
User avatar
klew
Posts: 13905
Joined: Thu Jun 27, 2019 12:16 pm
Location: Wrocław
Has thanked: 134 times
Been thanked: 137 times

Post

Marian1544 wrote: Mon Jun 29, 2026 11:36 am Chyba to jest jakoś głębiej poblokowane w aktualny SD.
Wygenerowałem nowe GUID i AUTHKEY i użyłem funkcji:
SuplaDevice.setGUID(GUID);
SuplaDevice.setAuthKey(AUTHKEY);
SuplaDevice.setEmail(SUPLA_EMAIL);
SuplaDevice.setServer(SUPLA_SERVER);
SuplaDevice.begin();

Ale na serwie dalej pojawia się inne GUID, pewnie to po MACu, więc to jakaś grubsza sprawa.
Nie, tam nie ma niczego poblokowanego. Te metody set po prostu nie działają, gdy soft używa klas typu Supla::Config - to one są źródłem prawdy :P.
Jeśli chcesz tak programowo ustawić guid i authkey, to trzeba zrobić inicjalizację Configa przed SuplaDevice.begin() i ręcznie ustawić setGuid oraz setAuthKey (na instancji cfg, a nie na SuplaDevice). Na pewnoe gdzieś na forum są przykłady użycia tego.
Najlepsze suple dla Twojego domu :mrgreen:
Marian1544
Posts: 64
Joined: Sat Aug 28, 2021 4:45 pm

Post

Próbowałem coś w tym stylu:

Code: Select all

#include <supla/storage/config.h>
auto cfg = Supla::Storage::getConfig();

  if (cfg) {
    
    cfg->setGUID(GUID);
    cfg->setAuthKey(AUTHKEY);
    cfg->setWiFiSSID(WIFI_SSID);
    cfg->setWiFiPassword(WIFI_PASSWORD);
    cfg->setSuplaServer(SUPLA_SERVER);
    cfg->setEmail(SUPLA_EMAIL);
  }
Ale nie umiem tego cfg zainicjalizować, ani namierzyć getconfig().
Jak to prawidłowo podpiąć?
User avatar
klew
Posts: 13905
Joined: Thu Jun 27, 2019 12:16 pm
Location: Wrocław
Has thanked: 134 times
Been thanked: 137 times

Post

Marian1544 wrote: Mon Jun 29, 2026 2:58 pm
Coś w ten deseń:

Code: Select all

  #include <supla/storage/littlefs_config.h>

  Supla::LittleFsConfig configSupla;

  void setup() {
  ....
    // przed SuplaDevice.begin()
    Supla::Storage::Init();

    auto cfg = Supla::Storage::ConfigInstance();
    if (cfg) {
      cfg->setGUID(GUID);
      cfg->setAuthKey(AUTHKEY);

      // opcjonalnie też pozostała konfiguracja:
      cfg->setWiFiSSID(WIFI_SSID);
      cfg->setWiFiPassword(WIFI_PASSWORD);
      cfg->setSuplaServer(SUPLA_SERVER);
      cfg->setEmail(SUPLA_EMAIL);

      cfg->commit();
    }
.....
    SuplaDevice.begin();
Najlepsze suple dla Twojego domu :mrgreen:
Marian1544
Posts: 64
Joined: Sat Aug 28, 2021 4:45 pm

Post

Dzięki, działa :) .

Udało się też zachować historię :)

Return to “GUI Generic”