Zdalny podgląd LOG

User avatar
SOYER
Posts: 1623
Joined: Wed Aug 10, 2022 12:29 pm
Location: Kryry
Been thanked: 2 times

Post

vajera wrote: Wed Dec 31, 2025 5:02 pm
SOYER wrote: Wed Dec 31, 2025 4:55 pm Ok, zrobiłem to na innej bibliotece i niby jest dobrze ale nie jest, @klew dlaczego nie widać logów z supli, a tylko te początkowe z uruchamiania modułu...
Szkic:

Code: Select all

#include <SuplaDevice.h>
#include <supla/sensor/DS18B20.h>
#include <supla/network/esp_wifi.h>
#include <TelnetSpy.h>   //https://github.com/yasheena/telnetspy
 Supla::ESPWifi wifi("zz", "xx");

#include <OneWire.h>
#include <DallasTemperature.h>

#include <Timers.h>
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>

/* ------------------------------------------------- */

#define SERIAL_SPEED  115200
#define WIFI_SSID     "xx"
#define WIFI_PASSWORD "xx"

/* ------------------------------------------------- */

TelnetSpy LOG; // Używaj tego obiektu zamiast "Serial" w całym kodzie

int alarmPieca = 0;
int temp_CWU;
int temp_PIEC;
int temp_POWROT;
int temp_INSTALACJA;



OneWire oneWire0(5);//D1
DallasTemperature czujnikCWU_POWROT(&oneWire0);
DeviceAddress termometr_cwu = {0x28, 0xFF, 0xEF, 0x07, 0xB6, 0x01, 0x3C, 0xCF};
DeviceAddress termometr_powrot = {0x28, 0x5F, 0x17, 0x07, 0xB6, 0x01, 0x3C, 0x0B};

OneWire oneWire1(4);//D2
DallasTemperature czujnikPIEC_INSTALACJA(&oneWire1);

DeviceAddress termometr_piec = {0x28, 0x15, 0x50, 0x07, 0xB6, 0x01, 0x3C, 0x09};
DeviceAddress termometr_instalacja = {0x28, 0xE8, 0x5C, 0x07, 0xB6, 0x01, 0x3C, 0x10};


int supla;

char ssid[] = "xx";
char pass[] = "xx";

Timer minut5;

Timer sekund3;




void ds(){
  czujnikPIEC_INSTALACJA.requestTemperatures(); 
  temp_PIEC = (czujnikPIEC_INSTALACJA.getTempC(termometr_piec)+8);
  temp_INSTALACJA = czujnikPIEC_INSTALACJA.getTempC(termometr_instalacja);
  czujnikCWU_POWROT.requestTemperatures(); 
  temp_CWU = (czujnikCWU_POWROT.getTempC(termometr_cwu)+7);
  temp_POWROT = (czujnikCWU_POWROT.getTempC(termometr_powrot)+8);
}
void setup() {
  // LOG inicjalizuje Serial automatycznie (domyślnie 115200)
  LOG.begin(SERIAL_SPEED); 
  LOG.println("System uruchomiony z TelnetSpy."); // Pojawi się wszędzie

  WiFi.mode(WIFI_STA);
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);

  while(WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    LOG.print("."); // Postęp łączenia widoczny w Serial Monitor i na Telnet po połączeniu
  }
  LOG.println("\nPolaczono z siecia WiFi!");
  LOG.print("Adres IP: ");
  LOG.println(WiFi.localIP());
    // Replace the falowing GUID with value that you can retrieve from https://www.supla.org/arduino/get-guid
  char GUID[SUPLA_GUID_SIZE] = {xx};

  // Replace the following AUTHKEY with value that you can retrieve from: https://www.supla.org/arduino/get-authkey
  char AUTHKEY[SUPLA_AUTHKEY_SIZE] = {xx};

  new Supla::Sensor::DS18B20(5, termometr_cwu);
  new Supla::Sensor::DS18B20(5, termometr_powrot);
  new Supla::Sensor::DS18B20(4, termometr_piec);
  new Supla::Sensor::DS18B20(4, termometr_instalacja);
  
  SuplaDevice.begin(GUID,              // Global Unique Identifier 
                    "svrxx.supla.org",  // SUPLA server address
                    "xx",   // Email address used to login to Supla Cloud
                    AUTHKEY);          // Authorization key
  
  WiFi.begin(ssid, pass);
  czujnikPIEC_INSTALACJA.begin();
  czujnikCWU_POWROT.begin();
  sekund3.begin(2999);
  minut5.begin(59993);
  ds();

}

