[PORADNIK] Arduino IDE

User avatar
veeroos
Posts: 1081
Joined: Sun Mar 20, 2022 9:30 am
Location: Głogów
Has thanked: 1 time
Been thanked: 9 times

Post

klew wrote: Fri Feb 10, 2023 11:40 am Ok, to czekam jeszcze jak to sprawdzisz z dwoma czujnikami i wtedy wrzucę poprawkę.
Pół godziny chodzi bez problemu, oba czujniki pokazują temperaturę i wilgotność.
Zamel Mew-01, Zamel PEW-01, Zamel SBW-01, Zamel THW-01, Zamel SRW-01, Zamel mSLW-02, Auraton BOX + Indor Sensor, Airly Gate By Veeroos, Zigbee to Supla Gateway + sensors, Zamel SGW-01 and more

https://github.com/v33r005
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

veeroos wrote: Fri Feb 10, 2023 2:58 pm
klew wrote: Fri Feb 10, 2023 11:40 am Ok, to czekam jeszcze jak to sprawdzisz z dwoma czujnikami i wtedy wrzucę poprawkę.
Pół godziny chodzi bez problemu, oba czujniki pokazują temperaturę i wilgotność.
Ok, dzięki za sprawdzenie.
Pytałem @krycha88, który ten sensor kiedyś implementował i ogólnie nie powinno się w tym onInit inicjalizować Wire.begin(), tymbardziej, że np. na ESP32 są jeszcze inne opcje.

Napisał, że w wolnej chiwli wrzuci aktualizację tego sensora, która używa jakiejś bardziej uniwersalnej biblioteki. Inicjalizacja wire powinna być robiona w programie ino w setup(). Dodamy taką informację do tego sensora.
Najlepsze suple dla Twojego domu :mrgreen:
User avatar
veeroos
Posts: 1081
Joined: Sun Mar 20, 2022 9:30 am
Location: Głogów
Has thanked: 1 time
Been thanked: 9 times

Post

klew wrote: Fri Feb 10, 2023 3:15 pm Ok, dzięki za sprawdzenie.
Pytałem @krycha88, który ten sensor kiedyś implementował i ogólnie nie powinno się w tym onInit inicjalizować Wire.begin(), tymbardziej, że np. na ESP32 są jeszcze inne opcje.

Napisał, że w wolnej chiwli wrzuci aktualizację tego sensora, która używa jakiejś bardziej uniwersalnej biblioteki. Inicjalizacja wire powinna być robiona w programie ino w setup(). Dodamy taką informację do tego sensora.
W sumie gdyby się chciało na innych pinach używać interfejsu i2c to pewnie by się to gryzło. Może naprawdę użyć innej biblioteki na przykład tej SHT31.h tam jak napisałem pod nią klasę to nie używałem Wire.begin(), a w bibliotece jest wywołana Wire.h i z niej jest używana TwoWire.
Zamel Mew-01, Zamel PEW-01, Zamel SBW-01, Zamel THW-01, Zamel SRW-01, Zamel mSLW-02, Auraton BOX + Indor Sensor, Airly Gate By Veeroos, Zigbee to Supla Gateway + sensors, Zamel SGW-01 and more

https://github.com/v33r005
kurus
Posts: 1312
Joined: Wed Jan 15, 2020 8:17 pm

Post

klew wrote: Fri Feb 10, 2023 11:40 am Ok, to czekam jeszcze jak to sprawdzisz z dwoma czujnikami i wtedy wrzucę poprawkę.
Odświeżę trochę temat, wczoraj przepiąłem dwa sht30 z esp8266 na esp32 wemos s2, jeden jest na adresie 44 drugi 45 i problem taki że ten z adresu 45 nie jest odczytywany, na esp8266 działało to bezproblemowo, masz pomysł w czym problem? Tutaj w konfiguracji dla esp32 jest jeszcze pozycja i2c2 i może ten czujnik drugi podpiąć należy pod osobne piny? W moim przypadku kwestia dotyczy softu gui
You do not have the required permissions to view the files attached to this post.
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

