Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. NODEmcu K-Type Temp-Fühler in IObroker !? [gelöst]

    NEWS

    • [erledigt] 15. 05. Wartungsarbeiten am ioBroker Forum

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    NODEmcu K-Type Temp-Fühler in IObroker !? [gelöst]

    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      MCU @Qax1 last edited by MCU

      @qax1 40cbfa67-2e7c-4973-af2f-898878a3c695-image.png
      Punkt hinter dem "h" ist falsch.
      Ansonsten nimm meine MQTT.h

      1 Reply Last reply Reply Quote 1
      • M
        MCU last edited by

        Du musst das Semikolon hier entfernen nach dem define:
        34f2f570-dc92-40ec-ac5e-b79c792dc32a-image.png

        Q 1 Reply Last reply Reply Quote 1
        • Q
          Qax1 @MCU last edited by

          @mcu

          Jetzt kommt der Fehler :

          Arduino: 1.8.13 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, WIFI, Only Sketch, 115200"

          MQTT-TEST-1:25:1: error: 'MQTTClient' does not name a type

          MQTTClient client;

          ^

          C:\Users\Stefan\Documents\Arduino\MQTT-TEST-1\MQTT-TEST-1.ino: In function 'void connect()':

          MQTT-TEST-1:34:12: error: 'client' was not declared in this scope

          while (!client.connect(client_name,"MQTTUser","MQTTPassword")) {
          
                  ^
          

          MQTT-TEST-1:40:4: error: 'client' was not declared in this scope

          client.subscribe(client_name + "/+");
          
          ^
          

          MQTT-TEST-1:40:35: error: invalid operands of types 'const char [10]' and 'const char [3]' to binary 'operator+'

          client.subscribe(client_name + "/+");
          
                                         ^
          

          MQTT-TEST-1:41:33: error: invalid operands of types 'const char [10]' and 'const char [7]' to binary 'operator+'

          client.publish(client_name + "/alive","true");
          
                                       ^
          

          C:\Users\Stefan\Documents\Arduino\MQTT-TEST-1\MQTT-TEST-1.ino: In function 'void setup()':

          MQTT-TEST-1:59:2: error: 'client' was not declared in this scope

          client.begin("http://192.168.178.30",1883,net); //192.168.178.45

          ^

          C:\Users\Stefan\Documents\Arduino\MQTT-TEST-1\MQTT-TEST-1.ino: In function 'void loop()':

          MQTT-TEST-1:75:5: error: 'client' was not declared in this scope

           client.publish(client_name + "/InternalTemp",String(c));
          
           ^
          

          MQTT-TEST-1:75:34: error: invalid operands of types 'const char [10]' and 'const char [14]' to binary 'operator+'

           client.publish(client_name + "/InternalTemp",String(c));
          
                                        ^
          

          MQTT-TEST-1:77:3: error: 'client' was not declared in this scope

          client.loop();

          ^

          MQTT-TEST-1:81:6: error: 'werteCount' was not declared in this scope

            werteCount = 0;
          
            ^
          

          MQTT-TEST-1:86:35: error: invalid operands of types 'const char [10]' and 'const char [16]' to binary 'operator+'

            client.publish(client_name + "/connectProblem","Verbindungsproblem gehabt");
          
                                         ^
          

          exit status 1

          'MQTTClient' does not name a type

          Dieser Bericht wäre detaillierter, wenn die Option
          "Ausführliche Ausgabe während der Kompilierung"
          in Datei -> Voreinstellungen aktiviert wäre.

          1 Reply Last reply Reply Quote 0
          • M
            MCU last edited by MCU

            @qax1 Hast du jetzt meine MQTT genutzt? Und hast du das Semikolon entfernt?

            Hier darf nur die IP stehen:
            8171fb93-3b68-4946-b69f-6baa8c4201f3-image.png
            Also http:// weg

            Q 1 Reply Last reply Reply Quote 1
            • Q
              Qax1 @MCU last edited by

              @mcu

              Ich habe den PUNKT hinter dem h
              und den Semikolon weg gemacht.

              M 1 Reply Last reply Reply Quote 0
              • M
                MCU @Qax1 last edited by MCU

                @qax1 Dann entpack jetzt die Datei MQTT.7z und schieb den Ordner MQTT dann in Dokumente/Arduino.
                Und danach oben wieder auf MQTT.h ändern.

                Q 1 Reply Last reply Reply Quote 1
                • Q
                  Qax1 @MCU last edited by

                  @mcu
                  Ok... erledigt... jetzt kommt :

                  Arduino: 1.8.13 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, WIFI, Only Sketch, 115200"

                  C:\Users\Stefan\Documents\Arduino\MQTT-TEST-1\MQTT-TEST-1.ino: In function 'void connect()':

                  MQTT-TEST-1:40:35: error: invalid operands of types 'const char [10]' and 'const char [3]' to binary 'operator+'

                  client.subscribe(client_name + "/+");
                  
                                                 ^
                  

                  MQTT-TEST-1:41:33: error: invalid operands of types 'const char [10]' and 'const char [7]' to binary 'operator+'

                  client.publish(client_name + "/alive","true");
                  
                                               ^
                  

                  C:\Users\Stefan\Documents\Arduino\MQTT-TEST-1\MQTT-TEST-1.ino: In function 'void loop()':

                  MQTT-TEST-1:75:34: error: invalid operands of types 'const char [10]' and 'const char [14]' to binary 'operator+'

                   client.publish(client_name + "/InternalTemp",String(c));
                  
                                                ^
                  

                  MQTT-TEST-1:81:6: error: 'werteCount' was not declared in this scope

                    werteCount = 0;
                  
                    ^
                  

                  MQTT-TEST-1:86:35: error: invalid operands of types 'const char [10]' and 'const char [16]' to binary 'operator+'

                    client.publish(client_name + "/connectProblem","Verbindungsproblem gehabt");
                  
                                                 ^
                  

                  exit status 1

                  invalid operands of types 'const char [10]' and 'const char [3]' to binary 'operator+'

                  Dieser Bericht wäre detaillierter, wenn die Option
                  "Ausführliche Ausgabe während der Kompilierung"
                  in Datei -> Voreinstellungen aktiviert wäre.

                  Q 1 Reply Last reply Reply Quote 0
                  • Q
                    Qax1 @Qax1 last edited by

                    @MCU

                    Ich weiß nicht ob s was zu sagen hat,
                    aber ich habe in IObroker im MQTT-Adapter
                    keinen Namen / Passwort vergeben.

                    M 1 Reply Last reply Reply Quote 0
                    • M
                      MCU @Qax1 last edited by MCU

                      @mcu Eins nachdem anderen:

                      1. String MCUName = "SensorMax"; einfügen nach #define client_name
                      2. werteCount = 0; Zeile komplett löschen
                      3. bei client.subscribe(client_name : client_name durch MCUName ersetzen
                      4. und bei allen client.publish(client_name : client_name durch MCUName ersetzen
                      5. beim client.connect"MQTTUser","MQTTPassword" -> "",""
                      Q 1 Reply Last reply Reply Quote 0
                      • Q
                        Qax1 @MCU last edited by

                        @mcu

                        👍
                        Komplieren läuft jetzt komplett durch...

                        1 Reply Last reply Reply Quote 0
                        • M
                          MCU last edited by

                          @qax1 Dann schick mir mal das komplette Script.

                          Q 1 Reply Last reply Reply Quote 0
                          • Q
                            Qax1 @MCU last edited by Qax1

                            @mcu ```
                            #include <Wire.h>
                            #include <SPI.h>
                            #include "Adafruit_MAX31855.h"
                            #include <ESP8266WiFi.h>

                            #include <MQTT.h>

                            #define CLK 14 //connect CLK to GPIO14
                            #define CS 5 //connect CS to GPIO5
                            #define DO 12 //connect DO to GPIO12

                            #define client_name "SensorMAX"
                            String MCUName = "SensorMax";

                            const char ssid[] = "xyz";
                            const char pass[] = "xxxxxxxxxxxxxxxxx";
                            String Nachricht_MQTT = "";
                            String Topic_MQTT = "";

                            Adafruit_MAX31855 thermocouple(CLK,CS,DO);

                            WiFiClient net;
                            MQTTClient client;

                            void connect() {
                            Serial.print("\nchecking wifi...");
                            while (WiFi.status() != WL_CONNECTED) {
                            Serial.print(".");
                            delay(1000);
                            }
                            Serial.print("\nconnecting...");
                            while (!client.connect(client_name,"MQTTUser","MQTTPassword")) {
                            Serial.print(".");
                            delay(1000);
                            }
                            Serial.print("\nconnected!");

                            client.subscribe(MCUName + "/+");
                            client.publish(MCUName + "/alive","true");

                            }

                            void messageReceived(String &topic, String &payload) {
                            Serial.println("MQTT incoming: " + topic + " - " + payload);
                            Topic_MQTT = topic;
                            Nachricht_MQTT = payload;

                            topic = "";
                            payload = "";
                            }

                            void setup() {
                            Serial.begin(9600);
                            Serial.println("MAX31855 testing");
                            delay(500);
                            WiFi.begin(ssid, pass);
                            client.begin("192.168.178.30",1883,net); //192.168.178.45
                            connect(); //alive wird gesendet
                            client.onMessage(messageReceived);

                            }

                            void loop() {
                            Serial.print("Internal Temp = ");
                            Serial.println(thermocouple.readInternal());
                            delay(100);
                            double c = thermocouple.readCelsius();
                            if (isnan(c)) {
                            Serial.println("Something wrong with thermocouple!");
                            } else {
                            Serial.print("C = ");
                            Serial.println(c);
                            client.publish(MCUName + "/InternalTemp",String(c));
                            }
                            client.loop();
                            if (!client.connected()) {
                            Serial.println("Neustart!");
                            delay(200);
                            WiFi.begin(ssid, pass);
                            client.begin("http://192.168.178.30",1883,net);
                            connect(); //alive wird gesendet
                            client.onMessage(messageReceived);
                            client.publish(MCUName + "/connectProblem","Verbindungsproblem gehabt");
                            }
                            delay(1000);
                            }

                            M 1 Reply Last reply Reply Quote 0
                            • M
                              MCU @Qax1 last edited by MCU

                              @qax1 sagte in NODEmcu K-Type Temp-Fühler in IObroker !?:

                              Serial.print("\nconnecting...");
                              while (!client.connect(client_name,"MQTTUser","MQTTPassword")) {

                              Serial.print("\nconnecting...");
                              while (!client.connect(client_name,"MQTTUser","MQTTPassword")) {
                              

                              noch ändern -> "",""

                              Code-tags - erste Zeile frei lassen , sonst versteht er das nicht.

                              client.begin("http://192.168.178.30",1883,net); ->client.begin("192.168.178.30",1883,net);
                              das http:// entfernen

                              Q 1 Reply Last reply Reply Quote 0
                              • Q
                                Qax1 @MCU last edited by

                                @mcu
                                Ok... erledigt

                                M 1 Reply Last reply Reply Quote 0
                                • M
                                  MCU @Qax1 last edited by

                                  @qax1 Dann zeig nochmal, aber erste Zeile frei lassen-> Return und dann erst Code-Tag (</>).

                                  Q 1 Reply Last reply Reply Quote 0
                                  • Q
                                    Qax1 @MCU last edited by

                                    @mcu

                                    #include <Wire.h>
                                    #include <SPI.h>
                                    #include "Adafruit_MAX31855.h"
                                    #include <ESP8266WiFi.h>
                                    
                                    #include <MQTT.h>
                                    
                                    
                                    #define CLK 14          //connect CLK to GPIO14
                                    #define CS 5             //connect CS to GPIO5
                                    #define DO 12           //connect DO to GPIO12
                                    
                                    #define client_name "SensorMAX"
                                    String MCUName = "SensorMax";
                                    
                                    const char ssid[] = "xyz";
                                    const char pass[] = "xxxxxxxxxxxxxxxxxxx";
                                    String Nachricht_MQTT = "";
                                    String Topic_MQTT = "";
                                    
                                    
                                    
                                    Adafruit_MAX31855 thermocouple(CLK,CS,DO);
                                    
                                    WiFiClient net;
                                    MQTTClient client;
                                    
                                    void connect() {
                                       Serial.print("\nchecking wifi...");
                                       while (WiFi.status() != WL_CONNECTED) {
                                         Serial.print(".");
                                         delay(1000);
                                       }
                                       
                                       Serial.print("\nconnecting...");
                                       while (!client.connect(client_name,"MQTTUser","MQTTPassword")) {
                                         Serial.print(".");
                                         delay(1000);
                                       }
                                       
                                       Serial.print("\nconnected!");
                                        
                                       client.subscribe(MCUName + "/+");
                                       client.publish(MCUName + "/alive","true");
                                       
                                    }
                                    
                                    void messageReceived(String &topic, String &payload) {
                                     Serial.println("MQTT incoming: " + topic + " - " + payload);
                                     Topic_MQTT = topic;
                                     Nachricht_MQTT = payload;
                                     
                                     topic = "";
                                     payload = "";
                                    }
                                    
                                    void setup() {
                                     Serial.begin(9600); 
                                     Serial.println("MAX31855 testing");
                                     delay(500);
                                     WiFi.begin(ssid, pass);
                                     client.begin("192.168.178.30",1883,net); //192.168.178.45
                                     connect(); //alive wird gesendet
                                     client.onMessage(messageReceived);
                                    
                                    }
                                    
                                    void loop() {
                                      Serial.print("Internal Temp = ");
                                      Serial.println(thermocouple.readInternal());
                                      delay(100);
                                      double c = thermocouple.readCelsius();
                                      if (isnan(c)) {
                                        Serial.println("Something wrong with thermocouple!");
                                      } else {
                                        Serial.print("C = ");
                                        Serial.println(c);
                                        client.publish(MCUName + "/InternalTemp",String(c));
                                      }
                                      client.loop();
                                      if (!client.connected()) {
                                         Serial.println("Neustart!");
                                         delay(200);
                                         WiFi.begin(ssid, pass);
                                         client.begin("192.168.178.30",1883,net);
                                         connect(); //alive wird gesendet
                                         client.onMessage(messageReceived);
                                         client.publish(MCUName + "/connectProblem","Verbindungsproblem gehabt");
                                      }
                                      delay(1000);
                                    }
                                    
                                    M 1 Reply Last reply Reply Quote 0
                                    • M
                                      MCU @Qax1 last edited by

                                      @qax1 sagte in NODEmcu K-Type Temp-Fühler in IObroker !?:

                                      while (!client.connect(client_name,"MQTTUser","MQTTPassword"))

                                      Immer noch nicht geändert:
                                      while (!client.connect(client_name,"MQTTUser","MQTTPassword")) -> while (!client.connect(client_name,"",""))

                                      Q 1 Reply Last reply Reply Quote 0
                                      • Q
                                        Qax1 @MCU last edited by

                                        @mcu sagte in NODEmcu K-Type Temp-Fühler in IObroker !?:

                                        while (!client.connect(client_name,"",""))

                                         
                                           Serial.print("\nconnecting...");
                                           while (!client.connect(MCUName,"","")) {
                                             Serial.print(".");
                                             delay(1000);
                                        

                                        so ?

                                        M 1 Reply Last reply Reply Quote 1
                                        • M
                                          MCU @Qax1 last edited by MCU

                                          @qax1
                                          while (!client.connect(MCUName,"","")) {
                                          dort nicht den client_name ersetzen!

                                          while (!client.connect(client_name,"",""))

                                          Q 1 Reply Last reply Reply Quote 0
                                          • Q
                                            Qax1 @MCU last edited by

                                            @mcu

                                               
                                               Serial.print("\nconnecting...");
                                              while (!client.connect(client_name,"","")) {
                                                 Serial.print(".");
                                                 delay(1000);
                                            

                                            ok

                                            M 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate
                                            FAQ Cloud / IOT
                                            HowTo: Node.js-Update
                                            HowTo: Backup/Restore
                                            Downloads
                                            BLOG

                                            759
                                            Online

                                            31.6k
                                            Users

                                            79.5k
                                            Topics

                                            1.3m
                                            Posts

                                            nodemcu max38155 mqtt
                                            2
                                            39
                                            1476
                                            Loading More Posts
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            Community
                                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                            The ioBroker Community 2014-2023
                                            logo