void loop() {
  if(sekund3.available()){
    LOG.println("co 3 sekundy");
    sekund3.restart();
  }
    SuplaDevice.iterate();
    LOG.handle(); // Niezbędne do obsługi połączeń Telnet w tle

  // Przesylanie wejscia Z Telnetu NA Serial (automatycznie)
  while (LOG.available() > 0) {
    Serial.write(LOG.read());
  }

  if(minut5.available()){
   ds();
   minut5.restart();
  }
}
To jest to, o czym pisałem w temacie własnej funkcji logującej - w swoim kodzie masz:

Code: Select all


TelnetSpy LOG; // Używaj tego obiektu zamiast "Serial" w całym kodzie 
Ty jej używasz, ale SD już nie...I każda inna biblioteka, którą dodasz również jej nie będzie używać. Ten sam efekt możesz osiągnąć tą pierwszą biblioteką, jeżeli użyjesz własnej metody generowania logów - problem leży w tym, żeby przekierować logi z innych bibliotek.
Wszystko jasne. Myślałem, że ten "Szpieg" sam jkoś przechwytuje to co idzie na serial i konwertuje pod siebie, ale zdaje się to tak nie działa...

Dziękuję
https://youtube.com/@tomaszhamer8134?si=_J1cT_QWsXxgt1Fm
https://kryry01.aqi.eco/pl
https://app.weathercloud.net/d4311785603
https://github.com/Soyer79
User avatar
vajera
Posts: 7290
Joined: Wed Oct 31, 2018 7:58 am
Location: Biedrusko
Has thanked: 289 times
Been thanked: 161 times

Post

SOYER wrote: Wed Dec 31, 2025 5:10 pm
vajera wrote: Wed Dec 31, 2025 5:02 pm
SOYER wrote: Wed Dec 31, 2025 4:55 pm Ok, zrobiłem to na innej bibliotece i niby jest dobrze ale nie jest, @klew dlaczego nie widać logów z supli, a tylko te początkowe z uruchamiania modułu...
Szkic:

Code: Select all

#include <SuplaDevice.h>
#include <supla/sensor/DS18B20.h>
#include <supla/network/esp_wifi.h>
#include <TelnetSpy.h>   //https://github.com/yasheena/telnetspy
 Supla::ESPWifi wifi("zz", "xx");

#include <OneWire.h>
#include <DallasTemperature.h>

#include <Timers.h>
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>

/* ------------------------------------------------- */

#define SERIAL_SPEED  115200
#define WIFI_SSID     "xx"
#define WIFI_PASSWORD "xx"

/* ------------------------------------------------- */

TelnetSpy LOG; // Używaj tego obiektu zamiast "Serial" w całym kodzie

int alarmPieca = 0;
int temp_CWU;
int temp_PIEC;
int temp_POWROT;
int temp_INSTALACJA;



OneWire oneWire0(5);//D1
DallasTemperature czujnikCWU_POWROT(&oneWire0);
DeviceAddress termometr_cwu = {0x28, 0xFF, 0xEF, 0x07, 0xB6, 0x01, 0x3C, 0xCF};
DeviceAddress termometr_powrot = {0x28, 0x5F, 0x17, 0x07, 0xB6, 0x01, 0x3C, 0x0B};

OneWire oneWire1(4);//D2
DallasTemperature czujnikPIEC_INSTALACJA(&oneWire1);

DeviceAddress termometr_piec = {0x28, 0x15, 0x50, 0x07, 0xB6, 0x01, 0x3C, 0x09};
DeviceAddress termometr_instalacja = {0x28, 0xE8, 0x5C, 0x07, 0xB6, 0x01, 0x3C, 0x10};


int supla;

char ssid[] = "xx";
char pass[] = "xx";

Timer minut5;

Timer sekund3;




void ds(){
  czujnikPIEC_INSTALACJA.requestTemperatures(); 
  temp_PIEC = (czujnikPIEC_INSTALACJA.getTempC(termometr_piec)+8);
  temp_INSTALACJA = czujnikPIEC_INSTALACJA.getTempC(termometr_instalacja);
  czujnikCWU_POWROT.requestTemperatures(); 
  temp_CWU = (czujnikCWU_POWROT.getTempC(termometr_cwu)+7);
  temp_POWROT = (czujnikCWU_POWROT.getTempC(termometr_powrot)+8);
}
void setup() {
  // LOG inicjalizuje Serial automatycznie (domyślnie 115200)
  LOG.begin(SERIAL_SPEED); 
  LOG.println("System uruchomiony z TelnetSpy."); // Pojawi się wszędzie

  WiFi.mode(WIFI_STA);
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);

  while(WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    LOG.print("."); // Postęp łączenia widoczny w Serial Monitor i na Telnet po połączeniu
  }
  LOG.println("\nPolaczono z siecia WiFi!");
  LOG.print("Adres IP: ");
  LOG.println(WiFi.localIP());
    // Replace the falowing GUID with value that you can retrieve from https://www.supla.org/arduino/get-guid
  char GUID[SUPLA_GUID_SIZE] = {xx};

  // Replace the following AUTHKEY with value that you can retrieve from: https://www.supla.org/arduino/get-authkey
  char AUTHKEY[SUPLA_AUTHKEY_SIZE] = {xx};

  new Supla::Sensor::DS18B20(5, termometr_cwu);
  new Supla::Sensor::DS18B20(5, termometr_powrot);
  new Supla::Sensor::DS18B20(4, termometr_piec);
  new Supla::Sensor::DS18B20(4, termometr_instalacja);
  
  SuplaDevice.begin(GUID,              // Global Unique Identifier 
                    "svrxx.supla.org",  // SUPLA server address
                    "xx",   // Email address used to login to Supla Cloud
                    AUTHKEY);          // Authorization key
  
  WiFi.begin(ssid, pass);
  czujnikPIEC_INSTALACJA.begin();
  czujnikCWU_POWROT.begin();
  sekund3.begin(2999);
  minut5.begin(59993);
  ds();

}

void loop() {
  if(sekund3.available()){
    LOG.println("co 3 sekundy");
    sekund3.restart();
  }
    SuplaDevice.iterate();
    LOG.handle(); // Niezbędne do obsługi połączeń Telnet w tle

  // Przesylanie wejscia Z Telnetu NA Serial (automatycznie)
  while (LOG.available() > 0) {
    Serial.write(LOG.read());
  }

  if(minut5.available()){
   ds();
   minut5.restart();
  }
}
To jest to, o czym pisałem w temacie własnej funkcji logującej - w swoim kodzie masz:

Code: Select all


TelnetSpy LOG; // Używaj tego obiektu zamiast "Serial" w całym kodzie 
Ty jej używasz, ale SD już nie...I każda inna biblioteka, którą dodasz również jej nie będzie używać. Ten sam efekt możesz osiągnąć tą pierwszą biblioteką, jeżeli użyjesz własnej metody generowania logów - problem leży w tym, żeby przekierować logi z innych bibliotek.
Wszystko jasne. Myślałem, że ten "Szpieg" sam jkoś przechwytuje to co idzie na serial i konwertuje pod siebie, ale zdaje się to tak nie działa...

Dziękuję
Zrób taki test:

przed setup() dodaj sobie poniższą funkcję:

Code: Select all

int my_vprintf(const char *format, va_list args) {

    char buffer[512];
    int len = vsnprintf(buffer, sizeof(buffer), format, args);
    if (len > 0)
    LOG.println(buffer);
    
    return len;
}
a gdzieś w setup() daj:

Code: Select all

esp_log_set_vprintf(my_vprintf);
Bramka Zigbee <=> SUPLA
Więcej informacji tutaj:
https://forum.supla.org/viewforum.php?f=127
FAQ https://forum.supla.org/viewtopic.php?t=17277
User avatar
SOYER
Posts: 1623
Joined: Wed Aug 10, 2022 12:29 pm
Location: Kryry
Been thanked: 2 times

Post

vajera wrote: Wed Dec 31, 2025 5:16 pm
SOYER wrote: Wed Dec 31, 2025 5:10 pm
vajera wrote: Wed Dec 31, 2025 5:02 pm
To jest to, o czym pisałem w temacie własnej funkcji logującej - w swoim kodzie masz:

Code: Select all


TelnetSpy LOG; // Używaj tego obiektu zamiast "Serial" w całym kodzie 
Ty jej używasz, ale SD już nie...I każda inna biblioteka, którą dodasz również jej nie będzie używać. Ten sam efekt możesz osiągnąć tą pierwszą biblioteką, jeżeli użyjesz własnej metody generowania logów - problem leży w tym, żeby przekierować logi z innych bibliotek.
Wszystko jasne. Myślałem, że ten "Szpieg" sam jkoś przechwytuje to co idzie na serial i konwertuje pod siebie, ale zdaje się to tak nie działa...