kurus wrote: Sun Apr 23, 2023 2:46 pm
klew wrote: Fri Feb 10, 2023 11:40 am Ok, to czekam jeszcze jak to sprawdzisz z dwoma czujnikami i wtedy wrzucę poprawkę.
Odświeżę trochę temat, wczoraj przepiąłem dwa sht30 z esp8266 na esp32 wemos s2, jeden jest na adresie 44 drugi 45 i problem taki że ten z adresu 45 nie jest odczytywany, na esp8266 działało to bezproblemowo, masz pomysł w czym problem? Tutaj w konfiguracji dla esp32 jest jeszcze pozycja i2c2 i może ten czujnik drugi podpiąć należy pod osobne piny? W moim przypadku kwestia dotyczy softu gui
Niestety nie wiem jak to jest w GG zaimplementowane.
Na oko i2c2 to pewnie drugi osobny kanał i2c, który możesz sobie skonfigurować.

Mi jak coś nie działa, to wgrywam jakiś pusty szkic na Arduino i próbuję przykładami z biblitek (np. sht) się połączyć i skomunikować. Wtedy wiem, czy mam wszsystko sprawne i dobrze podłączone.
Najlepsze suple dla Twojego domu :mrgreen:
kurus
Posts: 1312
Joined: Wed Jan 15, 2020 8:17 pm

Post

klew wrote: Tue Apr 25, 2023 9:10 am
kurus wrote: Sun Apr 23, 2023 2:46 pm
klew wrote: Fri Feb 10, 2023 11:40 am Ok, to czekam jeszcze jak to sprawdzisz z dwoma czujnikami i wtedy wrzucę poprawkę.
Odświeżę trochę temat, wczoraj przepiąłem dwa sht30 z esp8266 na esp32 wemos s2, jeden jest na adresie 44 drugi 45 i problem taki że ten z adresu 45 nie jest odczytywany, na esp8266 działało to bezproblemowo, masz pomysł w czym problem? Tutaj w konfiguracji dla esp32 jest jeszcze pozycja i2c2 i może ten czujnik drugi podpiąć należy pod osobne piny? W moim przypadku kwestia dotyczy softu gui
Niestety nie wiem jak to jest w GG zaimplementowane.
Na oko i2c2 to pewnie drugi osobny kanał i2c, który możesz sobie skonfigurować.

Mi jak coś nie działa, to wgrywam jakiś pusty szkic na Arduino i próbuję przykładami z biblitek (np. sht) się połączyć i skomunikować. Wtedy wiem, czy mam wszsystko sprawne i dobrze podłączone.
OK dziękuje za odp, będe próbował dalej :)
krzychunh
Posts: 53
Joined: Mon Jul 12, 2021 6:23 am

Post

Witam, mam problem staram się przerobić kod Stacji Pogodowej https://github.com/rkalwak/WeatherStation pod aktualną bibliotekę 25.11 dla Arduino, kod się kompiluje lecz mam problem, urządzenie nie rozsyła sieci wifi, przez co nie mogę połączyć stacji z Suplą, (nie mam podłączonych modułów przy konfiguracji) proszę o pomoc w rozwiązaniu problemu. Dziękuję

Code: Select all

// --- GPIO dla konfiguracji / statusu ---
#define STATUS_LED_GPIO        2      // LED na ESP32 Dev Module
#define BUTTON_CFG_RELAY_GPIO  0      // BOOT

// --- SUPLA ---
#include <SuplaDevice.h>
#include <supla/network/esp_wifi.h>
#include <supla/control/button.h>
#include <supla/device/status_led.h>
#include <supla/storage/littlefs_config.h>
#include <supla/network/esp_web_server.h>
#include <supla/network/html/device_info.h>
#include <supla/network/html/protocol_parameters.h>
#include <supla/network/html/status_led_parameters.h>
#include <supla/network/html/wifi_parameters.h>
#include <supla/events.h>

#include <supla/sensor/DS18B20.h>
#include <supla/sensor/rain.h>
#include <supla/sensor/wind.h>
#include <supla/sensor/pressure.h>
#include <supla/channel_element.h>
#include <supla/clock/clock.h>

// jeżeli naprawdę potrzebujesz własnych certyfikatów, można to później przywrócić
// #include <supla/device/supla_ca_cert.h>

// --- pamięć trwała jak w przykładzie ---
#include <supla/storage/eeprom.h>
Supla::Eeprom eeprom;

// --- WiFi (dla RSSI w pętli) ---
#include <WiFi.h>

// --- Czujniki I2C / inne ---
#include <Wire.h>
#include "HDC1080.h"
#include "MS5611Sensor.h"

// --- Twoje czujniki ---
#include "LightSensor.h"
#include "RainSensor.h"
#include "Anemometr.h"
#include "WindDirection.h"
#include "SPS30Sensor.h"
#include "VoltageSensor.h"

Supla::ESPWifi wifi;
Supla::LittleFsConfig configSupla;
Supla::Device::StatusLed statusLed(STATUS_LED_GPIO, true); // inverted state
Supla::EspWebServer suplaServer;

// --- obiekty globalne ---
Supla::Clock *suplaClock = nullptr;
Supla::Sensor::RainSensor *rainSensor = nullptr;

bool resetOncePerHour = true;
long lastRead = 0;

void setup() {
  Serial.begin(115200);
  delay(1000);

  Serial.println();
  Serial.println(F("Startuje stacja pogodowa SUPLA + CONFIG MODE..."));


  // --- I2C ---
  Wire.begin();
  Wire.setClock(100000);

  // --- CZUJNIKI ---

  // światło
  new Supla::Sensor::LightSensor();

  // SPS30
  Supla::Sensor::SPS30_X *sps30 = new Supla::Sensor::SPS30_X();
  new Supla::Sensor::SPS30_PM005(sps30);
  new Supla::Sensor::SPS30_PM01(sps30);
  new Supla::Sensor::SPS30_PM025(sps30);
  new Supla::Sensor::SPS30_PM04(sps30);
  new Supla::Sensor::SPS30_PM10(sps30);

  // DS18B20 x2
  uint8_t internalTemp[8] = { 0x28, 0x52, 0x29, 0xB5, 0x63, 0x20, 0x01, 0x9B };
  uint8_t externalTemp[8] = { 0x28, 0x1C, 0x7F, 0x57, 0x04, 0xE1, 0x3C, 0x56 };

  new Supla::Sensor::DS18B20(4, internalTemp);
  new Supla::Sensor::DS18B20(4, externalTemp);

  // HDC1080 (temp + wilgotność)
  new Supla::Sensor::HDC1080();

  // MS5611 (ciśnienie)
  new Supla::Sensor::MS5611Sensor(248);

  // Deszcz SUPLA
  rainSensor = new Supla::Sensor::RainSensor(2, 2.5, 300);

  // Wiatr – kierunek + prędkość
  new Supla::Sensor::WindDirectionSensor(18, 15);
  new Supla::Sensor::Anemometr(15, 1, 0);

  // Napięcie (opcjonalnie)
  // new Supla::Sensor::VoltageMeasurement(34);

  // --- Zegar SUPLA ---
  suplaClock = new Supla::Clock();
  SuplaDevice.addClock(suplaClock);

  // --- START SUPLA (JEDEN RAZ, NA KOŃCU SETUP) ---
  SuplaDevice.begin();

  Serial.println(F("SuplaDevice.begin() wywołane - oczekiwanie na AP w trybie CFG"));
}

void loop() {
  SuplaDevice.iterate();

  // reset licznika opadów raz na godzinę
  if (suplaClock) {
    int minute = suplaClock->getMin();

    if (minute == 0 && resetOncePerHour) {
      if (rainSensor) {
        rainSensor->setReset(true);
        Serial.println(F("Reset licznika opadów (początek godziny)."));
      }
      resetOncePerHour = false;
    }

    if (minute == 1) {
      resetOncePerHour = true;
    }
  }

  // RSSI log co 10s
  if (millis() - lastRead > 10000) {
    Serial.print(F("RSSI: "));
    Serial.println(WiFi.RSSI());
    lastRead = millis();

    
  // HTML www component (DOKŁADNIE JAK W PRZYKŁADZIE)
  new Supla::Html::DeviceInfo(&SuplaDevice);
  new Supla::Html::WifiParameters;
  new Supla::Html::ProtocolParameters;
  new Supla::Html::StatusLedParameters;

  auto buttonCfgRelay =
    new Supla::Control::Button(BUTTON_CFG_RELAY_GPIO, true, true);

  // Generate AUTHKEY from https://www.supla.org/arduino/get-authkey
  // (tutaj TYLKO definiujemy zmienną, jak w przykładzie – nie wywołujemy setAuthKey)
 char AUTHKEY[SUPLA_AUTHKEY_SIZE] =  {0x3F,0x73,0x85,0x54,0x07,0x83,0x34,0x43,0x09,0x8C,0x3B,0xE6,0x41,0x5F,0x4C,0x7D};

  SuplaDevice.setInitialMode(Supla::InitialMode::StartInCfgMode);
    SuplaDevice.begin();
  }
}
Monitor portu szeregowego zwraca mi takie informacje

Code: Select all

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13964
load:0x40080400,len:3600
entry 0x400805f0

Startuje stacja pogodowa SUPLA + CONFIG MODE...
Channel[0] initial caption set to 'Natężenie światła'
GPM[0]: DefaultUnitAfterValue "lx"
Channel[1] initial caption set to 'PM 0.5'
GPM[1]: DefaultUnitAfterValue "μg/m³"
GPM[1]: RefreshIntervalMs 60000 ms
LittleFS: writing file 1_gpm_common
GPM[1]: common config saved successfully
GPM[2]: DefaultUnitAfterValue "μg/m³"
Channel[2] initial caption set to 'PM 1.0'
GPM[2]: RefreshIntervalMs 60000 ms
LittleFS: writing file 2_gpm_common
GPM[2]: common config saved successfully
GPM[3]: DefaultUnitAfterValue "μg/m³"
Channel[3] initial caption set to 'PM 2.5'
GPM[3]: RefreshIntervalMs 60000 ms
LittleFS: writing file 3_gpm_common
GPM[3]: common config saved successfully
GPM[4]: DefaultUnitAfterValue "μg/m³"
Channel[4] initial caption set to 'PM 4.0'
GPM[4]: RefreshIntervalMs 60000 ms
LittleFS: writing file 4_gpm_common
GPM[4]: common config saved successfully
GPM[5]: DefaultUnitAfterValue "μg/m³"
Channel[5] initial caption set to 'PM 10.0'
GPM[5]: RefreshIntervalMs 60000 ms
LittleFS: writing file 5_gpm_common
GPM[5]: common config saved successfully
Creating OneWire bus for pin: 4
Initializing OneWire bus at pin 4
OneWire(pin 4) Parasite power is OFF
OneWire(pin 4) Found 0 devices:
Channel(9) value changed to -1.00
Channel(10) value changed to -1.00
Channel(12) value changed to -1
addClock: DEPRECATED
 *** Supla - starting initialization (platform 0)
SD: add flag DEVICE_CONFIG_SUPPORTED
SD: add flag CALCFG_RESTART_DEVICE
Storage initialization
readStorage: 8; Read: [53 55 50 4C 41 1 0 1 ]
Storage: Number of sections 1
Reading section: 0
readStorage: 7; Read: [3 0 0 0 0 0 0 ]
Section type: 3; size: 0
storedCRC 0, CRC calc 65535
LittleFsConfig: init called on non empty database. Aborting
 *** Supla - Config initalization
SD: add flag CALCFG_ENTER_CFG_MODE
SD: add flag CALCFG_FACTORY_RESET_SUPPORTED
LittleFsConfig: writing to file "/supla-dev.cfg"
LittleFsConfig: writing to file "/supla-dev.cfg.bak"
Successfully generated GUID and AuthKey
New AuthKey: 9F7F7E722EEA3F9FE0D13E2F7C8695E3
Automatic firmware update is disabled
Device mode: 0
Config incomplete: missing Wi-Fi SSID
LAST STATE ADDED: Missing Wi-Fi SSID
Config incomplete: missing Wi-Fi password
LAST STATE ADDED: Missing Wi-Fi password
Config incomplete: missing server
Config incomplete: missing email
Security level: Supla CA
 *** Supla - Config load for elements
SD: add flag CALCFG_IDENTIFY_DEVICE
RemoteDeviceConfig: Registering field 0x000000001
GPM[0]: config loaded successfully
GPM[0]: RefreshIntervalMs 5000 ms
GPM[1]: config loaded successfully
GPM[1]: RefreshIntervalMs 60000 ms
Channel[1] config changed offline flag is set
GPM[2]: config loaded successfully
GPM[2]: RefreshIntervalMs 60000 ms
Channel[2] config changed offline flag is set
GPM[3]: config loaded successfully
GPM[3]: RefreshIntervalMs 60000 ms
Channel[3] config changed offline flag is set
GPM[4]: config loaded successfully
GPM[4]: RefreshIntervalMs 60000 ms
Channel[4] config changed offline flag is set
GPM[5]: config loaded successfully
GPM[5]: RefreshIntervalMs 60000 ms
Channel[5] config changed offline flag is set
Channel[6] temperature correction 0.00
Channel[6] humidity correction 0.00
Channel[7] temperature correction 0.00
Channel[7] humidity correction 0.00
Channel[8] temperature correction 0.00
Channel[8] humidity correction 0.00
RemoteDeviceConfig: Registering field 0x000000010
Clock: automaticTimeSync: 1
 *** Supla - Config load for elements done
 *** Supla - Load state storage
