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. Troubleshooting
  3. [SOLVED ... partially] Ethernet gateway without radio don't present local sensors to domoticz

[SOLVED ... partially] Ethernet gateway without radio don't present local sensors to domoticz

Scheduled Pinned Locked Moved Troubleshooting
16 Posts 5 Posters 5.2k Views 4 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.
  • toninT Offline
    toninT Offline
    tonin
    wrote on last edited by
    #6

    Mystery solved ....

    I was using client mode gateway because in server mode my arduino mega reset every time that send an ethernet packet. In client mode as I say, domoticz connect to the arduino but there is no traffic from arduino to RPI domoticz presenting my relays. I read that client mode is buggy at this time, so I try to get server mode without the resets.

    To avoid resets in my chinese arduino mega 2560 & chinese w5100 I need to downgrade de AVR library from 1.6.13 to 1.6.11. So all works Ok with my to gateways (usb & ethernet() connected to my RPI domoticz controller.

    TheoLT 1 Reply Last reply
    2
    • TheoLT TheoL

      @tonin I'm following this with much curiosity. My first guess was that it can't work. Because the gateway shouldn't startup, in my mind at will stop the bootup sequence because there's it can't initialize the radio. At least that's what I expected.

      toninT Offline
      toninT Offline
      tonin
      wrote on last edited by
      #7

      @TheoL No, in mysensors 2.0 you can have gateways with local sensors or relays without radio only commenting all radio #define's

      1 Reply Last reply
      1
      • toninT tonin

        Mystery solved ....

        I was using client mode gateway because in server mode my arduino mega reset every time that send an ethernet packet. In client mode as I say, domoticz connect to the arduino but there is no traffic from arduino to RPI domoticz presenting my relays. I read that client mode is buggy at this time, so I try to get server mode without the resets.

        To avoid resets in my chinese arduino mega 2560 & chinese w5100 I need to downgrade de AVR library from 1.6.13 to 1.6.11. So all works Ok with my to gateways (usb & ethernet() connected to my RPI domoticz controller.

        TheoLT Offline
        TheoLT Offline
        TheoL
        Contest Winner
        wrote on last edited by
        #8

        @tonin Great to hear you've solved it.

        1 Reply Last reply
        1
        • TmasterT Offline
          TmasterT Offline
          Tmaster
          wrote on last edited by Tmaster
          #9

          Hi. I have the same problem with my serialgateway. its usb conected to VERA 3
          (ui7).
          There are no inclusion on vera. Normally i use the software arduino gateway start button on vera to include ,and reset the sensor be detected. Now my buzzer(relay based sketch) it's on gateway.
          What i do now for vera include my buzzer???? :disappointed:

          i even dont know if the scketch work but i need inclusion first...

          **(...)**
          
          
          // 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 
          
          
          #include <SPI.h>
          #include <MySensors.h>  
          
          #define CHILD_ID 5
          
          
          void setup() {
            
          }
          
          void presentation()  
          {   
            // Send the sketch version information to the gateway and Controller
            sendSketchInfo("BUZZER", "1.0");
          
           
              // Register all sensors to gw (they will be created as child devices)
              present(CHILD_ID,S_DOOR);
            }
          
          
          
          void loop() 
          {
            
          }
          
          void receive(const MyMessage &message) {
            // We only expect one type of message from controller. But we better check anyway.
            if (message.type==V_TRIPPED) 
          {
              tone(2, 2500, 1000) ;
                  
             } 
          }
          
          
          
          
          

          i'm a arduino fan .Even sometimes don't undestanding how to use it :P

          1 Reply Last reply
          0
          • toninT Offline
            toninT Offline
            tonin
            wrote on last edited by
            #10

            Try to call the presentation function in setup. I remembered that i needed to do it on usb gateway, the ethernet gateway has a patched code to call presentation after connection to the controller.

            1 Reply Last reply
            0
            • TmasterT Offline
              TmasterT Offline
              Tmaster
              wrote on last edited by
              #11

              Not worked. I think maybe i need an include button or some function that preset that sensor after gateway was already running and waiting for messages..I don't now. This new feature on gateway was one of my requests but still a mistery for me how it work :P

              i'm a arduino fan .Even sometimes don't undestanding how to use it :P

              1 Reply Last reply
              0
              • toninT Offline
                toninT Offline
                tonin
                wrote on last edited by
                #12

                This code

                // Enable debug prints to serial monitor
                #define MY_DEBUG 
                
                
                // Enable and select radio type attached
                //Comento la siguiente linea para que no necesite radio
                //#define MY_RADIO_NRF24
                //#define MY_RADIO_RFM69
                
                // Set LOW transmit power level as default, if you have an amplified NRF-module and
                // power your radio separately with a good regulator you can turn up PA level. 
                #define MY_RF24_PA_LEVEL RF24_PA_LOW
                
                // Enable serial gateway
                #define MY_GATEWAY_SERIAL
                
                // Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender)
                #if F_CPU == 8000000L
                #define MY_BAUD_RATE 38400
                #endif
                
                // Flash leds on rx/tx/err
                #define MY_LEDS_BLINKING_FEATURE
                // Set blinking period
                #define MY_DEFAULT_LED_BLINK_PERIOD 300
                
                // Inverses the behavior of leds
                //#define MY_WITH_LEDS_BLINKING_INVERSE
                
                // Enable inclusion mode
                #define MY_INCLUSION_MODE_FEATURE
                // Enable Inclusion mode button on gateway
                #define MY_INCLUSION_BUTTON_FEATURE
                
                // Inverses behavior of inclusion button (if using external pullup)
                //#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
                
                // 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 
                
                // Uncomment to override default HW configurations
                //#define MY_DEFAULT_ERR_LED_PIN 4  // Error led pin
                //#define MY_DEFAULT_RX_LED_PIN  6  // Receive led pin
                //#define MY_DEFAULT_TX_LED_PIN  5  // the PCB, on board LED
                
                #include <SPI.h>
                #include <MySensors.h>  
                
                //Para el sensor de temperatura
                #ifdef TEMP
                 #include <DallasTemperature.h>
                 #include <OneWire.h>
                 #define ONE_WIRE_BUS 2
                 OneWire oneWire(ONE_WIRE_BUS);
                 DallasTemperature sensors(&oneWire);
                 MyMessage msg(0,V_TEMP);
                #endif
                
                //Structura de reles
                typedef struct  {
                 int  pin;
                 char desc[20];
                 bool ON;
                 bool OFF;
                } sRELE;
                
                sRELE Rele [] = { {13 , "LED", HIGH, LOW},
                                 {31 , "RELE ASPERSOR PORCHE", LOW, HIGH},
                                 {33 , "RELE TURBINAS", LOW, HIGH},
                                 {35 , "RELE GOTEROS BAJOS", LOW, HIGH}
                               };
                
                #define NUMBER_OF_RELAYS 4 // Total number of attached relays
                
                void setup() { 
                 // Setup locally attached sensors
                #ifdef TEMP
                 //Para el sensor de temperatura
                 sensors.begin();
                #endif
                 //Para los reles
                   Serial.println("start call Setup");
                 for (int sensor=0 ; sensor<NUMBER_OF_RELAYS;sensor++) {
                   // Poner el rele en output mode
                   pinMode(Rele[sensor].pin, OUTPUT);   
                   // Poner el rele en el ultimo estado conocido (usando eeprom storage) 
                   digitalWrite(Rele[sensor].pin, loadState(sensor)?Rele[sensor].ON:Rele[sensor].OFF);
                 }
                   Serial.println("End call Setup");
                   presentation();
                }
                
                void presentation() {
                 // Presentar los sensores y actuadores locales 
                 Serial.println("start call presentation");
                 // Mandar la info del sketch
                 sendSketchInfo("Arduino USB", "1.0");
                
                 //Presentar los reles
                 for (int rele=0; rele<NUMBER_OF_RELAYS;rele++) {
                   // Registrar todos los reles al gw
                   present(rele, S_LIGHT,Rele[rele].desc);
                 }
                 Serial.println("End call presentation");
                #ifdef TEMP
                 //Presento el sensor de temperatura
                 present(9,S_TEMP,"SENSOR_TEMP");
                #endif
                }
                bool STATUS;
                void loop() { 
                 // Send locally attached sensor data here 
                #ifdef TEMP
                 Serial.print("Solicitando temperaturas...");
                 sensors.requestTemperatures(); // Send the command to get temperatures
                 float temperatura = sensors.getTempCByIndex(0);
                 send(msg.setSensor(9).set(temperatura,1));
                 Serial.println("DONE");
                 sleep(2000);
                #endif
                }
                
                
                void receive(const MyMessage &message) {
                 // Solo esperamos mensajes V_LIGTH de momento, pero lo chequeamos por si acaso.
                 if (message.type==V_LIGHT) {
                    // Cambiar estado del rele
                    digitalWrite(Rele[message.sensor].pin, message.getBool()?Rele[message.sensor].ON:Rele[message.sensor].OFF);
                    // Almacenar estado en la eeprom
                    saveState(message.sensor, message.getBool());
                    // Escribir informacion de debug
                    Serial.print("Cambio entrante para sensor:");
                    Serial.print(message.sensor);
                    Serial.print(", Nuevo status: ");
                    Serial.println(message.getBool());
                  } 
                }
                

                works ok for me. As you can see I define the relays in an structure to do it configurable. The only trick for me is to call the presentation function in the setup function. In the ethernet gateway it isn't needed.

                A note for the structure sRELE. yo can see the pin, description and the state of the pin that mean ON or OFF. It's so because my relay boards have an inverse logic. When the pin is in low state, the relay is on. This relay boards are opto coupled and have an isolated circuit between arduino pins and relays, this is the reason for that.

                The sample code also have some lines to read temperature from a dallas sensor.

                I hope that this help you.

                1 Reply Last reply
                0
                • TmasterT Offline
                  TmasterT Offline
                  Tmaster
                  wrote on last edited by
                  #13

                  Viva la espanã:p :palm_tree: . gracias.

                  Tankyou.I will try tomorow. :+1:

                  i'm a arduino fan .Even sometimes don't undestanding how to use it :P

                  1 Reply Last reply
                  0
                  • TmasterT Offline
                    TmasterT Offline
                    Tmaster
                    wrote on last edited by Tmaster
                    #14

                    hi. i just add presentation function on setup but still the same. No sign of the sensor on vera. maybe yor sketch its sending back another call in some other line ... i can't make it work.

                    changes:

                    void setup() {
                      presentation();
                    }
                    
                    void presentation()  
                    {   
                      // Send the sketch version information to the gateway and Controller
                      sendSketchInfo("BUZZER", "1.0");
                    
                     
                        // Register all sensors to gw (they will be created as child devices)
                        present(CHILD_ID,S_DOOR);
                      }
                    
                    void loop() 
                    {
                      
                    }
                    
                    void receive(const MyMessage &message) {
                      // We only expect one type of message from controller. But we better check anyway.
                      if (message.type==V_TRIPPED
                      ) {
                        tone(2, 2500, 1000) ;
                         // Change relay state
                         //digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
                         // Store state in eeprom
                         //saveState(message.sensor, message.getBool());
                         // Write some debug info
                         Serial.print("Incoming change for sensor:");
                         Serial.print(message.sensor);
                         Serial.print(", New status: ");
                         Serial.println(message.getBool());
                       } 
                    }
                    
                    
                    
                    
                    
                    

                    i'm a arduino fan .Even sometimes don't undestanding how to use it :P

                    1 Reply Last reply
                    0
                    • hekH Offline
                      hekH Offline
                      hek
                      Admin
                      wrote on last edited by
                      #15

                      This was fixed in development back in august but has not yet made it to master branch (which you might be using if you downloaded through library manager).

                      https://github.com/mysensors/MySensors/pull/532

                      1 Reply Last reply
                      0
                      • TmasterT Offline
                        TmasterT Offline
                        Tmaster
                        wrote on last edited by
                        #16

                        So i need install the devbranch. . i will try...
                        thankyou

                        i'm a arduino fan .Even sometimes don't undestanding how to use it :P

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


                        25

                        Online

                        11.7k

                        Users

                        11.2k

                        Topics

                        113.1k

                        Posts


                        Copyright 2025 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