Dziękuję
Zrób taki test:

przed setup() dodaj sobie poniższą funkcję:

Code: Select all

void my_vprintf(const char *format, va_list args) {

    char buffer[512];
    
    if (vsnprintf(buffer, sizeof(buffer), format, args)>0)
    LOG.println(buffer);
}
a gdzieś w setup() daj:

Code: Select all

esp_log_set_vprintf(my_vprintf);
Zakombinowałem z dodaniem:

Code: Select all

#define Serial LOG
ale nie zadziałało:)

już sprawdzam Twój sposób...
https://youtube.com/@tomaszhamer8134?si=_J1cT_QWsXxgt1Fm
https://kryry01.aqi.eco/pl
https://app.weathercloud.net/d4311785603
https://github.com/Soyer79
User avatar
SOYER
Posts: 1623
Joined: Wed Aug 10, 2022 12:29 pm
Location: Kryry
Been thanked: 2 times

Post

vajera wrote: Wed Dec 31, 2025 5:16 pm
SOYER wrote: Wed Dec 31, 2025 5:10 pm
vajera wrote: Wed Dec 31, 2025 5:02 pm
To jest to, o czym pisałem w temacie własnej funkcji logującej - w swoim kodzie masz:

Code: Select all


TelnetSpy LOG; // Używaj tego obiektu zamiast "Serial" w całym kodzie 
Ty jej używasz, ale SD już nie...I każda inna biblioteka, którą dodasz również jej nie będzie używać. Ten sam efekt możesz osiągnąć tą pierwszą biblioteką, jeżeli użyjesz własnej metody generowania logów - problem leży w tym, żeby przekierować logi z innych bibliotek.
Wszystko jasne. Myślałem, że ten "Szpieg" sam jkoś przechwytuje to co idzie na serial i konwertuje pod siebie, ale zdaje się to tak nie działa...

Dziękuję
Zrób taki test:

przed setup() dodaj sobie poniższą funkcję:

Code: Select all

int my_vprintf(const char *format, va_list args) {

    char buffer[512];
    int len = vsnprintf(buffer, sizeof(buffer), format, args);
    if (len > 0)
    LOG.println(buffer);
    
    return len;
}
a gdzieś w setup() daj:

Code: Select all

esp_log_set_vprintf(my_vprintf);


...
exit status 1
'esp_log_set_vprintf' was not declared in this scope
...
https://youtube.com/@tomaszhamer8134?si=_J1cT_QWsXxgt1Fm
https://kryry01.aqi.eco/pl
https://app.weathercloud.net/d4311785603
https://github.com/Soyer79
User avatar
vajera
Posts: 7290
Joined: Wed Oct 31, 2018 7:58 am
Location: Biedrusko
Has thanked: 289 times
Been thanked: 161 times

Post

SOYER wrote: Wed Dec 31, 2025 5:21 pm
vajera wrote: Wed Dec 31, 2025 5:16 pm
SOYER wrote: Wed Dec 31, 2025 5:10 pm

Wszystko jasne. Myślałem, że ten "Szpieg" sam jkoś przechwytuje to co idzie na serial i konwertuje pod siebie, ale zdaje się to tak nie działa...

Dziękuję
Zrób taki test:

przed setup() dodaj sobie poniższą funkcję:

Code: Select all

int my_vprintf(const char *format, va_list args) {

    char buffer[512];
    int len = vsnprintf(buffer, sizeof(buffer), format, args);
    if (len > 0)
    LOG.println(buffer);
    
    return len;
}
a gdzieś w setup() daj:

Code: Select all

esp_log_set_vprintf(my_vprintf);


...
exit status 1
'esp_log_set_vprintf' was not declared in this scope
...
Na początku-tam gdzie masz #include dołóż linijkę:

Code: Select all

#include <esp_log.h>
Przy okazji - poprawiłem tę funkcję my_vprintf(...)
Bramka Zigbee <=> SUPLA
Więcej informacji tutaj:
https://forum.supla.org/viewforum.php?f=127
FAQ https://forum.supla.org/viewtopic.php?t=17277
User avatar
SOYER
Posts: 1623
Joined: Wed Aug 10, 2022 12:29 pm
Location: Kryry
Been thanked: 2 times

Post

