DHT22 -> ESP8266 (ESP-01) <=Wlan=> Mosquitto <- Fhem <- MQTT <- MQTT_Device

Begonnen von Papaloewe, 28 März 2015, 19:52:13

Vorheriges Thema - Nächstes Thema

LarsMie

Ich habe mittlerweile bei mir den testaufbau ans laufen bekommen,

der esp steuert eine LED und ich kann in fhem mit dem set befehl die led an und ausschalten. als readings habe ich "set" und "status"



kann mir vielleicht jetzt einer erklären, wie ich einen button anlege, der als lichtschalter fungiert und gleichzeitig den status des device anzeigt?

Ich komme irgendwie nicht zu einem Ergebnis. Ich habe ein devstateicon angelegt, allerdings weiss ich nicht wie ich die readings so definieren kann, dass diese im button angezeigt werden. das selbe mit umschalten, wie bekomme ihc den button so hin, dass dieser einen "set"-befehl ausführt, wenn ich diesen anklicke

KaiK

Hallo zusammen,

ich wollte das auch mal ausprobieren. Habe die aktuelle staging Version der Arduino ESP Addons installiert und die Libraries aus den ZIP Files von  John. Bekomme folgende Fehlermeldung. Diese kann man auch so (ähnlich) im Bugtracker der ESP Addons finden, steht dort aber als solved.
Hatte das jemand von euch und wenn ja, wie habt ihr das gelöst?

VG
Kai


Arduino: 1.6.5 (Windows 7), Platine: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)"

In file included from ESPDHT22FHEM.ino:16:0:
C:\Users\abc\Documents\Arduino\libraries\PubSubClient/PubSubClient.h:68:46: error: section attribute not allowed for '<anonymous>'
    boolean publish_P(char *, uint8_t PROGMEM *, unsigned int, boolean);
                                              ^
ESPDHT22FHEM.ino: In function 'void processDHT()':
ESPDHT22FHEM:157: error: 'max' was not declared in this scope
ESPDHT22FHEM.ino:157:65: note: suggested alternative:
In file included from c:\users\abc\appdata\roaming\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2\xtensa-lx106-elf\include\c++\4.8.2\memory:62:0,
                 from C:\Users\abc\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1160-gef26c5f\libraries\ESP8266WiFi\src/WiFiClient.h:28,
                 from C:\Users\abc\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1160-gef26c5f\libraries\ESP8266WiFi\src/ESP8266WiFi.h:32,
                 from ESPDHT22FHEM.ino:11:
c:\users\abc\appdata\roaming\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algobase.h:260:5: note:   'std::max'
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
ESPDHT22FHEM.ino: In function 'void mqttCallback(char*, byte*, unsigned int)':
ESPDHT22FHEM:214: error: 'min' was not declared in this scope
ESPDHT22FHEM.ino:214:37: note: suggested alternative:
In file included from c:\users\abc\appdata\roaming\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2\xtensa-lx106-elf\include\c++\4.8.2\memory:62:0,
                 from C:\Users\abc\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1160-gef26c5f\libraries\ESP8266WiFi\src/WiFiClient.h:28,
                 from C:\Users\abc\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.5-1160-gef26c5f\libraries\ESP8266WiFi\src/ESP8266WiFi.h:32,
                 from ESPDHT22FHEM.ino:11:
c:\users\abc\appdata\roaming\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algobase.h:239:5: note:   'std::min'
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
'max' was not declared in this scope
FHEM auf Raspberry Pi, HM-CFG-LAN, 3x HM-CC-RT-DN
Testbed: Arduino Mega 2560 mit Config. Firmata als Sensor/Aktuator

Wzut

ja min und max waren bei mir auch noch unbekannt , setze einfach ans Ende zwei Zeilen :

int min(int x, int y)  {if (x<y) return x; else return y;}
int max(int x, int y) {if (x>y) return x; else return y;}
Maintainer der Module: MAX, MPD, UbiquitiMP, UbiquitiOut, SIP, BEOK, readingsWatcher

JoWiemann

Hallo,

habe nun auch den BME280 integriert. Der kann Luftfeuchte, Temperatur und Luftdruck. Anbei auch die BME Library etwas angepasst, da ich beim kompilieren immer Fehler mit SPI.h bekommen habe.

Grüße Jörg
Jörg Wiemann

Slave: RPi B+ mit 512 MB, COC (868 MHz), CUL V3 (433.92MHz SlowRF); FHEMduino, Aktuelles FHEM