Validating storage state section with current device configuration
Storage state section validation successful
 *** Supla - Load state storage done
 *** Supla - Init elements
Turning ON SPS sensor
Channel(1) value changed to 1.96
Channel(3) value changed to 1.96
Channel(5) value changed to 2147483647.47
Channel(6) value changed to -275.00
Channel(7) value changed to -275.00
Channel(8) value changed to temp(-275.00), humi(-1.00)
MS5611 init.
MS5611 getting pres.
Channel(9) value changed to temp(-123.00), humi(-1.00)
Channel(10) value changed to 0.00
Channel(12) value changed to 0.00
 *** Supla - Init elements done
Config incomplete: deviceMode = CONFIG
LAST STATE ADDED: Missing server address
Current status: [3] Missing server address
LAST STATE ADDED: Missing email address
Current status: [32] Missing email address
GUID: 1EBBBB3EB10AAC2627729CF89D9884A0
Device name: SUPLA-ESP32
Device software version: SDK 25.11-dev
 *** Supla - Initializing network layer
[Wi-Fi] Network AP/hostname: SUPLA-ESP32-BCDDC2CD9250
Using Supla protocol version 23
Current status: [5] SuplaDevice initialized
Config incomplete: deviceMode = CONFIG
Disabling network setup, device work in not configured mode
LAST STATE ADDED: Not configured mode
Current status: [90] Not configured mode
[Wi-Fi] setOfflineMode
 *** Supla - Initialization done
 *** Self-test ***
TEST: ManufacturerID is 0
TEST failed: ProductID is empty
TEST failed: storage init result is false
TEST failed: missing public RSA key
TEST failed: automatic firmware update is disabled
TEST failed: config encryption is disabled
TEST failed: invalid certificates format
TEST failed: security log is disabled
 *** Self-test done ***
SuplaDevice.begin() wywołane - oczekiwanie na AP w trybie CFG
Reset licznika opadów (początek godziny).
[email protected]
Posts: 1584
Joined: Mon Feb 06, 2023 8:56 am
Has thanked: 18 times
Been thanked: 26 times

Post

krzychunh wrote: Fri Jan 16, 2026 8:22 am Witam, mam problem staram się przerobić kod Stacji Pogodowej https://github.com/rkalwak/WeatherStation pod aktualną bibliotekę 25.11 dla Arduino, kod się kompiluje lecz mam problem, urządzenie nie rozsyła sieci wifi, przez co nie mogę połączyć stacji z Suplą, (nie mam podłączonych modułów przy konfiguracji) proszę o pomoc w rozwiązaniu problemu. Dziękuję

Code: Select all

// --- GPIO dla konfiguracji / statusu ---
#define STATUS_LED_GPIO        2      // LED na ESP32 Dev Module
#define BUTTON_CFG_RELAY_GPIO  0      // BOOT

// --- SUPLA ---
#include <SuplaDevice.h>
#include <supla/network/esp_wifi.h>
#include <supla/control/button.h>
#include <supla/device/status_led.h>
#include <supla/storage/littlefs_config.h>
#include <supla/network/esp_web_server.h>
#include <supla/network/html/device_info.h>
#include <supla/network/html/protocol_parameters.h>
#include <supla/network/html/status_led_parameters.h>
#include <supla/network/html/wifi_parameters.h>
#include <supla/events.h>

#include <supla/sensor/DS18B20.h>
#include <supla/sensor/rain.h>
#include <supla/sensor/wind.h>
#include <supla/sensor/pressure.h>
#include <supla/channel_element.h>
#include <supla/clock/clock.h>

// jeżeli naprawdę potrzebujesz własnych certyfikatów, można to później przywrócić
// #include <supla/device/supla_ca_cert.h>

// --- pamięć trwała jak w przykładzie ---
#include <supla/storage/eeprom.h>
Supla::Eeprom eeprom;

// --- WiFi (dla RSSI w pętli) ---
#include <WiFi.h>

// --- Czujniki I2C / inne ---
#include <Wire.h>
#include "HDC1080.h"
#include "MS5611Sensor.h"