vajera wrote: Wed Dec 31, 2025 5:24 pm
SOYER wrote: Wed Dec 31, 2025 5:21 pm
vajera wrote: Wed Dec 31, 2025 5:16 pm

Zrób taki test:

przed setup() dodaj sobie poniższą funkcję:

Code: Select all

int my_vprintf(const char *format, va_list args) {

    char buffer[512];
    int len = vsnprintf(buffer, sizeof(buffer), format, args);
    if (len > 0)
    LOG.println(buffer);
    
    return len;
}
a gdzieś w setup() daj:

Code: Select all

esp_log_set_vprintf(my_vprintf);


...
exit status 1
'esp_log_set_vprintf' was not declared in this scope
...
Na początku-tam gdzie masz #include dołóż linijkę:

Code: Select all

#include <esp_log.h>
Przy okazji - poprawiłem tę funkcję my_vprintf(...)
płytka to esp8266... to płytka od monitorowania pieca CO, jeden z moich pierwszych projektów przeniesionych na Suplę dawno temu, a ta biblioteka to zdaje się dla esp32
https://youtube.com/@tomaszhamer8134?si=_J1cT_QWsXxgt1Fm
https://kryry01.aqi.eco/pl
https://app.weathercloud.net/d4311785603
https://github.com/Soyer79
User avatar
vajera
Posts: 7290
Joined: Wed Oct 31, 2018 7:58 am
Location: Biedrusko
Has thanked: 289 times
Been thanked: 161 times

Post

SOYER wrote: Wed Dec 31, 2025 5:31 pm
vajera wrote: Wed Dec 31, 2025 5:24 pm
SOYER wrote: Wed Dec 31, 2025 5:21 pm



...
exit status 1
'esp_log_set_vprintf' was not declared in this scope
...
Na początku-tam gdzie masz #include dołóż linijkę:

Code: Select all

#include <esp_log.h>
Przy okazji - poprawiłem tę funkcję my_vprintf(...)
płytka to esp8266... to płytka od monitorowania pieca CO, jeden z moich pierwszych projektów przeniesionych na Suplę dawno temu, a ta biblioteka to zdaje się dla esp32
To niestety ten mechanizm nie zadziała.
Bramka Zigbee <=> SUPLA
Więcej informacji tutaj:
https://forum.supla.org/viewforum.php?f=127
FAQ https://forum.supla.org/viewtopic.php?t=17277
User avatar
SOYER
Posts: 1623
Joined: Wed Aug 10, 2022 12:29 pm
Location: Kryry
Been thanked: 2 times

Post

@klew co wpisać zamiast "Serial" w linijce:

Code: Select all

#define Serial LOG
żeby zadziałało z Suplą? :))
może zwykłe "oszustwo" wystarczy?
https://youtube.com/@tomaszhamer8134?si=_J1cT_QWsXxgt1Fm
https://kryry01.aqi.eco/pl
https://app.weathercloud.net/d4311785603
https://github.com/Soyer79
User avatar
vajera
Posts: 7290
Joined: Wed Oct 31, 2018 7:58 am
Location: Biedrusko
Has thanked: 289 times
Been thanked: 161 times

Post

SOYER wrote: Wed Dec 31, 2025 5:46 pm @klew co wpisać zamiast "Serial" w linijce:

Code: Select all

#define Serial LOG
żeby zadziałało z Suplą? :))
może zwykłe "oszustwo" wystarczy?
To tak nie działa - #define to jest dyrektywa preprocesora, czyli to jest takie automatyczne Ctrl-C/Ctrl-V na kodzie, zanim jeszcze odpali kompilator.
Bramka Zigbee <=> SUPLA
Więcej informacji tutaj:
https://forum.supla.org/viewforum.php?f=127
FAQ https://forum.supla.org/viewtopic.php?t=17277
User avatar
SOYER
Posts: 1623
Joined: Wed Aug 10, 2022 12:29 pm
Location: Kryry
Been thanked: 2 times

Post

Mnie to w sumie do niczego potrzebne, ale fajne narzędzie do debugowania bez kabla. W zupełności mi wystarczy to, że będzie mi wysyłało to co sam będę chciał wysłać.
Dzięki za to, że nauczyłem się ciekawego narzędzia.
Do siego!
https://youtube.com/@tomaszhamer8134?si=_J1cT_QWsXxgt1Fm
https://kryry01.aqi.eco/pl
https://app.weathercloud.net/d4311785603
https://github.com/Soyer79

Return to “Projekty użytkowników”