Master: CubieTruck; Debian; Aktuelles FHEM

PeMue

Zitat von: JoWiemann am 09 Oktober 2015, 13:42:53
... habe nun auch den BME280 integriert. Der kann Luftfeuchte, Temperatur und Luftdruck.
Hast Du dafür ein Break-Out Board?

Gruß PeMue
RPi3Bv1.2 rpiaddon 1.66 6.0 1xHM-CC-RT-DN 1.4 1xHM-TC-IT-WM 1.1 2xHB-UW-Sen-THPL-O 0.15 1x-I 0.14OTAU  1xCUNO2 1.67 2xEM1000WZ 2xUniroll 1xASH2200 3xHMS100T(F) 1xRFXtrx 90 1xWT440H 3xTFA30.3150 5xFA21
RPi1Bv2 LCDCSM 1.63 5.8 2xMAX HKT 1xMAX RT V200KW1 Heizung Wasser

JoWiemann

Jörg Wiemann

Slave: RPi B+ mit 512 MB, COC (868 MHz), CUL V3 (433.92MHz SlowRF); FHEMduino, Aktuelles FHEM

Master: CubieTruck; Debian; Aktuelles FHEM

KaiK

Hallo zusammen,

weiß jemand von euch, wie ich (bei Nutzung der Arduino IDE) die blaue LED auf dem NodeMCU bzw ESP Modul deaktivieren kann?
Die wird ja nicht aktiv im Code angesteuert, sondern scheint intern im ESP geregelt zu sein...

VG
Kai
FHEM auf Raspberry Pi, HM-CFG-LAN, 3x HM-CC-RT-DN
Testbed: Arduino Mega 2560 mit Config. Firmata als Sensor/Aktuator

Wzut

Zitat von: KaiK am 24 November 2015, 21:29:35
weiß jemand von euch, wie ich (bei Nutzung der Arduino IDE) die blaue LED auf dem NodeMCU bzw ESP Modul deaktivieren kann?
Ja, kein Serial.print benutzen :) bzw. mit digitalWrite(BUILTIN_LED, HIGH)
Schau dir mal von den Beispielen den Blink Sketch an :
/*
ESP8266 Blink by Simon Peter
Blink the blue LED on the ESP-01 module
This example code is in the public domain

The blue LED on the ESP-01 module is connected to GPIO1
(which is also the TXD pin; so we cannot use Serial.print() at the same time)

Note that this sketch uses BUILTIN_LED to find the pin with the internal LED
*/

void setup() {
  pinMode(BUILTIN_LED, OUTPUT);     // Initialize the BUILTIN_LED pin as an output
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(BUILTIN_LED, LOW);   // Turn the LED on (Note that LOW is the voltage level
                                    // but actually the LED is on; this is because
                                    // it is acive low on the ESP-01)
  delay(1000);                      // Wait for a second
  digitalWrite(BUILTIN_LED, HIGH);  // Turn the LED off by making the voltage HIGH
  delay(2000);                      // Wait for two seconds (to demonstrate the active low LED)
}
Maintainer der Module: MAX, MPD, UbiquitiMP, UbiquitiOut, SIP, BEOK, readingsWatcher

a_quadrat

Zitatja min und max waren bei mir auch noch unbekannt , setze einfach ans Ende zwei Zeilen :
Code: [Auswählen]
int min(int x, int y)  {if (x<y) return x; else return y;}
int max(int x, int y) {if (x>y) return x; else return y;}

min und max ist bei mir auch nicht bekannt, an welche Stelle muss der Code genau?

Wzut

da in meinem Bsp min und max zwei ganz normale Funktionen sind kannst du sie hinsetzen wo du willst.
D.h. vor die anderen , zwischen zwei andere oder eben wie von mir vorgschlagen ganz ans Ende :)
Maintainer der Module: MAX, MPD, UbiquitiMP, UbiquitiOut, SIP, BEOK, readingsWatcher

a_quadrat

hab ich probiert, aber es hat nicht funktioniert.
Mir ist gerade aufgefallen, sind Klammer und Semikolon vertauscht?

mfg Andreas

a_quadrat

ich habe jetzt alle Stellen ausprobiert, leider ohne Erfolg. Hier mal der Ausschnitt aus meinem Sketch:

bool relVal;
bool relaisReq;
unsigned long RelaisWaiter;

int min(int x, int y) {if (x<y) return x; else return y;}
int max(int x, int y) {if (x>y) return x; else return y;}


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



   Serial.println("DHT22 Demo starts...");


