Dzięki za sugestię. Spróbuję tak zobić. To pierwsze kroki. Chodziło mi aby delta załączała przekaźnik na poziomie sprzętowym (niezaleznie od sieci) i to mam. Teraz czas doskonalić kod.YoMan wrote: Thu Jan 09, 2025 9:36 pm
nie lepiej tę deltę zrobić na virtual_thermometer zamiastn gpm? od razu masz jednostki, ikonki, etc.
chyba zadziała (twierdzenie bambika, który zaczął pisać SUPLE 2 mies temuCode: Select all
class temperatureSensor : public Supla::Sensor::VirtualThermometer { public: temperatureSensor() {} double getValue() override { return (tt1->getTemp()-tt2->getTemp()); }) ewentualnie podpytaj wujaszka gpt o składnię
źródło: https://github.com/SUPLA/supla-device/b ... eter.h#L26
Termometr różnicowy
-
Rafalg
- Posts: 21
- Joined: Fri Jan 03, 2025 9:06 pm
-
Rafalg
- Posts: 21
- Joined: Fri Jan 03, 2025 9:06 pm
Zrobione. Jest znacznie lepiej.YoMan wrote: Thu Jan 09, 2025 9:36 pm
nie lepiej tę deltę zrobić na virtual_thermometer zamiastn gpm? od razu masz jednostki, ikonki, etc.
Code: Select all
#include <SuplaDevice.h>
#include <DallasTemperature.h>
#include <OneWire.h>
#include <supla/network/esp_wifi.h>
#include <supla/sensor/DS18B20.h>
#include <supla/sensor/virtual_thermometer.h>
#include <supla/device/supla_ca_cert.h>
// This program is designed to create a differential thermometer.
// It calculates the temperature difference based on readings from two thermometers DS18B20 at pin D5
// and sends this value to the virtual thermometer channel.
// Network interface:
Supla::ESPWifi wifi("E______", "_______");
// Channels DS + virtual thermometer
Supla::Sensor::DS18B20 *tt1 = nullptr;
Supla::Sensor::DS18B20 *tt2 = nullptr;
Supla::Sensor::VirtualThermometer *vterm = nullptr;
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] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
// Replace the following AUTHKEY with value that you can retrieve from: https://www.supla.org/arduino/get-authkey
char AUTHKEY[SUPLA_AUTHKEY_SIZE] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
// Channel 0-1 - Thermometers DS18B20 at PIN D5.
// Channel 3 - Virtual thermometer channel
// The DS18B20 thermometer addresses must be entered manually,
// or you can develop a function to automatically detect them.
DeviceAddress ds1addr = {0x28, 0xFA, 0xA3, 0x49, 0xF6, 0x96, 0x3C, 0x85};
DeviceAddress ds2addr = {0x28, 0xF1, 0x6D, 0x49, 0xF6, 0xE2, 0x3C, 0x70};
tt1 = new Supla::Sensor::DS18B20(D5, ds1addr);
tt2 = new Supla::Sensor::DS18B20(D5, ds2addr);
vterm = new Supla::Sensor::VirtualThermometer();
// Initial device and channels names
SuplaDevice.setName("Termometr różnicowy");
tt1->setInitialCaption("Temperatura WY");
tt2->setInitialCaption("Temperatura WE");
vterm->setInitialCaption("∆Temp");
vterm->setValue(tt1->getTemp()-tt2->getTemp());
// Configure defualt Supla CA certificate
SuplaDevice.setSuplaCACert(suplaCACert);
SuplaDevice.setSupla3rdPartyCACert(supla3rdCACert);
SuplaDevice.begin(GUID, // Global Unique Identifier
"svrxx.supla.org", // SUPLA server address
"[email protected]", // Email address used to login to Supla Cloud
AUTHKEY); // Authorization key
}
void loop() {
SuplaDevice.iterate();
vterm->setValue(tt1->getTemp()-tt2->getTemp());
}
-
jaros12
- Posts: 41
- Joined: Sat Feb 22, 2020 12:03 pm
- Location: Warszawa
Z tym termometrem różnicowym to nie było jakoś specjalnie skomplikowane. Przypadkowo trafiłem w wyszukiwarce na temat i aż wygrzebałem swój prototyp wskaźnika mocy do CO . Supla w wersji 23, początek 2023r. Może wreszcie podłączę przepływomierz żeby sprawdzić, bo w testach udawał go generator 555. Soft chwilowo jedynie w ESP, ale jeśli będzie działało z przepływomierzem to poszukam źródła... Może do kolejnej zimy się udaRafalg wrote: Wed Jan 08, 2025 11:20 pm No i proszę:
Jedno szkolenie/spotkanie online. Kilka godzin dłubania i jest termometr róznicowy. Niesamowite. Działa.
Jeszcze tylko interface webowy (o ile się da) do ustawiania warunkowania i rzecz "niemożliwa" będzie zrobiona.
Dziękuję wszystkim powyżej, i prowadzącym wczoraj szkolenie, za pomoc i wskazanie drogi.
You do not have the required permissions to view the files attached to this post.
-
Rafalg
- Posts: 21
- Joined: Fri Jan 03, 2025 9:06 pm
Teraz już faktycznie temat prosty, ale na początku nie wiedziałem jak się zabrać. Teraz próbuję wpleść termometr różnicowy do GUI Generic i uwzględnić w warunkowaniu. Jestem ciekawy źródeł Twojego wskaźnika mocy.jaros12 wrote: Sun Mar 09, 2025 11:28 pm Z tym termometrem różnicowym to nie było jakoś specjalnie skomplikowane. Przypadkowo trafiłem w wyszukiwarce na temat i aż wygrzebałem swój prototyp wskaźnika mocy do CO . Supla w wersji 23, początek 2023r. Może wreszcie podłączę przepływomierz żeby sprawdzić, bo w testach udawał go generator 555. Soft chwilowo jedynie w ESP, ale jeśli będzie działało z przepływomierzem to poszukam źródła... Może do kolejnej zimy się uda![]()
-
jaros12
- Posts: 41
- Joined: Sat Feb 22, 2020 12:03 pm
- Location: Warszawa
Kodu aktualnie nie mam, muszę gdzieś na dyskach poszukać, choć to i tak tylko moja amatorska twórczość, niekoniecznie poprawna. Sam termometr miałem coś takiego, znalazłem bo sobie kiedyś mailem przesłałem kopię (pewnie kod można troche wyczyścić , bo to jakaś wersja w trakcie zmian), w każdym razie po skompilowaniu na Supli 23.2.0 działa. A co do reszty to licznik impulsów + przeliczanie energii cieplnej wg wzoru i wyświetlanie wyniku w Supli (podobnie jak temperatury)Rafalg wrote: Mon Mar 10, 2025 9:56 am
Teraz już faktycznie temat prosty, ale na początku nie wiedziałem jak się zabrać. Teraz próbuję wpleść termometr różnicowy do GUI Generic i uwzględnić w warunkowaniu. Jestem ciekawy źródeł Twojego wskaźnika mocy.
Code: Select all
/*
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.
*/
#define STATUS_LED_GPIO 4
#define BUTTON_CFG_RELAY_GPIO 0
#include <SuplaDevice.h>
#include <supla/network/esp_wifi.h>
#include <supla/sensor/thermometer.h>
#include <OneWire.h>
#include <DallasTemperature.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/network/html/custom_text_parameter.h>
#include <supla/device/supla_ca_cert.h>
#include <supla/events.h>
#include <supla/storage/eeprom.h>
Supla::Eeprom eeprom;
// #include <supla/storage/fram_spi.h>
// Supla::FramSpi fram(STORAGE_OFFSET);
Supla::ESPWifi wifi;
Supla::LittleFsConfig configSupla;
Supla::Device::StatusLed statusLed(STATUS_LED_GPIO, true);
Supla::EspWebServer suplaServer;
Supla::Html::DeviceInfo htmlDeviceInfo(&SuplaDevice);
Supla::Html::WifiParameters htmlWifi;
Supla::Html::ProtocolParameters htmlProto;
Supla::Html::StatusLedParameters htmlStatusLed;
#define ONE_WIRE_BUS 2
#define TEMPERATURE_PRECISION 12
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress insideThermometer, outsideThermometer;
class VirtualThermometer : public Supla::Sensor::Thermometer {
public:
double getValue() override {
return myValue;
}
void setValue(double val) {
myValue = val;
}
protected:
double myValue = TEMPERATURE_NOT_AVAILABLE;
};
auto t1 = new VirtualThermometer;
auto t2 = new VirtualThermometer;
auto t3 = new VirtualThermometer;
double tdiff;
void setup() {
Serial.begin(9600);
SuplaDevice.setSuplaCACert(suplaCACert);
SuplaDevice.setSupla3rdPartyCACert(supla3rdCACert);
SuplaDevice.begin(); // Authorization key
sensors.begin();
sensors.setResolution(insideThermometer, TEMPERATURE_PRECISION);
sensors.setResolution(outsideThermometer, TEMPERATURE_PRECISION);
}
void loop() {
tdiff = (sensors.getTempCByIndex(0)*100-sensors.getTempCByIndex(1)*100);
SuplaDevice.iterate();
sensors.requestTemperatures();
t1->setValue(sensors.getTempCByIndex(0));
t2->setValue(sensors.getTempCByIndex(1));
t3->setValue(tdiff/100);
}