// --- Twoje czujniki ---
#include "LightSensor.h"
#include "RainSensor.h"
#include "Anemometr.h"
#include "WindDirection.h"
#include "SPS30Sensor.h"
#include "VoltageSensor.h"

Supla::ESPWifi wifi;
Supla::LittleFsConfig configSupla;
Supla::Device::StatusLed statusLed(STATUS_LED_GPIO, true); // inverted state
Supla::EspWebServer suplaServer;

// --- obiekty globalne ---
Supla::Clock *suplaClock = nullptr;
Supla::Sensor::RainSensor *rainSensor = nullptr;

bool resetOncePerHour = true;
long lastRead = 0;

void setup() {
  Serial.begin(115200);
  delay(1000);

  Serial.println();
  Serial.println(F("Startuje stacja pogodowa SUPLA + CONFIG MODE..."));


  // --- I2C ---
  Wire.begin();
  Wire.setClock(100000);

  // --- CZUJNIKI ---

  // światło
  new Supla::Sensor::LightSensor();

  // SPS30
  Supla::Sensor::SPS30_X *sps30 = new Supla::Sensor::SPS30_X();
  new Supla::Sensor::SPS30_PM005(sps30);
  new Supla::Sensor::SPS30_PM01(sps30);
  new Supla::Sensor::SPS30_PM025(sps30);
  new Supla::Sensor::SPS30_PM04(sps30);
  new Supla::Sensor::SPS30_PM10(sps30);

  // DS18B20 x2
  uint8_t internalTemp[8] = { 0x28, 0x52, 0x29, 0xB5, 0x63, 0x20, 0x01, 0x9B };
  uint8_t externalTemp[8] = { 0x28, 0x1C, 0x7F, 0x57, 0x04, 0xE1, 0x3C, 0x56 };

  new Supla::Sensor::DS18B20(4, internalTemp);
  new Supla::Sensor::DS18B20(4, externalTemp);

  // HDC1080 (temp + wilgotność)
  new Supla::Sensor::HDC1080();

  // MS5611 (ciśnienie)
  new Supla::Sensor::MS5611Sensor(248);

  // Deszcz SUPLA
  rainSensor = new Supla::Sensor::RainSensor(2, 2.5, 300);

  // Wiatr – kierunek + prędkość
  new Supla::Sensor::WindDirectionSensor(18, 15);
  new Supla::Sensor::Anemometr(15, 1, 0);

  // Napięcie (opcjonalnie)
  // new Supla::Sensor::VoltageMeasurement(34);

  // --- Zegar SUPLA ---
  suplaClock = new Supla::Clock();
  SuplaDevice.addClock(suplaClock);

  // --- START SUPLA (JEDEN RAZ, NA KOŃCU SETUP) ---
  SuplaDevice.begin();

  Serial.println(F("SuplaDevice.begin() wywołane - oczekiwanie na AP w trybie CFG"));
}

void loop() {
  SuplaDevice.iterate();

  // reset licznika opadów raz na godzinę
  if (suplaClock) {
    int minute = suplaClock->getMin();

    if (minute == 0 && resetOncePerHour) {
      if (rainSensor) {
        rainSensor->setReset(true);
        Serial.println(F("Reset licznika opadów (początek godziny)."));
      }
      resetOncePerHour = false;
    }

    if (minute == 1) {
      resetOncePerHour = true;
    }
  }

  // RSSI log co 10s
  if (millis() - lastRead > 10000) {
    Serial.print(F("RSSI: "));
    Serial.println(WiFi.RSSI());
    lastRead = millis();

    
  // HTML www component (DOKŁADNIE JAK W PRZYKŁADZIE)
  new Supla::Html::DeviceInfo(&SuplaDevice);
  new Supla::Html::WifiParameters;
  new Supla::Html::ProtocolParameters;
  new Supla::Html::StatusLedParameters;

  auto buttonCfgRelay =
    new Supla::Control::Button(BUTTON_CFG_RELAY_GPIO, true, true);

  // Generate AUTHKEY from https://www.supla.org/arduino/get-authkey
  // (tutaj TYLKO definiujemy zmienną, jak w przykładzie – nie wywołujemy setAuthKey)
 char AUTHKEY[SUPLA_AUTHKEY_SIZE] =  {0x3F,0x73,0x85,0x54,0x07,0x83,0x34,0x43,0x09,0x8C,0x3B,0xE6,0x41,0x5F,0x4C,0x7D};

  SuplaDevice.setInitialMode(Supla::InitialMode::StartInCfgMode);
    SuplaDevice.begin();
  }
}
Monitor portu szeregowego zwraca mi takie informacje

Code: Select all

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13964
load:0x40080400,len:3600
entry 0x400805f0

Startuje stacja pogodowa SUPLA + CONFIG MODE...
Channel[0] initial caption set to 'Natężenie światła'
GPM[0]: DefaultUnitAfterValue "lx"
Channel[1] initial caption set to 'PM 0.5'
GPM[1]: DefaultUnitAfterValue "μg/m³"
GPM[1]: RefreshIntervalMs 60000 ms
LittleFS: writing file 1_gpm_common
GPM[1]: common config saved successfully
GPM[2]: DefaultUnitAfterValue "μg/m³"
Channel[2] initial caption set to 'PM 1.0'
GPM[2]: RefreshIntervalMs 60000 ms
LittleFS: writing file 2_gpm_common
GPM[2]: common config saved successfully
GPM[3]: DefaultUnitAfterValue "μg/m³"
Channel[3] initial caption set to 'PM 2.5'
GPM[3]: RefreshIntervalMs 60000 ms
LittleFS: writing file 3_gpm_common
GPM[3]: common config saved successfully
GPM[4]: DefaultUnitAfterValue "μg/m³"
Channel[4] initial caption set to 'PM 4.0'
GPM[4]: RefreshIntervalMs 60000 ms
LittleFS: writing file 4_gpm_common
GPM[4]: common config saved successfully
GPM[5]: DefaultUnitAfterValue "μg/m³"
Channel[5] initial caption set to 'PM 10.0'
GPM[5]: RefreshIntervalMs 60000 ms
LittleFS: writing file 5_gpm_common
GPM[5]: common config saved successfully
Creating OneWire bus for pin: 4
Initializing OneWire bus at pin 4
OneWire(pin 4) Parasite power is OFF
OneWire(pin 4) Found 0 devices:
Channel(9) value changed to -1.00
Channel(10) value changed to -1.00
Channel(12) value changed to -1
addClock: DEPRECATED
 *** Supla - starting initialization (platform 0)
SD: add flag DEVICE_CONFIG_SUPPORTED
SD: add flag CALCFG_RESTART_DEVICE
Storage initialization
readStorage: 8; Read: [53 55 50 4C 41 1 0 1 ]
Storage: Number of sections 1
Reading section: 0
readStorage: 7; Read: [3 0 0 0 0 0 0 ]
Section type: 3; size: 0
storedCRC 0, CRC calc 65535
LittleFsConfig: init called on non empty database. Aborting
 *** Supla - Config initalization
SD: add flag CALCFG_ENTER_CFG_MODE
SD: add flag CALCFG_FACTORY_RESET_SUPPORTED
LittleFsConfig: writing to file "/supla-dev.cfg"
LittleFsConfig: writing to file "/supla-dev.cfg.bak"
Successfully generated GUID and AuthKey
New AuthKey: 9F7F7E722EEA3F9FE0D13E2F7C8695E3
Automatic firmware update is disabled
Device mode: 0
Config incomplete: missing Wi-Fi SSID
LAST STATE ADDED: Missing Wi-Fi SSID
Config incomplete: missing Wi-Fi password
LAST STATE ADDED: Missing Wi-Fi password
Config incomplete: missing server
Config incomplete: missing email
Security level: Supla CA
 *** Supla - Config load for elements
SD: add flag CALCFG_IDENTIFY_DEVICE
RemoteDeviceConfig: Registering field 0x000000001
GPM[0]: config loaded successfully
GPM[0]: RefreshIntervalMs 5000 ms
GPM[1]: config loaded successfully
GPM[1]: RefreshIntervalMs 60000 ms
Channel[1] config changed offline flag is set
GPM[2]: config loaded successfully
GPM[2]: RefreshIntervalMs 60000 ms
Channel[2] config changed offline flag is set
GPM[3]: config loaded successfully
GPM[3]: RefreshIntervalMs 60000 ms
Channel[3] config changed offline flag is set
GPM[4]: config loaded successfully
GPM[4]: RefreshIntervalMs 60000 ms
Channel[4] config changed offline flag is set
GPM[5]: config loaded successfully
GPM[5]: RefreshIntervalMs 60000 ms
Channel[5] config changed offline flag is set
Channel[6] temperature correction 0.00
Channel[6] humidity correction 0.00
Channel[7] temperature correction 0.00
Channel[7] humidity correction 0.00
Channel[8] temperature correction 0.00
Channel[8] humidity correction 0.00
RemoteDeviceConfig: Registering field 0x000000010
Clock: automaticTimeSync: 1
 *** Supla - Config load for elements done
 *** Supla - Load state storage
