• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Display different Roomtemperature on MagicMirror

Scheduled Pinned Locked Moved General Discussion
31 Posts 4 Posters 11.5k Views 4 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    wishmaster270 Module Developer @Xilef
    last edited by Dec 1, 2022, 8:16 PM

    @Xilef
    Perfect. This is the right setting.

    You need to replace the ##, too.
    It will look something like:

    const char* ssid     = "MY_WIFI_NETWORK";
    const char* password = "123ABC456";
    
    IPAddress local_IP(192, 168, 178, 106);
    IPAddress gateway(192, 168, 178, 1);
    IPAddress subnet(255, 255, 255, 0);
    IPAddress primaryDNS(192, 168, 178, 1);
    IPAddress secondaryDNS(8, 8, 8, 8);
    

    To check if everything is set up correctly you can run:

    /bin/nc -w3 192.168.178.106 80
    
    X 1 Reply Last reply Dec 1, 2022, 8:21 PM Reply Quote 0
    • X Offline
      Xilef @wishmaster270
      last edited by Xilef Dec 1, 2022, 8:22 PM Dec 1, 2022, 8:21 PM

      @wishmaster270 the “/bin/nc -w3 192.168.178.106 80” command on the serial monitor message line?

      :/
      5056fdbb-8964-48ca-ada7-749e3b6ac4a2-image.png
      11163a1a-2a91-4a92-8bc7-342dacec1778-image.png

      I would suggest to remove the clamp behind the ; ??

      W 1 Reply Last reply Dec 1, 2022, 8:28 PM Reply Quote 0
      • W Offline
        wishmaster270 Module Developer @Xilef
        last edited by Dec 1, 2022, 8:28 PM

        @Xilef
        Sorry, my fault. You need to change line 52 to:

        if (!bme.begin(0x76)) {
        

        Copy&Paste mistake of me

        X 1 Reply Last reply Dec 1, 2022, 8:55 PM Reply Quote 0
        • X Offline
          Xilef @wishmaster270
          last edited by Xilef Dec 1, 2022, 9:02 PM Dec 1, 2022, 8:55 PM

          @wishmaster270 i installed the module, but i cant display the data

          4fc4015c-43e3-4a94-bee3-2cbc143df891-image.png
          what am i doing wrong, ah the esp32 says he couldnt find a sensor, thats weird
          (edit: i tried another one and it worked this time)

          W 1 Reply Last reply Dec 1, 2022, 9:09 PM Reply Quote 0
          • W Offline
            wishmaster270 Module Developer @Xilef
            last edited by Dec 1, 2022, 9:09 PM

            @Xilef
            You will need the MMM-Temperature module and not the Embed module as you do not want to display a website but parse the JSON data object and display its contents.
            The config will look something like:

            		{
            			module: "MMM-Temperature",
            			position: "bottom_right",
            			config: {
            				sensors: [
            					{
            					    name: "ESP",
            					    script: "/bin/nc",
            					    args: "-w3 192.168.178.106"
                                			},
            				]
            			},
            		},
            

            But you will need to fix the missing sensor first.

            Can you please check your wiring and use this sketch instead of the other one. I only removed one line which i do not think is the problem but i can not test the sketch at the moment.

            #include <WiFi.h>
            #include <Wire.h>
            #include <Adafruit_Sensor.h>
            #include <Adafruit_BME280.h>
            
            const char* ssid     = "##ADD_WIFI_SSID_HERE";
            const char* password = "##ADD_WIFI_PASSWORD_HERE";
            
            //ENTER STATIC IP OF THE ESP32 BOARD HERE
            IPAddress local_IP(192, 168, 0, 2);
            IPAddress gateway(192, 168, 0, 1);
            IPAddress subnet(255, 255, 255, 0);
            IPAddress primaryDNS(192, 168, 0, 1);
            IPAddress secondaryDNS(8, 8, 8, 8);
            
            Adafruit_BME280 bme;
            
            WiFiServer server(80);
            
            void setup()
            {
              Serial.begin(115200);
            
              if (!WiFi.config(local_IP, gateway, subnet, primaryDNS, secondaryDNS)) {
                Serial.println("STA Failed to configure");
              }
            
              Serial.print("Connecting to ");
              Serial.println(ssid);
            
              WiFi.begin(ssid, password);
            
              while (WiFi.status() != WL_CONNECTED) {
                delay(500);
                Serial.print(".");
              }
            
              Serial.println("");
              Serial.println("WiFi connected!");
              Serial.print("IP address: ");
              Serial.println(WiFi.localIP());
              Serial.print("ESP Mac Address: ");
              Serial.println(WiFi.macAddress());
              Serial.print("Subnet Mask: ");
              Serial.println(WiFi.subnetMask());
              Serial.print("Gateway IP: ");
              Serial.println(WiFi.gatewayIP());
              Serial.print("DNS: ");
              Serial.println(WiFi.dnsIP());
            
              if (!bme.begin(0x76)) {
                Serial.println("Couldn't find sensor!");
                while (1);
              }
            
              server.begin();
            }
            
            void loop()
            {
              float temp = bme.readTemperature();
              float tempf = temp * 1.8 + 32;
              float rel_hum = bme.readHumidity();
            
              WiFiClient client = server.available();
              if (client) {
                Serial.println("New Client."); 
                client.println("{");
                client.print("  \"temperature_c\": ");
                client.print(temp);
                client.println(",");
                client.print("  \"temperature_f\": ");
                client.print(tempf);
                client.println(",");
                client.print("  \"humidity\": ");
                client.print(rel_hum);
                client.println(",");
                client.println("  \"error\": false");
                client.println("}");
                client.stop();
                Serial.println("Client disconnected.");
                Serial.println("");
              }
              delay(100);
            }
            
            X 2 Replies Last reply Dec 1, 2022, 9:21 PM Reply Quote 0
            • X Offline
              Xilef @wishmaster270
              last edited by Dec 1, 2022, 9:21 PM

              @wishmaster270 i connected an other sensor and it doesnt showed me the error message, i will try the sketch tomorrow, the MMM_Temperature module is installed and works, but doesnt show any data, im gona try to fix it tomorrow

              1 Reply Last reply Reply Quote 0
              • X Offline
                Xilef @wishmaster270
                last edited by Xilef Dec 2, 2022, 4:49 PM Dec 2, 2022, 4:48 PM

                @wishmaster270 everything worked, you just forgot to add the “80” here:
                f9b2ea9b-634b-484f-86d7-cfd3e04248ca-image.png

                i just set up a second sensor and cloned the module
                if i go into my browser and type the two different IPs every sensor shows his own data, but the mirror displays 2times the data of sensor 2:
                a7b7719e-9a73-4c45-8a3e-239acb3611d5-image.png

                (sensor1: “test” | sensor2: “test2”)
                how do i fix that?

                W 1 Reply Last reply Dec 2, 2022, 5:33 PM Reply Quote 0
                • W Offline
                  wishmaster270 Module Developer @Xilef
                  last edited by Dec 2, 2022, 5:33 PM

                  @Xilef Perfect. One step further.

                  You only need one instance of the module. So your config will look something like:

                  		{
                  			module: "MMM-Temperature",
                  			position: "middle_center",
                  			config: {
                  				sensors: [
                  					{
                  					    name: "test",
                  					    script: "/bin/nc",
                  					    args: "-w3 192.168.178.106 80"
                                      			},
                  					{
                  					    name: "test2",
                  					    script: "/bin/nc",
                  					    args: "-w3 192.168.178.108 80"
                                      			},
                  				]
                  			},
                  		},
                  
                  X 1 Reply Last reply Dec 2, 2022, 5:39 PM Reply Quote 0
                  • X Offline
                    Xilef @wishmaster270
                    last edited by Dec 2, 2022, 5:39 PM

                    @wishmaster270 yes, it works

                    and in the future i can experiment with the MMM-ValuesByNotification Module to customize the module, right?

                    and a big thank you for the help and the quick reply

                    W 1 Reply Last reply Dec 2, 2022, 6:20 PM Reply Quote 0
                    • W Offline
                      wishmaster270 Module Developer @Xilef
                      last edited by Dec 2, 2022, 6:20 PM

                      @Xilef Perfect.
                      Yes, the ValuesByNotification module is very powerful but the configuration can be get complex very quickly. You will need my other module CommandToNotification, too.

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 4
                      • 3 / 4
                      3 / 4
                      • First post
                        26/31
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy