Aktualizacja SuplaDevice

User avatar
klew
Posts: 13911
Joined: Thu Jun 27, 2019 12:16 pm
Location: Wrocław
Has thanked: 135 times
Been thanked: 137 times

Post

Na moim branchu jest już dostępna wersja biblioteki z sensorami DS z poprawkami (doszło sprawdzanie czy odczyt jest poprawny i ignorowanie niepoprawnych odczytów przy 3 kolejnych próbach)
Dodałem też wsparcie dla czujników DHT (można dodawać dowolną ilość czujników na dowolnych pinach przy pomocy jednej linijki kodu).
Najlepsze suple dla Twojego domu :mrgreen:
Yepestis
Posts: 890
Joined: Mon Sep 24, 2018 6:08 pm
Location: Wrocław
Has thanked: 19 times
Been thanked: 3 times

Post

Tak się zastanawiam czy w ramach aktualizacji biblioteki, dało by radę dorzucić skanowanie dostępnych sieci na stronie konfiguracyjnej. Tak żeby nie trzeba było wpisywać z palca SSID, które niekiedy bywa dość długie i skomplikowane.

Chodzi mi o coś na ten wzór viewtopic.php?p=32705#p32705
User avatar
klew
Posts: 13911
Joined: Thu Jun 27, 2019 12:16 pm
Location: Wrocław
Has thanked: 135 times
Been thanked: 137 times

Post

Yepestis wrote: Tue Jan 07, 2020 6:44 pm Tak się zastanawiam czy w ramach aktualizacji biblioteki, dało by radę dorzucić skanowanie dostępnych sieci na stronie konfiguracyjnej. Tak żeby nie trzeba było wpisywać z palca SSID, które niekiedy bywa dość długie i skomplikowane.

Chodzi mi o coś na ten wzór viewtopic.php?p=32705#p32705
Biblioteka jak na razie w ogóle nie zawiera żadnego GUI i takie nie jest na chwilę obecną planowane.
Tego typu GUI bardziej widzę jako osobną bibliotekę, albo całą aplikację, dla osób, które nie chcą się bawić w programowanie - coś jak Primary GUI (v2).
Najlepsze suple dla Twojego domu :mrgreen:
krycha88
Posts: 5575
Joined: Fri Nov 16, 2018 7:25 am
Been thanked: 5 times

Post

czy ktoś próbował odpalić tą bibliotekę na ESP?

Ja dostaję ciągle krzaki

Code: Select all

ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v951aeffa
~ld
@⸮R-nP⸮M%⸮͇	%Y)Q
	⸮ox⸮Tͳ⸮
⸮C-))⸮H⸮⸮⸮⸮L⸮C⸮	I⸮VX-aҭ
odkomentowałem tylko, czy coś jeszcze trzeba zrobić aby to ruszyło?

Code: Select all

 #include <supla/network/esp_wifi.h>
 Supla::ESPWifi wifi("xxx", "xxx");
https://gui-generic-builder.supla.io/
User avatar
klew
Posts: 13911
Joined: Thu Jun 27, 2019 12:16 pm
Location: Wrocław
Has thanked: 135 times
Been thanked: 137 times

Post

Trzeba jeszcze zakonentować linie kodu odpowiedzenie za sieć z Ethernet shield.

Który przykład odpalasz?
Ja u siebie cały czas na wemosie ostatnio pracuję.
Jest jeszcze jedna ważna rzecz, o której zapomniałem napisać. Te nowe sensory muszą być dodane jako ostanie, bo inaczej nie będzie działać (tzn najpierw te tradycyjne kanały, a potem te nowe)
Najlepsze suple dla Twojego domu :mrgreen:
krycha88
Posts: 5575
Joined: Fri Nov 16, 2018 7:25 am
Been thanked: 5 times

Post

ok namierzyłem :)

jak dodasz dwa czujniki to ESP nie wstaje

Code: Select all

  SuplaDevice.addSensorNO(5); // 5 - Pin number where the sensor is connected
  SuplaDevice.addSensorNO(6); // 6 - Pin number where the sensor is connected
EDIT:
kolejna zagwozdka :D urządzenie nie chce mi się zarejestrować do clouda ciągle wisi na Current status: Register in progress

Code: Select all

Using protocol version 8
Current status: SuplaDevice initialized
wifi Station disconnected
wifi Station disconnected
local IP: 192.168.1.103
subnetMask: 255.255.255.0
gatewayIP: 192.168.1.1
Signal Strength (RSSI): -70 dBm
Current status: Not connected
Establishing connection with: svr19.supla.org (port: 2015)
Connected
Current status: Register in progress
srpc_ds_async_registerdevice_d: 1
Current status: Not connected
Establishing connection with: svr19.supla.org (port: 2015)
Connected
Current status: Register in progress
srpc_ds_async_registerdevice_d: 2
dodałałem Serial.print("srpc_ds_async_registerdevice_d: ");Serial.println(result)
https://github.com/klew/arduino/blob/47 ... .cpp#L1380

moje urządzenie to nodemcu v3 kompiluje wg ustawień jak w zał.
You do not have the required permissions to view the files attached to this post.
Last edited by krycha88 on Tue Jan 07, 2020 9:20 pm, edited 1 time in total.
https://gui-generic-builder.supla.io/
User avatar
klew
Posts: 13911
Joined: Thu Jun 27, 2019 12:16 pm
Location: Wrocław
Has thanked: 135 times
Been thanked: 137 times

Post

