Początki programowania - potrzebna pomoc

hanuer
Posts: 79
Joined: Tue Jan 07, 2020 1:10 am

Post

Na esp-01s mam podłączone przekaznik do IO0, termometr do IO3. Chciałbym dodać przycisk monostabilny do IO2 ale nie wiem jak.
to co mam do tej pory nie działa. Wyświetla sie w cloudzie ale ds nie pokazuje wartości a przekaźnik nie reaguje. Pewnie czegoś brakuje w kodzie. Prosze o pomoc.
SuplaDevice - develop:
https://github.com/SUPLA/arduino/tree/develop/libraries

Code: Select all

#include <SPI.h>
#include <SuplaDevice.h>

// Add include to DS sensor
#include <supla/sensor/DS18B20.h>

// ESP8266 based board:
#include <supla/network/esp_wifi.h>
Supla::ESPWifi wifi("ppp", "ppp");

void setup() {

  Serial.begin(9600);

  // Replace the falowing GUID with value that you can retrieve from https://www.supla.org/arduino/get-guid
  char GUID[SUPLA_GUID_SIZE] = {ppp};

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

  // CHANNEL0 - RELAY
  SuplaDevice.addRelay(0, true);           // 0 - Pin number where the relay is connected      
                                      // Call SuplaDevice.addRelay(44, true) with an extra "true" parameter 
                                      // to enable "port value inversion"
                                      // where HIGH == LOW, and LOW == HIGH   

  new Supla::Sensor::DS18B20(3);

  SuplaDevice.begin(GUID,              // Global Unique Identifier 
                    "ppp",  // SUPLA server address
                    "ppp",   // Email address used to login to Supla Cloud
                    AUTHKEY);          // Authorization key
    
}

void loop() {
  SuplaDevice.iterate();
}
krycha88
Posts: 5575
Joined: Fri Nov 16, 2018 7:25 am
Been thanked: 5 times

Post

https://gui-generic-builder.supla.io/
hanuer
Posts: 79
Joined: Tue Jan 07, 2020 1:10 am

Post

Super dzięki. Przekaźnik działa, przycisk działa. DS w apce nic nie pokazuje a w cloudzie wartość -275. O co chodzi?

Code: Select all

#include <SPI.h>
#include <SuplaDevice.h>
#include <supla/control/relay.h>
#include <supla/control/button.h>
#include <supla/sensor/DS18B20.h> // Add include to DS sensor
#include <supla/network/esp_wifi.h>// ESP8266 based board:

Supla::ESPWifi wifi("ppp", "ppp");
Supla::Control::Relay relay(0);
Supla::Control::Button button(2, true);

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] = {ppp};

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

  button.willTrigger(relay, Supla::Control::Button::ON_RELEASE, Supla::Control::Relay::TOGGLE);

  new Supla::Sensor::DS18B20(3);

  SuplaDevice.begin(GUID,              // Global Unique Identifier 
                    "ppp",  // SUPLA server address
                    "ppp",   // Email address used to login to Supla Cloud
                    AUTHKEY);          // Authorization key
    
}

void loop() {
  SuplaDevice.iterate();
}
hanuer
Posts: 79
Joined: Tue Jan 07, 2020 1:10 am

Post

Źle podłączony czujnik temp...
Jak nadać urządzeniu własną nazwę?
User avatar
Goral64
Posts: 3258
Joined: Fri Dec 27, 2019 6:22 pm
Location: Żerniki Wrocławskie
Has thanked: 2 times
Been thanked: 1 time

Post

hanuer wrote: Wed Jun 17, 2020 6:51 pm Źle podłączony czujnik temp...
Jak nadać urządzeniu własną nazwę?

Code: Select all

		SuplaDevice.setName("DEVICE NAME");
Widzimy się na Supla Offline Party Season 2026 :D

Image
zsezse
Posts: 13
Joined: Fri Jun 01, 2018 8:29 am

Post

Cześć.
Czy ktoś może podpowiedzieć mi gdzie i co powinienem zmienić aby wpis przy LAST STATE nie dublował się? Z góry dziękuję.
You do not have the required permissions to view the files attached to this post.
krycha88
Posts: 5575
Joined: Fri Nov 16, 2018 7:25 am
Been thanked: 5 times

Post

zsezse wrote: Thu Jun 25, 2020 8:08 pm Cześć.
Czy ktoś może podpowiedzieć mi gdzie i co powinienem zmienić aby wpis przy LAST STATE nie dublował się? Z góry dziękuję.
A co to za soft lub skąd masz kod?
https://gui-generic-builder.supla.io/
zsezse
Posts: 13
Joined: Fri Jun 01, 2018 8:29 am

Post

Oryginalny soft 2.7.16 bez przeróbek kompilowany w Dockerze. I nieważne czy kompiluję wifisocket, gate_module, czy coś innego. Zawsze wpis LAST STATE dubluje się.
User avatar
pzygmunt
Posts: 20302
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków
Been thanked: 59 times

Post

To jest poprawne zachowanie. Od którejś wersji wprowadziłem zmianę, która dopisuje do historii kolejny stan zamiast nadpisywanie całość. Dzięki temu można lepiej wyłapać co się dzieje.
SUPLA.... Nareszcie w domu.

Return to “Pomoc”