Wo liegt der Fehler?

Gruß Andreas

Wzut

Maintainer der Module: MAX, MPD, UbiquitiMP, UbiquitiOut, SIP, BEOK, readingsWatcher

a_quadrat

Hallo,

das ist die Fehlermeldung:

Arduino: 1.6.6 (Windows 7), Board: "Generic ESP8266 Module, Serial, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), ck"

ESPDHT22FHEM:95: error: '_Tp' does not name a type

int min(int x, int y) {if (x<y) return x; else return y;}

               ^

ESPDHT22FHEM:95: error: ISO C++ forbids declaration of '__a' with no type [-fpermissive]

int min(int x, int y) {if (x<y) return x; else return y;}

                    ^

ESPDHT22FHEM:95: error: '_Tp' does not name a type

int min(int x, int y) {if (x<y) return x; else return y;}

                               ^

ESPDHT22FHEM:95: error: ISO C++ forbids declaration of '__b' with no type [-fpermissive]

int min(int x, int y) {if (x<y) return x; else return y;}

                                    ^

ESPDHT22FHEM:95: error: expected constructor, destructor, or type conversion before ';' token

int min(int x, int y) {if (x<y) return x; else return y;}

                                        ^

ESPDHT22FHEM:96: error: '_Tp' does not name a type

int max(int x, int y) {if (x>y) return x; else return y;}

               ^

ESPDHT22FHEM:96: error: ISO C++ forbids declaration of '__a' with no type [-fpermissive]

int max(int x, int y) {if (x>y) return x; else return y;}

                    ^

ESPDHT22FHEM:96: error: '_Tp' does not name a type

int max(int x, int y) {if (x>y) return x; else return y;}

                               ^

ESPDHT22FHEM:96: error: ISO C++ forbids declaration of '__b' with no type [-fpermissive]

int max(int x, int y) {if (x>y) return x; else return y;}

                                    ^

ESPDHT22FHEM:96: error: expected constructor, destructor, or type conversion before ';' token

int max(int x, int y) {if (x>y) return x; else return y;}

                                        ^

ESPDHT22FHEM:97: error: '_Tp' does not name a type



               ^

ESPDHT22FHEM:97: error: ISO C++ forbids declaration of '__a' with no type [-fpermissive]



                    ^

ESPDHT22FHEM:97: error: '_Tp' does not name a type



                               ^

ESPDHT22FHEM:97: error: ISO C++ forbids declaration of '__b' with no type [-fpermissive]



                                    ^

ESPDHT22FHEM:97: error: '_Compare' has not been declared



                                         ^

ESPDHT22FHEM:97: error: expected constructor, destructor, or type conversion before ';' token



                                                         ^

ESPDHT22FHEM:98: error: '_Tp' does not name a type

void setup() {

               ^

ESPDHT22FHEM:98: error: ISO C++ forbids declaration of '__a' with no type [-fpermissive]

void setup() {

                    ^

ESPDHT22FHEM:98: error: '_Tp' does not name a type

void setup() {

                               ^

ESPDHT22FHEM:98: error: ISO C++ forbids declaration of '__b' with no type [-fpermissive]

void setup() {

                                    ^

ESPDHT22FHEM:98: error: '_Compare' has not been declared

void setup() {

                                         ^

ESPDHT22FHEM:98: error: expected constructor, destructor, or type conversion before ';' token

void setup() {

                                                         ^

exit status 1
'_Tp' does not name a type

  Dieser Report hätte mehr Informationen mit
  "Ausführliche Ausgabe während der Kompilierung"
  aktiviert in Datei > Einstellungen.


Ich hoffe du kannst mir weiter helfen.

mfg Andreas

Wzut

Zitat von: anco1726 am 08 Dezember 2015, 23:02:50
Arduino: 1.6.6 (Windows 7)
hmmm , ich verwende die 1.6.5 unter Linux und habe deine Fehlermeldung auch in ähnlicher Form, allerdings "nur" als Warnung. Ich deute das so das die eigenen min & max Funktion mit den inzwischen gefixten internen min, max Funktionen kollidieren.
Versuche doch einfach mal die beiden eigenen Funktionen umzubenennen (z.B in mymin und mymax)  und diese Namen dann in den jeweiligen Aufrufen im Sketch zu benutzen.
Maintainer der Module: MAX, MPD, UbiquitiMP, UbiquitiOut, SIP, BEOK, readingsWatcher