Validating storage state section with current device configuration
Storage state section validation successful
 *** Supla - Load state storage done
 *** Supla - Init elements
Turning ON SPS sensor
Channel(1) value changed to 1.96
Channel(3) value changed to 1.96
Channel(5) value changed to 2147483647.47
Channel(6) value changed to -275.00
Channel(7) value changed to -275.00
Channel(8) value changed to temp(-275.00), humi(-1.00)
MS5611 init.
MS5611 getting pres.
Channel(9) value changed to temp(-123.00), humi(-1.00)
Channel(10) value changed to 0.00
Channel(12) value changed to 0.00
 *** Supla - Init elements done
Config incomplete: deviceMode = CONFIG
LAST STATE ADDED: Missing server address
Current status: [3] Missing server address
LAST STATE ADDED: Missing email address
Current status: [32] Missing email address
GUID: 1EBBBB3EB10AAC2627729CF89D9884A0
Device name: SUPLA-ESP32
Device software version: SDK 25.11-dev
 *** Supla - Initializing network layer
[Wi-Fi] Network AP/hostname: SUPLA-ESP32-BCDDC2CD9250
Using Supla protocol version 23
Current status: [5] SuplaDevice initialized
Config incomplete: deviceMode = CONFIG
Disabling network setup, device work in not configured mode
LAST STATE ADDED: Not configured mode
Current status: [90] Not configured mode
[Wi-Fi] setOfflineMode
 *** Supla - Initialization done
 *** Self-test ***
TEST: ManufacturerID is 0
TEST failed: ProductID is empty
TEST failed: storage init result is false
TEST failed: missing public RSA key
TEST failed: automatic firmware update is disabled
TEST failed: config encryption is disabled
TEST failed: invalid certificates format
TEST failed: security log is disabled
 *** Self-test done ***
SuplaDevice.begin() wywołane - oczekiwanie na AP w trybie CFG
Reset licznika opadów (początek godziny).
Nie możesz w loop dać supladevice.begin.
Tak samo default start mode powinno być w setup przed begin
User avatar
veeroos
Posts: 1081
Joined: Sun Mar 20, 2022 9:30 am
Location: Głogów
Has thanked: 1 time
Been thanked: 9 times

Post

Dodatkowo w nowej bibliotece tryb konfiguracyjny jest domyślnie po starcie wyłączony, wchodzisz w niego dopiero po wciśnięciu na 5s przycisku konfiguracji, chyba że wystawiasz flagę taką jak masz w przykładzie Webinterface.
Zamel Mew-01, Zamel PEW-01, Zamel SBW-01, Zamel THW-01, Zamel SRW-01, Zamel mSLW-02, Auraton BOX + Indor Sensor, Airly Gate By Veeroos, Zigbee to Supla Gateway + sensors, Zamel SGW-01 and more

https://github.com/v33r005
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

krzychunh wrote: Fri Jan 16, 2026 8:22 am Witam, mam problem staram się przerobić kod Stacji Pogodowej https://github.com/rkalwak/WeatherStation pod aktualną bibliotekę 25.11 dla Arduino, kod się kompiluje lecz mam problem, urządzenie nie rozsyła sieci wifi, przez co nie mogę połączyć stacji z Suplą, (nie mam podłączonych modułów przy konfiguracji) proszę o pomoc w rozwiązaniu problemu. Dziękuję
Jeśli chcesz domyślnie uruchamiać tryb cfg z Wi-Fi, to ustaw przed begin():

Code: Select all

SuplaDevice.setInitialMode(Supla::InitialMode::StartInCfgMode);
Obecnie urządzenia nie startują z domyślnie włączonym trybem cfg, ze względów bezpieczeństwa. Urządzenie powinno być wyposażone w przycisk do wchodzenia w tryb cfg.
Najlepsze suple dla Twojego domu :mrgreen:

Return to “FAQ / Jak to zrobić”