Pokaż cały kod
Najlepsze suple dla Twojego domu :mrgreen:
krycha88
Posts: 5575
Joined: Fri Nov 16, 2018 7:25 am
Been thanked: 5 times

Post

klew wrote: Tue Jan 07, 2020 9:18 pmPokaż cały kod
zostawiłem tylko rzeczy które wydają się potrzebne. Jak dodam tylko przekaźnik lub jeden czujnik to jest ok. Problem pojawia się wg kodu poniżej

A spotkałeś się z problemem o którym napisałem wyżej??

Code: Select all

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

/*
   This example requires Dallas Temperature Control library installed.
   https://github.com/milesburton/Arduino-Temperature-Control-Library
*/
// Add include to DS sensor
//#include <supla/sensor/DS18B20.h>


// Choose proper network interface for your card:
// Arduino Mega with EthernetShield W5100:
//#include <supla/network/ethernet_shield.h>
// Ethernet MAC address
uint8_t mac[6] = {0x56, 0x53, 0x61, 0x89, 0x4a, 0x28};
//Supla::EthernetShield ethernet(mac);
//
// Arduino Mega with ENC28J60:
// #include <supla/network/ENC28J60.h>
// Supla::ENC28J60 ethernet(mac);
//
// ESP8266 based board:
#include <supla/network/esp_wifi.h>
Supla::ESPWifi wifi("xxx", "xxx");


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] = {0xAA,0x0F,0x15,0x29,0x8E,0xB2,0x59,0x73,0xC2,0x41,0xD5,0x38,0x1B,0x92,0xA5,0xCB};

  // Replace the following AUTHKEY with value that you can retrieve from: https://www.supla.org/arduino/get-authkey
  char AUTHKEY[SUPLA_AUTHKEY_SIZE] = {0x34,0x50,0x53,0x0D,0xB8,0x32,0x53,0x51,0xE3,0xB3,0xAD,0x46,0x83,0x48,0x33,0xD6};

  /*
     Having your device already registered at cloud.supla.org,
     you want to change CHANNEL sequence or remove any of them,
     then you must also remove the device itself from cloud.supla.org.
     Otherwise you will get "Channel conflict!" error.
  */

  // CHANNEL0 - RELAY
  //SuplaDevice.addRelay(44, true);           // 44 - 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

  // CHANNEL1 - RELAY
  //SuplaDevice.addRelay(45, true);           // 45 - Pin number where the relay is connected

  // CHANNEL3 - TWO RELAYS (Roller shutter operation)
 // SuplaDevice.addRollerShutterRelays(46,     // 46 - Pin number where the 1st relay is connected
 //                                    47, true);    // 47 - Pin number where the 2nd relay is connected

  // CHANNEL4 - Opening sensor (Normal Open)
  SuplaDevice.addSensorNO(5); // 5 - Pin number where the sensor is connected
  // Call SuplaDevice.addSensorNO(A0, true) with an extra "true" parameter
  // to enable the internal pull-up resistor


  // CHANNEL5 - Opening sensor (Normal Open)
  SuplaDevice.addSensorNO(6); // 6 - Pin number where the sensor is connected


  // CHANNEL6-9 - Thermometer DS18B20
  // 4 DS18B20 thermometers at pin 23. DS address can be omitted when there is only one device at a pin
 /* DeviceAddress ds1addr = {0x28, 0xFF, 0xC8, 0xAB, 0x6E, 0x18, 0x01, 0xFC};
  DeviceAddress ds2addr = {0x28, 0xFF, 0x54, 0x73, 0x6E, 0x18, 0x01, 0x77};
  DeviceAddress ds3addr = {0x28, 0xFF, 0x55, 0xCA, 0x6B, 0x18, 0x01, 0x8D};
  DeviceAddress ds4addr = {0x28, 0xFF, 0x4F, 0xAB, 0x6E, 0x18, 0x01, 0x66};

  new Supla::Sensor::DS18B20(23, ds1addr);
  new Supla::Sensor::DS18B20(23, ds2addr);
  new Supla::Sensor::DS18B20(23, ds3addr);
  new Supla::Sensor::DS18B20(23, ds4addr);
/*

  /*
     SuplaDevice Initialization.
     Server address, LocationID and LocationPassword are available at https://cloud.supla.org
     If you do not have an account, you can create it at https://cloud.supla.org/account/create
     SUPLA and SUPLA CLOUD are free of charge

  */

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

}

void loop() {
  SuplaDevice.iterate();
}
https://gui-generic-builder.supla.io/
User avatar
klew
Posts: 13911
Joined: Thu Jun 27, 2019 12:16 pm
Location: Wrocław
Has thanked: 135 times
Been thanked: 137 times

Post

krycha88 wrote: Tue Jan 07, 2020 9:27 pm zostawiłem tylko rzeczy które wydają się potrzebne. Jak dodam tylko przekaźnik lub jeden czujnik to jest ok. Problem pojawia się wg kodu poniżej

A spotkałeś się z problemem o którym napisałem wyżej??
Mi też się crash'owało. Zmieniłem piny 5 i 6 na D5, D6 i działa ;).
Najlepsze suple dla Twojego domu :mrgreen:
bigthomas
Posts: 235
Joined: Mon Aug 12, 2019 3:35 pm

Post

Czy budowaną biblioteka będzie można wykorzystać do ESP-32S czy raczej tylko ArduinoMEGA i Arduino które mają ESP8266/ESP828 (np.WEMOS, NodeMCUv3) ?

Return to “Arduino IDE”