Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. My Project
  3. [n00b]]Ethernet GW - without NF24

[n00b]]Ethernet GW - without NF24

Scheduled Pinned Locked Moved My Project
31 Posts 4 Posters 15.2k Views 3 Watching
  • 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.
  • A Offline
    A Offline
    afick
    wrote on last edited by
    #3

    gr8 but do you have any documentation or help-docs for this or anything what can help me in setting up this?

    1 Reply Last reply
    0
    • hekH Online
      hekH Online
      hek
      Admin
      wrote on last edited by
      #4

      Currently no documentation for this branch but all the examples has been updated.

      You should be able to use any one of the examples and add:

      #define MY_GATEWAY_SERIAL

      and remove

      #define MY_RADIO_NRF24

      before the MySensors.h-include.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        brix7be
        wrote on last edited by
        #5

        Hello Hek, Hello Everyone,

        I've actually one arduino uno and an ethernet shield Wizenet W5100 and for exemple a temp sensor DS18B20 directly connected to it.
        I can send to a serial terminal the temperature value. It's working properly :-).
        I would to know how I could simplify the code of the "Ethernet GW" Sketch for send the value of a sensor directly from the GW to Domoticz. (Without using an urduino dedicated to the sensor acquisition and without an RF module).

        Could you give me an exemple of the code or the command to send to domoticz?
        Or do you have a documentation link?
        Because the link you posted before is dead https://github.com/mysensors/Arduino/tree/gateway-refactoring.

        I've made many rescearch, and i don't find the protocol documentation to discuss with domoticz!

        I appreciate if you could help me to the right way :-).

        Awayting your answer, thanks very much in advance.

        PS: Sorry for my bad english...

        1 Reply Last reply
        0
        • hekH Online
          hekH Online
          hek
          Admin
          wrote on last edited by
          #6

          The code has been merged into development-branch now:

          https://github.com/mysensors/Arduino

          1 Reply Last reply
          0
          • B Offline
            B Offline
            brix7be
            wrote on last edited by
            #7

            Thanks for your quickly answer.

            I'm sorry but I didn't found the code or information regarde my question into the repository you noticed.

            Could you please give me the complete link?

            Thanks you again.

            1 Reply Last reply
            0
            • hekH Online
              hekH Online
              hek
              Admin
              wrote on last edited by
              #8

              We can't have all permutations of examples ready available...

              So you'll have to put it together by combining:

              https://github.com/mysensors/Arduino/blob/development/libraries/MySensors/examples/GatewayW5100/GatewayW5100.ino

              and

              https://github.com/mysensors/Arduino/blob/development/libraries/MySensors/examples/DallasTemperatureSensor/DallasTemperatureSensor.ino

              You'd basically only have to copy the #defines from the gateway to the DallasTemp-sketch.

              1 Reply Last reply
              0
              • B Offline
                B Offline
                brix7be
                wrote on last edited by
                #9

                Hi Hek,

                Sure, you can't realise every solutions or exemple for everyone :-).
                So it's a good advice for me to begin my tests.

                When i merge the both codes, i receive an error "sendSketchInfo was not declared in this scope"!
                I've checked and normally all the librairies are available for the code.
                (When i'm building the GatewayW5100 only it works) but not for the dallas.

                Do you have an idea?

                Thanks :-).

                Gwen.

                1 Reply Last reply
                0
                • hekH Online
                  hekH Online
                  hek
                  Admin
                  wrote on last edited by
                  #10

                  Just did a quick test calling sendSketchInfo in the gateway and it compiles fine for me.

                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    brix7be
                    wrote on last edited by
                    #11

                    hum, strange.
                    I continue to search a solution.
                    I'll give you a feed back ;-).

                    Thanks

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      brix7be
                      wrote on last edited by
                      #12

                      It doesn't work.
                      But i found the code of Bram81 http://forum.mysensors.org/topic/1591/how-to-add-a-sensor-to-the-serial-gateway/22
                      and I can compile it well.
                      And it calls the gw.sendSketchInfo("Soil_Moist_Sensor_grb", "1.15");

                      Do you have another tip?

                      1 Reply Last reply
                      0
                      • hekH Online
                        hekH Online
                        hek
                        Admin
                        wrote on last edited by
                        #13

                        remove "gw." from the call.

                        1 Reply Last reply
                        0
                        • B Offline
                          B Offline
                          brix7be
                          wrote on last edited by
                          #14

                          You are right, it blocks when i call sendSketchInfo directly (without to be an attribute of gw) !?!

                          1 Reply Last reply
                          0
                          • B Offline
                            B Offline
                            brix7be
                            wrote on last edited by brix7be
                            #15

                            Here is the merged code
                            Thanks for the advices

                            // BELOW the gateway W5100 sketch
                            
                            // Enable debug prints to serial monitor
                            #define MY_DEBUG 
                            
                            // Enable and select radio type attached
                            //#define MY_RADIO_NRF24 
                            //#define MY_RADIO_RFM69 // I DONT WANT TO USE THE RADIO MODULE
                            
                            // Enable gateway ethernet module type 
                            #define MY_GATEWAY_W5100
                            
                            // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
                            //#define MY_W5100_SPI_EN 4  
                            
                            // Enable Soft SPI for NRF radio (note different radio wiring is required)
                            // The W5100 ethernet module seems to have a hard time co-operate with 
                            // radio on the same spi bus.
                            //#if !defined(MY_W5100_SPI_EN)
                            //  #define MY_SOFTSPI
                            //  #define MY_SOFT_SPI_SCK_PIN 14
                            //  #define MY_SOFT_SPI_MISO_PIN 16
                            //  #define MY_SOFT_SPI_MOSI_PIN 15
                            //#endif  
                            
                            // When W5100 is connected we have to move CE/CSN pins for NRF radio
                            //#define MY_RF24_CE_PIN 5
                            //#define MY_RF24_CS_PIN 6
                            
                            // Enable to UDP          
                            //#define MY_USE_UDP
                            
                            //#define MY_IP_ADDRESS 192,168,1,100   // If this is disabled, DHCP is used to retrieve address
                            // Renewal period if using DHCP
                            //#define MY_IP_RENEWAL_INTERVAL 60000
                            // The port to keep open on node server mode / or port to contact in client mode
                            //#define MY_PORT 5003 
                                 
                            #define IP_PORT 5003        // The port you want to open 
                            IPAddress myIp (192, 168, 1, 100);  // Configure your static ip-address here    COMPILE ERROR HERE? Use Arduino IDE 1.5.7 or later!
                            
                            // Controller ip address. Enables client mode (default is "server" mode). 
                            // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere. 
                            //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254   
                             
                            // The MAC address can be anything you want but should be unique on your network.
                            // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
                            // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
                            //#define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
                            
                            // The MAC address can be anything you want but should be unique on your network.
                            // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
                            // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
                            byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };  // DEAD BEEF FEED
                            
                            // a R/W server on the port
                            EthernetServer server = EthernetServer(IP_PORT);
                            // handle to open connection
                            EthernetClient client = EthernetClient();
                            
                            // Flash leds on rx/tx/err
                            //#define MY_LEDS_BLINKING_FEATURE
                            // Set blinking period
                            //#define MY_DEFAULT_LED_BLINK_PERIOD 300
                            
                            // Enable inclusion mode
                            //#define MY_INCLUSION_MODE_FEATURE
                            // Enable Inclusion mode button on gateway
                            //#define MY_INCLUSION_BUTTON_FEATURE
                            // Set inclusion mode duration (in seconds)
                            //#define MY_INCLUSION_MODE_DURATION 60 
                            // Digital pin used for inclusion mode button
                            //#define MY_INCLUSION_MODE_BUTTON_PIN  3 
                            
                            //#define MY_DEFAULT_ERR_LED_PIN 7  // Error led pin
                            //#define MY_DEFAULT_RX_LED_PIN  8  // Receive led pin
                            //#define MY_DEFAULT_TX_LED_PIN  9  // the PCB, on board LED
                            
                            #include <SPI.h>
                            
                            #if defined(MY_USE_UDP)
                              #include <EthernetUdp.h>
                            #endif
                            #include <Ethernet.h>
                            #include <MySensor.h>
                            
                            
                            //-------------------------------------------------------------
                            //Below the Dallas temp sketch
                            
                            // Enable debug prints to serial monitor
                            #define MY_DEBUG 
                            
                            // Enable and select radio type attached
                            //#define MY_RADIO_NRF24
                            //#define MY_RADIO_RFM69
                            
                            #include <SPI.h>
                            #include <MySensor.h>  
                            #include <DallasTemperature.h>
                            #include <OneWire.h>
                            
                            #define COMPARE_TEMP 1 // Send temperature only if changed? 1 = Yes 0 = No
                            
                            #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected 
                            #define MAX_ATTACHED_DS18B20 16
                            unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
                            OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
                            DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature. 
                            float lastTemperature[MAX_ATTACHED_DS18B20];
                            int numSensors=0;
                            boolean receivedConfig = false;
                            boolean metric = true; 
                            // Initialize temperature message
                            MyMessage msg(0,V_TEMP);
                            
                            char inputString[MAX_RECEIVE_LENGTH] = "";    // A string to hold incoming commands from serial/ethernet interface
                            int inputPos = 0;
                            bool sentReady = false;
                            
                            void output(const char *fmt, ... ) {
                               va_list args;
                               va_start (args, fmt );
                               vsnprintf_P(serialBuffer, MAX_SEND_LENGTH, fmt, args);
                               va_end (args);
                               Serial.print(serialBuffer);
                               server.write(serialBuffer);
                            }
                            
                            void setup()  
                            { 
                              // ////Prepare the ethernet connection 
                              Ethernet.begin(mac, myIp);
                            
                              // Startup up the OneWire library
                              sensors.begin();
                              // requestTemperatures() will not block current thread
                              sensors.setWaitForConversion(false);
                            }
                            
                            void presentation() {
                              // Send the sketch version information to the gateway and Controller
                              sendSketchInfo("Temperature Sensor", "1.1");
                            
                              // Fetch the number of attached temperature sensors  
                              numSensors = sensors.getDeviceCount();
                            
                              // Present all sensors to controller
                              for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {   
                                 present(i, S_TEMP);
                              }
                            }
                            
                            void loop()     
                            {     
                              // Fetch temperatures from Dallas sensors
                              sensors.requestTemperatures();
                            
                              // query conversion time and sleep until conversion completed
                              int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution());
                              // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater)
                              sleep(conversionTime);
                            
                              // Read temperatures and send them to controller 
                              for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
                             
                                // Fetch and round temperature to one decimal
                                float temperature = static_cast<float>(static_cast<int>((getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
                             
                                // Only send data if temperature has changed and no error
                                #if COMPARE_TEMP == 1
                                if (lastTemperature[i] != temperature && temperature != -127.00 && temperature != 85.00) {
                                #else
                                if (temperature != -127.00 && temperature != 85.00) {
                                #endif
                             
                                  // Send in the new temperature
                                  send(msg.setSensor(i).set(temperature,1));
                                  // Save new temperatures for next compare
                                  lastTemperature[i]=temperature;
                                }
                              }
                              sleep(SLEEP_TIME);
                            }
                            
                            1 Reply Last reply
                            0
                            • hekH Online
                              hekH Online
                              hek
                              Admin
                              wrote on last edited by
                              #16

                              Looks like you added your own stuff..

                              @brix7be said:

                              IPAddress myIp (192, 168, 1, 100); // Configure your static ip-address here COMPILE ERROR HERE? Use Arduino IDE 1.5.7 or later!

                              Should simply be
                              #define MY_IP_ADDRESS 192, 168, 1, 100 // If this is disabled, DHCP is used to retrieve address

                              And what the following doing here?

                              // a R/W server on the port
                              EthernetServer server = EthernetServer(IP_PORT);
                              // handle to open connection
                              EthernetClient client = EthernetClient();
                              

                              And you include <SPI.h> and <MySensor.h> twice.

                              1 Reply Last reply
                              0
                              • B Offline
                                B Offline
                                brix7be
                                wrote on last edited by
                                #17

                                to be honnest, i don't know ...

                                1 Reply Last reply
                                0
                                • B Offline
                                  B Offline
                                  brix7be
                                  wrote on last edited by
                                  #18

                                  With the #define MY_IP_ADDRESS i can't compile the projet.
                                  With the arduino command it works now, i can ping it on 192.168.1.100.
                                  But still nothing in domoticz.
                                  Am I on the right way?
                                  thanks again :-)

                                  // BELOW the gateway W5100 sketch
                                  
                                  // Enable debug prints to serial monitor
                                  #define MY_DEBUG 
                                  
                                  // Enable gateway ethernet module type 
                                  #define MY_GATEWAY_W5100
                                  
                                  // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
                                  //#define MY_W5100_SPI_EN 4  
                                  
                                  // Enable to UDP          
                                  //#define MY_USE_UDP
                                  
                                  //#define MY_IP_ADDRESS 192,168,1,100   // If this is disabled, DHCP is used to retrieve address
                                  byte ip[] = { 192, 168, 1, 100 }; 
                                  // Renewal period if using DHCP
                                  //#define MY_IP_RENEWAL_INTERVAL 60000
                                  // The port to keep open on node server mode / or port to contact in client mode
                                  #define MY_PORT 5003 
                                  
                                  // Controller ip address. Enables client mode (default is "server" mode). 
                                  // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere. 
                                  //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254   
                                   
                                  // The MAC address can be anything you want but should be unique on your network.
                                  // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
                                  // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
                                  //#define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
                                  byte mac [] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
                                  
                                  #include <SPI.h>
                                  #if defined(MY_USE_UDP)
                                    #include <EthernetUdp.h>
                                  #endif
                                  #include <Ethernet.h>
                                  #include <MySensor.h>
                                  
                                  //-------------------------------------------------------------
                                  //Below the Dallas temp sketch
                                  
                                  #include <DallasTemperature.h>
                                  #include <OneWire.h>
                                  
                                  #define COMPARE_TEMP 1 // Send temperature only if changed? 1 = Yes 0 = No
                                  
                                  #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected 
                                  #define MAX_ATTACHED_DS18B20 16
                                  unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
                                  OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
                                  DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature. 
                                  float lastTemperature[MAX_ATTACHED_DS18B20];
                                  int numSensors=0;
                                  boolean receivedConfig = false;
                                  boolean metric = true; 
                                  // Initialize temperature message
                                  MyMessage msg(0,V_TEMP);
                                  
                                  void setup()  
                                  { 
                                    // ////Prepare the ethernet connection 
                                    Ethernet.begin(mac , ip);
                                    wait(1000);
                                    
                                      // Startup up the OneWire library
                                    sensors.begin();
                                    // requestTemperatures() will not block current thread
                                    sensors.setWaitForConversion(false);
                                  
                                  }
                                  
                                  void presentation() {
                                    // Send the sketch version information to the gateway and Controller
                                    sendSketchInfo("Temperature Sensor", "1.1");
                                  
                                    // Fetch the number of attached temperature sensors  
                                    numSensors = sensors.getDeviceCount();
                                  
                                    // Present all sensors to controller
                                    for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {   
                                       present(i, S_TEMP);
                                    }
                                  }
                                  
                                  void loop()     
                                  {     
                                    // Fetch temperatures from Dallas sensors
                                    sensors.requestTemperatures();
                                  
                                    // query conversion time and sleep until conversion completed
                                    int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution());
                                    // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater)
                                    sleep(conversionTime);
                                  
                                    // Read temperatures and send them to controller 
                                    for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
                                   
                                      // Fetch and round temperature to one decimal
                                      float temperature = static_cast<float>(static_cast<int>((getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
                                   
                                      // Only send data if temperature has changed and no error
                                      #if COMPARE_TEMP == 1
                                      if (lastTemperature[i] != temperature && temperature != -127.00 && temperature != 85.00) {
                                      #else
                                      if (temperature != -127.00 && temperature != 85.00) {
                                      #endif
                                   
                                        // Send in the new temperature
                                        send(msg.setSensor(i).set(temperature,1));
                                        // Save new temperatures for next compare
                                        lastTemperature[i]=temperature;
                                      }
                                    }
                                    sleep(SLEEP_TIME);
                                  }
                                  
                                  1 Reply Last reply
                                  0
                                  • hekH Online
                                    hekH Online
                                    hek
                                    Admin
                                    wrote on last edited by
                                    #19

                                    I don't understand.. why do you declare ip and mac like that? It most surely isn't picked up by the library. You're probably just getting an ip from your DHCP server.

                                    What compile error do you get when using the defines?

                                    1 Reply Last reply
                                    0
                                    • B Offline
                                      B Offline
                                      brix7be
                                      wrote on last edited by brix7be
                                      #20

                                      i've changed as before and it won't compile.
                                      The error is:
                                      no matching function for call to 'EthernetClass::begin(int, int, int, int, int, int, int, int, int, int)'
                                      No it takes the ip I put on the code before, cause the ping respond at this one.
                                      Thks

                                      // BELOW the gateway W5100 sketch
                                      
                                      // Enable debug prints to serial monitor
                                      #define MY_DEBUG 
                                      
                                      // Enable gateway ethernet module type 
                                      #define MY_GATEWAY_W5100
                                      
                                      // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
                                      //#define MY_W5100_SPI_EN 4  
                                      
                                      // Enable to UDP          
                                      //#define MY_USE_UDP
                                      
                                      #define MY_IP_ADDRESS 192,168,1,100   // If this is disabled, DHCP is used to retrieve address
                                      //byte ip[] = { 192, 168, 1, 100 }; 
                                      // Renewal period if using DHCP
                                      //#define MY_IP_RENEWAL_INTERVAL 60000
                                      // The port to keep open on node server mode / or port to contact in client mode
                                      #define MY_PORT 5003 
                                      
                                      // Controller ip address. Enables client mode (default is "server" mode). 
                                      // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere. 
                                      //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254   
                                       
                                      // The MAC address can be anything you want but should be unique on your network.
                                      // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
                                      // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
                                      #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
                                      //byte mac [] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
                                      
                                      #include <SPI.h>
                                      #if defined(MY_USE_UDP)
                                        #include <EthernetUdp.h>
                                      #endif
                                      #include <Ethernet.h>
                                      #include <MySensor.h>
                                      
                                      //-------------------------------------------------------------
                                      //Below the Dallas temp sketch
                                      
                                      #include <DallasTemperature.h>
                                      #include <OneWire.h>
                                      
                                      #define COMPARE_TEMP 1 // Send temperature only if changed? 1 = Yes 0 = No
                                      
                                      #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected 
                                      #define MAX_ATTACHED_DS18B20 16
                                      unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
                                      OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
                                      DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature. 
                                      float lastTemperature[MAX_ATTACHED_DS18B20];
                                      int numSensors=0;
                                      boolean receivedConfig = false;
                                      boolean metric = true; 
                                      // Initialize temperature message
                                      MyMessage msg(0,V_TEMP);
                                      
                                      void setup()  
                                      { 
                                        // ////Prepare the ethernet connection 
                                        Ethernet.begin(MY_MAC_ADDRESS , MY_IP_ADDRESS);
                                        wait(1000);
                                        
                                          // Startup up the OneWire library
                                        sensors.begin();
                                        // requestTemperatures() will not block current thread
                                        sensors.setWaitForConversion(false);
                                      
                                      }
                                      
                                      void presentation() {
                                        // Send the sketch version information to the gateway and Controller
                                        sendSketchInfo("Temperature Sensor", "1.1");
                                      
                                        // Fetch the number of attached temperature sensors  
                                        numSensors = sensors.getDeviceCount();
                                      
                                        // Present all sensors to controller
                                        for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {   
                                           present(i, S_TEMP);
                                        }
                                      }
                                      
                                      void loop()     
                                      {     
                                        // Fetch temperatures from Dallas sensors
                                        sensors.requestTemperatures();
                                      
                                        // query conversion time and sleep until conversion completed
                                        int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution());
                                        // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater)
                                        sleep(conversionTime);
                                      
                                        // Read temperatures and send them to controller 
                                        for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
                                       
                                          // Fetch and round temperature to one decimal
                                          float temperature = static_cast<float>(static_cast<int>((getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
                                       
                                          // Only send data if temperature has changed and no error
                                          #if COMPARE_TEMP == 1
                                          if (lastTemperature[i] != temperature && temperature != -127.00 && temperature != 85.00) {
                                          #else
                                          if (temperature != -127.00 && temperature != 85.00) {
                                          #endif
                                       
                                            // Send in the new temperature
                                            send(msg.setSensor(i).set(temperature,1));
                                            // Save new temperatures for next compare
                                            lastTemperature[i]=temperature;
                                          }
                                        }
                                        sleep(SLEEP_TIME);
                                      }
                                      
                                      1 Reply Last reply
                                      0
                                      • B Offline
                                        B Offline
                                        brix7be
                                        wrote on last edited by
                                        #21

                                        The final goal for me is the build ethernet sensor(s) (2 or 3 one each arduino board) connected to domoticz by lan gw.

                                        1 Reply Last reply
                                        0
                                        • B Offline
                                          B Offline
                                          brix7be
                                          wrote on last edited by
                                          #22

                                          Is there anyone who have done a sketch to connect sensor directly on an ethernet gateway ?
                                          Iam searching a working exemple or a working draft to see the process to build my own code.
                                          Thank everyone for your advices.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          16

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular