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. Controllers
  3. Test your home made controller with MockMySensors (w/ tutorial)

Test your home made controller with MockMySensors (w/ tutorial)

Scheduled Pinned Locked Moved Controllers
39 Posts 12 Posters 25.3k Views 14 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.
  • barduinoB Offline
    barduinoB Offline
    barduino
    wrote on last edited by barduino
    #1

    Hi Folks,

    While building my custom controller i've run into a problem of not having enough arduinos/material to produce each type of supported sensors.

    So in order to create visualizations for each sensor I've decided to create an arduino sketch to fake sensors and send dummy data.

    Of course I'm running out of Global/Local variable space half way through (about 12 sensors, even with debug off) but plan to comment/uncomment the sersors to fake.

    Also I havent had a proper chance to test this.

    Is anyone interested in this?
    Want to give it a go?
    Check it on MySensors Github

    Usual stuff, open source, as is, terrible code, blá blá blá, have fun!

    Cheers

    A 1 Reply Last reply
    3
    • blaceyB Offline
      blaceyB Offline
      blacey
      Admin
      wrote on last edited by
      #2

      Very cool. I think the appropriate term would be "mock" sensors as is common in software where one mock objects for testing.

      1 Reply Last reply
      0
      • barduinoB Offline
        barduinoB Offline
        barduino
        wrote on last edited by
        #3

        Guys

        No pun intended.

        I admire and appreciate your work with my sensors library

        Cheers

        1 Reply Last reply
        0
        • barduinoB Offline
          barduinoB Offline
          barduino
          wrote on last edited by barduino
          #4

          Hi Folks

          Did a major refactor on this thing and was able to do some preliminery testing.

          Due to memory limitations on the Arduino, you now can comment/uncomment the sensors you would like to test. I was able to test about 12 sensors at a time (if i turn off the MySensor library debug).

          It is able to fake/mock the 24 sensors on the 1.4.1 MySensors Library.

          Nest steps will be:

          • remove the read/write from the eprom

          • include the extra sensors supported by library version 1.5.

          • Implement a way to request sensor information (where it makes sense)

          Not necessarily in this order...

          With this I now have plenty of information to use in my controller HAALL

          It has also made a very good exercise in creating MySensors code.

          By the way I would like some advice from the arduino experts here....

          As I mentioned you can comment/uncomment the sensors declarations on the beginning, I use a lot of #ifdef in the code.

          My question is: Is there a more elegant solution for this?

          e.g. for the dimmer sensor:

          //declaration
          #define ID_S_DIMMER                   5
          ---
          //Message
          #ifdef ID_S_DIMMER
            MyMessage msg_S_DIMMER(ID_S_DIMMER,V_DIMMER);
          #endif
          ---
          //set up - presentation
          #ifdef ID_S_DIMMER
              Serial.println("  S_DIMMER");
              gw.present(ID_S_DIMMER,S_DIMMER);
              gw.wait(SHORT_WAIT);
            #endif
          ---
          // loop
          #ifdef ID_S_DIMMER
              dimmer();
            #endif
          ---
          // read function
          #ifdef ID_S_DIMMER
          void dimmer(){
          
            int dimmerVal = gw.loadState(ID_S_DIMMER);
            
            Serial.print("Dimmer is set to: " );
            Serial.println(dimmerVal);
            
            gw.send(msg_S_DIMMER.set(dimmerVal));
          
          }
          #endif
          ---
          // incoming message switch
          #ifdef ID_S_DIMMER
              case V_DIMMER:
                    if ((message.getInt()<0)||(message.getInt()>100)) {
                      Serial.println( "V_DIMMER data invalid (should be 0..100)" );
                      break;
                    }
                    gw.saveState(ID_S_DIMMER, message.getInt());
                    Serial.print("Incoming change for ID_S_DIMMER:");
                    Serial.print(message.sensor);
                    Serial.print(", New status: ");
                    Serial.println(message.getInt());
              break;
              #endif
          

          Also, suggestions to remove the read/write from the eprom are welcome.

          For those who are building custom controllers, the comments on the v1.5 library help to clarify a few things.

          For example, there is no formal relation between the sensor type and the message type (and to me it wasn't always obvious), however that relation is somewhat establshed in the comments of lib 1.5.

          Thanks guys.

          As always, feedback is very welcome!!!!

          Cheers

          AWIA 1 Reply Last reply
          0
          • barduinoB Offline
            barduinoB Offline
            barduino
            wrote on last edited by
            #5

            Hi Folks,

            Though i give out an update on the MockMySensors thing...

            Here is a pic

            sensors.png

            Cheers

            1 Reply Last reply
            0
            • greglG Offline
              greglG Offline
              gregl
              Hero Member
              wrote on last edited by
              #6

              Nice work and great idea.

              When I was getting started I too didn't have enough arduinos/radios to test different bits with it was a pain...or wanting to try out Hek's latest and greatest sensor/sketch to see what it looks like in Vera/Imperihome... but I never thought to create a sketch to just pretend it had the hardware...great thinking!

              Q: What GUI is that?

              barduinoB 1 Reply Last reply
              0
              • greglG gregl

                Nice work and great idea.

                When I was getting started I too didn't have enough arduinos/radios to test different bits with it was a pain...or wanting to try out Hek's latest and greatest sensor/sketch to see what it looks like in Vera/Imperihome... but I never thought to create a sketch to just pretend it had the hardware...great thinking!

                Q: What GUI is that?

                barduinoB Offline
                barduinoB Offline
                barduino
                wrote on last edited by
                #7

                @gregl

                I'm one of the crazy ones who decided to build it own controller (see here: Meet HAALL)

                Still very much work in progress, but I needed this MockMySensors to get it going.

                Cheers

                1 Reply Last reply
                0
                • greglG Offline
                  greglG Offline
                  gregl
                  Hero Member
                  wrote on last edited by
                  #8

                  Wow - nice work again! Im in bed with Vera and looking at OpenHAB, but what you have created looks very nice and a good start!

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    TimO
                    Hero Member
                    wrote on last edited by
                    #9

                    Very good idea! Thanks a lot!
                    I've tested it against my OH2 binding and it works like a charm.

                    One thing didn't work though, for S_DIMMER there is a value of 255 submitted, which was read from the eeprom. At this point OH2 grumbles because the value is >100%. ;-)

                    barduinoB 1 Reply Last reply
                    0
                    • barduinoB barduino

                      Hi Folks

                      Did a major refactor on this thing and was able to do some preliminery testing.

                      Due to memory limitations on the Arduino, you now can comment/uncomment the sensors you would like to test. I was able to test about 12 sensors at a time (if i turn off the MySensor library debug).

                      It is able to fake/mock the 24 sensors on the 1.4.1 MySensors Library.

                      Nest steps will be:

                      • remove the read/write from the eprom

                      • include the extra sensors supported by library version 1.5.

                      • Implement a way to request sensor information (where it makes sense)

                      Not necessarily in this order...

                      With this I now have plenty of information to use in my controller HAALL

                      It has also made a very good exercise in creating MySensors code.

                      By the way I would like some advice from the arduino experts here....

                      As I mentioned you can comment/uncomment the sensors declarations on the beginning, I use a lot of #ifdef in the code.

                      My question is: Is there a more elegant solution for this?

                      e.g. for the dimmer sensor:

                      //declaration
                      #define ID_S_DIMMER                   5
                      ---
                      //Message
                      #ifdef ID_S_DIMMER
                        MyMessage msg_S_DIMMER(ID_S_DIMMER,V_DIMMER);
                      #endif
                      ---
                      //set up - presentation
                      #ifdef ID_S_DIMMER
                          Serial.println("  S_DIMMER");
                          gw.present(ID_S_DIMMER,S_DIMMER);
                          gw.wait(SHORT_WAIT);
                        #endif
                      ---
                      // loop
                      #ifdef ID_S_DIMMER
                          dimmer();
                        #endif
                      ---
                      // read function
                      #ifdef ID_S_DIMMER
                      void dimmer(){
                      
                        int dimmerVal = gw.loadState(ID_S_DIMMER);
                        
                        Serial.print("Dimmer is set to: " );
                        Serial.println(dimmerVal);
                        
                        gw.send(msg_S_DIMMER.set(dimmerVal));
                      
                      }
                      #endif
                      ---
                      // incoming message switch
                      #ifdef ID_S_DIMMER
                          case V_DIMMER:
                                if ((message.getInt()<0)||(message.getInt()>100)) {
                                  Serial.println( "V_DIMMER data invalid (should be 0..100)" );
                                  break;
                                }
                                gw.saveState(ID_S_DIMMER, message.getInt());
                                Serial.print("Incoming change for ID_S_DIMMER:");
                                Serial.print(message.sensor);
                                Serial.print(", New status: ");
                                Serial.println(message.getInt());
                          break;
                          #endif
                      

                      Also, suggestions to remove the read/write from the eprom are welcome.

                      For those who are building custom controllers, the comments on the v1.5 library help to clarify a few things.

                      For example, there is no formal relation between the sensor type and the message type (and to me it wasn't always obvious), however that relation is somewhat establshed in the comments of lib 1.5.

                      Thanks guys.

                      As always, feedback is very welcome!!!!

                      Cheers

                      AWIA Offline
                      AWIA Offline
                      AWI
                      Hero Member
                      wrote on last edited by AWI
                      #10

                      @barduino said:

                      My question is: Is there a more elegant solution for this?

                      Not very elegant, but just a different idea. Ability to extend it to more then 24 sensors and 1.5. I built it to test my own controller script. Not complete yet...I doubt it will ever be ;)

                      /*
                       PROJECT: MySensors
                       PROGRAMMER: AWI
                       DATE: 10 august 2015
                       FILE: AWI_Universal_Test_50.ino
                       LICENSE: Public domain
                         -in conjunction with MySensors
                        
                       SUMMARY:
                      	multisensor for controller (sensor)testing
                      	
                       Setup: sends values for al sensor specified in setup array 
                        
                       */
                      #include <MySensor.h>  
                      #include <SPI.h>
                      
                      const int NODE_ID = 50;  		  		// fixed MySensors node ID
                      const int NoSensors = 36; 
                      const int NoTests = 40; 
                      
                      // Sensor array: defines the sensors { Sensor_type (S_LIGHT) }, index number = sensor_id minus 1
                      byte MySensorList[NoSensors]={
                      	S_DOOR, // Door sensor, V_TRIPPED, V_ARMED
                      	S_MOTION,  // Motion sensor, V_TRIPPED, V_ARMED 
                      	S_SMOKE,  // Smoke sensor, V_TRIPPED, V_ARMED
                      	S_BINARY, // Binary light or relay, V_STATUS (or V_LIGHT), V_WATT (same as S_LIGHT)
                      	S_DIMMER, // Dimmable light or fan device, V_STATUS (on/off), V_DIMMER (dimmer level 0-100), V_WATT
                      	S_COVER, // Blinds or window cover, V_UP, V_DOWN, V_STOP, V_DIMMER (open/close to a percentage)
                      	S_TEMP, // Temperature sensor, V_TEMP
                      	S_HUM, // Humidity sensor, V_HUM
                      	S_BARO, // Barometer sensor, V_PRESSURE, V_FORECAST
                      	S_WIND, // Wind sensor, V_WIND, V_GUST
                      	S_RAIN, // Rain sensor, V_RAIN, V_RAINRATE
                      	S_UV, // Uv sensor, V_UV
                      	S_WEIGHT, // Personal scale sensor, V_WEIGHT, V_IMPEDANCE
                      	S_POWER, // Power meter, V_WATT, V_KWH
                      	S_HEATER, // Header device, V_HVAC_SETPOINT_HEAT, V_HVAC_FLOW_STATE
                      	S_DISTANCE, // Distance sensor, V_DISTANCE
                      	S_LIGHT_LEVEL, // Light level sensor, V_LIGHT_LEVEL (uncalibrated in percentage),  V_LEVEL (light level in lux)
                      	S_ARDUINO_NODE, // Used (internally) for presenting a non-repeating Arduino node
                      	S_ARDUINO_REPEATER_NODE, // Used (internally) for presenting a repeating Arduino node 
                      	S_LOCK, // Lock device, V_LOCK_STATUS
                      	S_IR, // Ir device, V_IR_SEND, V_IR_RECEIVE
                      	S_WATER, // Water meter, V_FLOW, V_VOLUME
                      	S_AIR_QUALITY, // Air quality sensor, V_LEVEL
                      	S_CUSTOM, // Custom sensor 
                      	S_DUST, // Dust sensor, V_LEVEL
                      	S_SCENE_CONTROLLER, // Scene controller device, V_SCENE_ON, V_SCENE_OFF. 
                      	S_RGB_LIGHT, // RGB light. Send color component data using V_RGB. Also supports V_WATT 
                      	S_RGBW_LIGHT, // RGB light with an additional White component. Send data using V_RGBW. Also supports V_WATT
                      	S_COLOR_SENSOR,  // Color sensor, send color information using V_RGB
                      	S_HVAC, // Thermostat/HVAC device. V_HVAC_SETPOINT_HEAT, V_HVAC_SETPOINT_COLD, V_HVAC_FLOW_STATE, V_HVAC_FLOW_MODE
                      	S_MULTIMETER, // Multimeter device, V_VOLTAGE, V_CURRENT, V_IMPEDANCE 
                      	S_SPRINKLER,  // Sprinkler, V_STATUS (turn on/off), V_TRIPPED (if fire detecting device)
                      	S_WATER_LEAK, // Water leak sensor, V_TRIPPED, V_ARMED
                      	S_SOUND, // Sound sensor, V_TRIPPED, V_ARMED, V_LEVEL (sound level in dB)
                      	S_VIBRATION, // Vibration sensor, V_TRIPPED, V_ARMED, V_LEVEL (vibration in Hz)
                      	S_MOISTURE, // Moisture sensor, V_TRIPPED, V_ARMED, V_LEVEL (water content or moisture in percentage?) 
                      };
                      
                      // sensor data types
                      // typedef enum {P_STRING, P_BYTE, P_INT16, P_UINT16, P_LONG32, P_ULONG32, P_CUSTOM, P_FLOAT32 } MyTypes ;
                      /*
                      */
                      
                      // Test array: defines the sensor test patterns
                      // { sensorId ; sensorMessage ; type (MyTypes) ; lowValue(byte) ; highValue(byte) ; step }
                      // integer values take normal step, float values take reciproke step
                      int myTestData[NoTests][6]={
                       {0, V_TRIPPED, P_BYTE, 30, 50, 2}, // DOOR
                       {1, V_TRIPPED, P_BYTE, 30, 40, 2},  // MOTION
                       {2, V_TRIPPED, P_BYTE, 30, 30, 2},  // SMOKE
                       {3, V_STATUS, P_BYTE, 30, 40, 2},  // BINARY
                       {4, V_PERCENTAGE, P_BYTE, 30, 30, 2},  // DIMMER
                       {5, V_PERCENTAGE, P_BYTE, 30, 40, 2},  // COVER 
                       {6, V_TEMP, P_FLOAT32, 30, 30, 2},  // TEMP
                       {7, V_HUM, P_FLOAT32, 30, 40, 2},  // HUM
                       {8, V_PRESSURE, P_FLOAT32, 30, 30, 2},  // BARO
                       {9, V_WIND, P_BYTE, 30, 40, 2},  // WIND
                       {10, V_RAIN, P_BYTE, 30, 30, 2}, // RAIN
                       {11, V_UV, P_BYTE, 30, 40, 2}, // UV
                       {12, V_WEIGHT, P_BYTE, 30, 30, 2}, // WEIGHT
                       {13, V_KWH, P_FLOAT32, 30, 40, 2}, // POWER
                       {13, V_WATT, P_FLOAT32, 30, 40, 2}, // POWER
                       {14, V_HEATER, P_BYTE, 30, 30, 2}, // HEATER
                       {15, V_DISTANCE, P_BYTE, 30, 40, 2}, // DISTANCE
                       {16, V_LIGHT_LEVEL, P_BYTE, 30, 50, 2}, // LIGHT_LEVEL
                       {19, V_LOCK_STATUS, P_BYTE, 30, 40, 2}, // LOCK
                       {20, V_IR_SEND, P_BYTE, 30, 30, 2}, // IR
                       {20, V_IR_RECEIVE, P_BYTE, 30, 30, 2}, // IR
                       {21, V_VOLUME, P_BYTE, 30, 40, 2}, // WATER
                       {22, V_LEVEL, P_FLOAT32, 30, 30, 2}, // AIR QUALITY
                       {23, V_STATUS, P_BYTE, 30, 40, 2}, // CUSTOM
                       {24, V_LEVEL, P_BYTE, 30, 30, 2}, // DUST
                       {25, V_SCENE_ON, P_BYTE, 30, 40, 2},  // SCENE
                       {25, V_SCENE_OFF, P_BYTE, 30, 40, 2},  // SCENE
                       {26, V_RGB, P_ULONG32, 30, 30, 2},  // RGB
                       {27, V_RGBW, P_BYTE, 30, 40, 2},  // RGBW
                       {28, V_RGB, P_BYTE, 30, 30, 2},  // COLOR
                       {29, V_HVAC_SETPOINT_HEAT, P_BYTE, 30, 40, 2},  // HVAC
                       {30, V_VOLTAGE, P_BYTE, 30, 30, 2},  // MULTIMETER
                       {30, V_CURRENT, P_BYTE, 30, 30, 2},  // MULTIMETER
                       {30, V_IMPEDANCE, P_BYTE, 30, 30, 2},  // MULTIMETER
                       {31, V_STATUS, P_BYTE, 30, 40, 2},  // SRINKLER
                       {32, V_TRIPPED, P_BYTE, 30, 50, 2},  // WATER_LEAK
                       {33, V_TRIPPED, P_BYTE, 30, 40, 2},  // SOUND
                       {34, V_TRIPPED, P_BYTE, 30, 30, 2},  // VIBRATION
                       {35, V_TRIPPED, P_BYTE, 30, 40, 2},  // MOISTURE
                      };
                      
                      
                      // initialize MySensors
                      MyTransportNRF24 transport(7, 8); // Ceech board, 3.3v (7,8)  (pin default 9,10)
                      MySensor gw(transport); 	      			
                      // Initialize messages, not used here
                      MyMessage Msg;                    // instantiate message to fill "on the fly
                      
                      // storage of last values - if you onlys want to send changes (I don't)
                      float lastHum, lastTemp, lastPressure, lastLux ;
                      unsigned long SLEEP_PERIOD = 1000 ;   // Sleep period in ms)  
                      unsigned long loopDelay = 1000 ;      // Sleep period in ms)  
                      
                      void setup() {
                        Serial.println("\n  Stress test for Mysensors network (201508).\n");
                        gw.begin(incomingMessage, NODE_ID); 											// start MySensors, manual set node ID
                        // Send the sketch version information to the gateway and Controller
                        gw.sendSketchInfo("AWI Universal test 50", "1.0");
                        // Register all sensors to gw (they will be created as child devices)
                        for (int i = 0; i < NoSensors ; i++) { 
                          gw.present(i+1,MySensorList[i] ); // present all sensors in list
                          gw.wait(loopDelay);
                        }
                      }
                      
                      void loop()
                      {
                        gw.process();           // check if message from controller
                        for (int i = 0; i < NoTests ; i++) { 
                          Msg.setSensor(myTestData[i][0]);    // set the sensor number, byte 0
                          Msg.setType(myTestData[i][1]);      // set the sensor type, byte 1
                          switch (myTestData[i][2]) {         // determine type of data for test and use in send
                            case P_BYTE:
                              for (byte j = myTestData[i][3]; i < myTestData[i][4] ; j += myTestData[i][5])
                              {
                                gw.send(Msg.set(i, true ));
                                gw.sleep(SLEEP_PERIOD);
                              }
                            break;
                            case P_INT16:
                              for (int j = myTestData[i][3]; i < myTestData[i][4] ; j += myTestData[i][5])
                              {
                                gw.send(Msg.set(i, true ));
                                gw.sleep(SLEEP_PERIOD);
                              }
                              break;
                            case P_UINT16:
                              for (unsigned int j = myTestData[i][3]; i < myTestData[i][4] ; j += myTestData[i][5])
                              {
                                gw.send(Msg.set(i, true ));
                                gw.sleep(SLEEP_PERIOD);
                              }
                            break;
                            case P_ULONG32:
                              for (unsigned long j = myTestData[i][3]; i < myTestData[i][4] ; j += myTestData[i][5])
                              {
                                gw.send(Msg.set(i, true ));
                                gw.sleep(SLEEP_PERIOD);
                              }
                            break;
                            case P_FLOAT32:
                              for (float j = myTestData[i][3]; i < myTestData[i][4] ; j += 1/myTestData[i][5])  // reciproke step for float
                              {
                                gw.send(Msg.set(i, true ));
                                gw.sleep(SLEEP_PERIOD);
                              }
                            break;
                            default: 
                              // do nothing
                          gw.sleep(SLEEP_PERIOD);
                          }
                        }
                      }
                      
                      void incomingMessage(const MyMessage &message) {
                       Serial.print("Incoming Message");
                       // We wait for V_... value
                      // if (message.type == V_DISTANCE) {
                           Serial.print("Incoming change for sensor:");
                           Serial.print(message.sensor);
                           Serial.print(" (type : ");
                           Serial.print(message.type);
                           Serial.print(")");
                           Serial.print(", status: ");
                           Serial.println(message.getInt());
                       //}
                      }
                      
                      barduinoB 1 Reply Last reply
                      0
                      • T TimO

                        Very good idea! Thanks a lot!
                        I've tested it against my OH2 binding and it works like a charm.

                        One thing didn't work though, for S_DIMMER there is a value of 255 submitted, which was read from the eeprom. At this point OH2 grumbles because the value is >100%. ;-)

                        barduinoB Offline
                        barduinoB Offline
                        barduino
                        wrote on last edited by
                        #11

                        @TimO
                        Yes, it still has the init value of the eprom...
                        Good feed back, i'll initialize it to 0 or something.
                        Thanks

                        1 Reply Last reply
                        0
                        • AWIA AWI

                          @barduino said:

                          My question is: Is there a more elegant solution for this?

                          Not very elegant, but just a different idea. Ability to extend it to more then 24 sensors and 1.5. I built it to test my own controller script. Not complete yet...I doubt it will ever be ;)

                          /*
                           PROJECT: MySensors
                           PROGRAMMER: AWI
                           DATE: 10 august 2015
                           FILE: AWI_Universal_Test_50.ino
                           LICENSE: Public domain
                             -in conjunction with MySensors
                            
                           SUMMARY:
                          	multisensor for controller (sensor)testing
                          	
                           Setup: sends values for al sensor specified in setup array 
                            
                           */
                          #include <MySensor.h>  
                          #include <SPI.h>
                          
                          const int NODE_ID = 50;  		  		// fixed MySensors node ID
                          const int NoSensors = 36; 
                          const int NoTests = 40; 
                          
                          // Sensor array: defines the sensors { Sensor_type (S_LIGHT) }, index number = sensor_id minus 1
                          byte MySensorList[NoSensors]={
                          	S_DOOR, // Door sensor, V_TRIPPED, V_ARMED
                          	S_MOTION,  // Motion sensor, V_TRIPPED, V_ARMED 
                          	S_SMOKE,  // Smoke sensor, V_TRIPPED, V_ARMED
                          	S_BINARY, // Binary light or relay, V_STATUS (or V_LIGHT), V_WATT (same as S_LIGHT)
                          	S_DIMMER, // Dimmable light or fan device, V_STATUS (on/off), V_DIMMER (dimmer level 0-100), V_WATT
                          	S_COVER, // Blinds or window cover, V_UP, V_DOWN, V_STOP, V_DIMMER (open/close to a percentage)
                          	S_TEMP, // Temperature sensor, V_TEMP
                          	S_HUM, // Humidity sensor, V_HUM
                          	S_BARO, // Barometer sensor, V_PRESSURE, V_FORECAST
                          	S_WIND, // Wind sensor, V_WIND, V_GUST
                          	S_RAIN, // Rain sensor, V_RAIN, V_RAINRATE
                          	S_UV, // Uv sensor, V_UV
                          	S_WEIGHT, // Personal scale sensor, V_WEIGHT, V_IMPEDANCE
                          	S_POWER, // Power meter, V_WATT, V_KWH
                          	S_HEATER, // Header device, V_HVAC_SETPOINT_HEAT, V_HVAC_FLOW_STATE
                          	S_DISTANCE, // Distance sensor, V_DISTANCE
                          	S_LIGHT_LEVEL, // Light level sensor, V_LIGHT_LEVEL (uncalibrated in percentage),  V_LEVEL (light level in lux)
                          	S_ARDUINO_NODE, // Used (internally) for presenting a non-repeating Arduino node
                          	S_ARDUINO_REPEATER_NODE, // Used (internally) for presenting a repeating Arduino node 
                          	S_LOCK, // Lock device, V_LOCK_STATUS
                          	S_IR, // Ir device, V_IR_SEND, V_IR_RECEIVE
                          	S_WATER, // Water meter, V_FLOW, V_VOLUME
                          	S_AIR_QUALITY, // Air quality sensor, V_LEVEL
                          	S_CUSTOM, // Custom sensor 
                          	S_DUST, // Dust sensor, V_LEVEL
                          	S_SCENE_CONTROLLER, // Scene controller device, V_SCENE_ON, V_SCENE_OFF. 
                          	S_RGB_LIGHT, // RGB light. Send color component data using V_RGB. Also supports V_WATT 
                          	S_RGBW_LIGHT, // RGB light with an additional White component. Send data using V_RGBW. Also supports V_WATT
                          	S_COLOR_SENSOR,  // Color sensor, send color information using V_RGB
                          	S_HVAC, // Thermostat/HVAC device. V_HVAC_SETPOINT_HEAT, V_HVAC_SETPOINT_COLD, V_HVAC_FLOW_STATE, V_HVAC_FLOW_MODE
                          	S_MULTIMETER, // Multimeter device, V_VOLTAGE, V_CURRENT, V_IMPEDANCE 
                          	S_SPRINKLER,  // Sprinkler, V_STATUS (turn on/off), V_TRIPPED (if fire detecting device)
                          	S_WATER_LEAK, // Water leak sensor, V_TRIPPED, V_ARMED
                          	S_SOUND, // Sound sensor, V_TRIPPED, V_ARMED, V_LEVEL (sound level in dB)
                          	S_VIBRATION, // Vibration sensor, V_TRIPPED, V_ARMED, V_LEVEL (vibration in Hz)
                          	S_MOISTURE, // Moisture sensor, V_TRIPPED, V_ARMED, V_LEVEL (water content or moisture in percentage?) 
                          };
                          
                          // sensor data types
                          // typedef enum {P_STRING, P_BYTE, P_INT16, P_UINT16, P_LONG32, P_ULONG32, P_CUSTOM, P_FLOAT32 } MyTypes ;
                          /*
                          */
                          
                          // Test array: defines the sensor test patterns
                          // { sensorId ; sensorMessage ; type (MyTypes) ; lowValue(byte) ; highValue(byte) ; step }
                          // integer values take normal step, float values take reciproke step
                          int myTestData[NoTests][6]={
                           {0, V_TRIPPED, P_BYTE, 30, 50, 2}, // DOOR
                           {1, V_TRIPPED, P_BYTE, 30, 40, 2},  // MOTION
                           {2, V_TRIPPED, P_BYTE, 30, 30, 2},  // SMOKE
                           {3, V_STATUS, P_BYTE, 30, 40, 2},  // BINARY
                           {4, V_PERCENTAGE, P_BYTE, 30, 30, 2},  // DIMMER
                           {5, V_PERCENTAGE, P_BYTE, 30, 40, 2},  // COVER 
                           {6, V_TEMP, P_FLOAT32, 30, 30, 2},  // TEMP
                           {7, V_HUM, P_FLOAT32, 30, 40, 2},  // HUM
                           {8, V_PRESSURE, P_FLOAT32, 30, 30, 2},  // BARO
                           {9, V_WIND, P_BYTE, 30, 40, 2},  // WIND
                           {10, V_RAIN, P_BYTE, 30, 30, 2}, // RAIN
                           {11, V_UV, P_BYTE, 30, 40, 2}, // UV
                           {12, V_WEIGHT, P_BYTE, 30, 30, 2}, // WEIGHT
                           {13, V_KWH, P_FLOAT32, 30, 40, 2}, // POWER
                           {13, V_WATT, P_FLOAT32, 30, 40, 2}, // POWER
                           {14, V_HEATER, P_BYTE, 30, 30, 2}, // HEATER
                           {15, V_DISTANCE, P_BYTE, 30, 40, 2}, // DISTANCE
                           {16, V_LIGHT_LEVEL, P_BYTE, 30, 50, 2}, // LIGHT_LEVEL
                           {19, V_LOCK_STATUS, P_BYTE, 30, 40, 2}, // LOCK
                           {20, V_IR_SEND, P_BYTE, 30, 30, 2}, // IR
                           {20, V_IR_RECEIVE, P_BYTE, 30, 30, 2}, // IR
                           {21, V_VOLUME, P_BYTE, 30, 40, 2}, // WATER
                           {22, V_LEVEL, P_FLOAT32, 30, 30, 2}, // AIR QUALITY
                           {23, V_STATUS, P_BYTE, 30, 40, 2}, // CUSTOM
                           {24, V_LEVEL, P_BYTE, 30, 30, 2}, // DUST
                           {25, V_SCENE_ON, P_BYTE, 30, 40, 2},  // SCENE
                           {25, V_SCENE_OFF, P_BYTE, 30, 40, 2},  // SCENE
                           {26, V_RGB, P_ULONG32, 30, 30, 2},  // RGB
                           {27, V_RGBW, P_BYTE, 30, 40, 2},  // RGBW
                           {28, V_RGB, P_BYTE, 30, 30, 2},  // COLOR
                           {29, V_HVAC_SETPOINT_HEAT, P_BYTE, 30, 40, 2},  // HVAC
                           {30, V_VOLTAGE, P_BYTE, 30, 30, 2},  // MULTIMETER
                           {30, V_CURRENT, P_BYTE, 30, 30, 2},  // MULTIMETER
                           {30, V_IMPEDANCE, P_BYTE, 30, 30, 2},  // MULTIMETER
                           {31, V_STATUS, P_BYTE, 30, 40, 2},  // SRINKLER
                           {32, V_TRIPPED, P_BYTE, 30, 50, 2},  // WATER_LEAK
                           {33, V_TRIPPED, P_BYTE, 30, 40, 2},  // SOUND
                           {34, V_TRIPPED, P_BYTE, 30, 30, 2},  // VIBRATION
                           {35, V_TRIPPED, P_BYTE, 30, 40, 2},  // MOISTURE
                          };
                          
                          
                          // initialize MySensors
                          MyTransportNRF24 transport(7, 8); // Ceech board, 3.3v (7,8)  (pin default 9,10)
                          MySensor gw(transport); 	      			
                          // Initialize messages, not used here
                          MyMessage Msg;                    // instantiate message to fill "on the fly
                          
                          // storage of last values - if you onlys want to send changes (I don't)
                          float lastHum, lastTemp, lastPressure, lastLux ;
                          unsigned long SLEEP_PERIOD = 1000 ;   // Sleep period in ms)  
                          unsigned long loopDelay = 1000 ;      // Sleep period in ms)  
                          
                          void setup() {
                            Serial.println("\n  Stress test for Mysensors network (201508).\n");
                            gw.begin(incomingMessage, NODE_ID); 											// start MySensors, manual set node ID
                            // Send the sketch version information to the gateway and Controller
                            gw.sendSketchInfo("AWI Universal test 50", "1.0");
                            // Register all sensors to gw (they will be created as child devices)
                            for (int i = 0; i < NoSensors ; i++) { 
                              gw.present(i+1,MySensorList[i] ); // present all sensors in list
                              gw.wait(loopDelay);
                            }
                          }
                          
                          void loop()
                          {
                            gw.process();           // check if message from controller
                            for (int i = 0; i < NoTests ; i++) { 
                              Msg.setSensor(myTestData[i][0]);    // set the sensor number, byte 0
                              Msg.setType(myTestData[i][1]);      // set the sensor type, byte 1
                              switch (myTestData[i][2]) {         // determine type of data for test and use in send
                                case P_BYTE:
                                  for (byte j = myTestData[i][3]; i < myTestData[i][4] ; j += myTestData[i][5])
                                  {
                                    gw.send(Msg.set(i, true ));
                                    gw.sleep(SLEEP_PERIOD);
                                  }
                                break;
                                case P_INT16:
                                  for (int j = myTestData[i][3]; i < myTestData[i][4] ; j += myTestData[i][5])
                                  {
                                    gw.send(Msg.set(i, true ));
                                    gw.sleep(SLEEP_PERIOD);
                                  }
                                  break;
                                case P_UINT16:
                                  for (unsigned int j = myTestData[i][3]; i < myTestData[i][4] ; j += myTestData[i][5])
                                  {
                                    gw.send(Msg.set(i, true ));
                                    gw.sleep(SLEEP_PERIOD);
                                  }
                                break;
                                case P_ULONG32:
                                  for (unsigned long j = myTestData[i][3]; i < myTestData[i][4] ; j += myTestData[i][5])
                                  {
                                    gw.send(Msg.set(i, true ));
                                    gw.sleep(SLEEP_PERIOD);
                                  }
                                break;
                                case P_FLOAT32:
                                  for (float j = myTestData[i][3]; i < myTestData[i][4] ; j += 1/myTestData[i][5])  // reciproke step for float
                                  {
                                    gw.send(Msg.set(i, true ));
                                    gw.sleep(SLEEP_PERIOD);
                                  }
                                break;
                                default: 
                                  // do nothing
                              gw.sleep(SLEEP_PERIOD);
                              }
                            }
                          }
                          
                          void incomingMessage(const MyMessage &message) {
                           Serial.print("Incoming Message");
                           // We wait for V_... value
                          // if (message.type == V_DISTANCE) {
                               Serial.print("Incoming change for sensor:");
                               Serial.print(message.sensor);
                               Serial.print(" (type : ");
                               Serial.print(message.type);
                               Serial.print(")");
                               Serial.print(", status: ");
                               Serial.println(message.getInt());
                           //}
                          }
                          
                          barduinoB Offline
                          barduinoB Offline
                          barduino
                          wrote on last edited by
                          #12

                          @AWI
                          Very interesting and compacts, probably avoids the memory limitations on UNO.
                          Great feedback, thanks!

                          1 Reply Last reply
                          0
                          • barduinoB barduino

                            Hi Folks,

                            While building my custom controller i've run into a problem of not having enough arduinos/material to produce each type of supported sensors.

                            So in order to create visualizations for each sensor I've decided to create an arduino sketch to fake sensors and send dummy data.

                            Of course I'm running out of Global/Local variable space half way through (about 12 sensors, even with debug off) but plan to comment/uncomment the sersors to fake.

                            Also I havent had a proper chance to test this.

                            Is anyone interested in this?
                            Want to give it a go?
                            Check it on MySensors Github

                            Usual stuff, open source, as is, terrible code, blá blá blá, have fun!

                            Cheers

                            A Offline
                            A Offline
                            akbooer
                            wrote on last edited by
                            #13

                            @barduino

                            Please excuse newness and ignorance (which go hand-in-hand.) Do I understand correctly that this sketch replaces a serial gateway? If so, what changes might be required to make this work for an ethernet gateway? Or, perhaps, do I have this all completely wrong?

                            I'm wanting to check out an ethernet connection between a Vera controller (or equivalent) and a Uno, on which I plan to run an internet gateway when I have built some sensors. Not yet having connected a radio, can I use this to mock up some sensors sending data to the Vera gateway plugin, just from an ethernet connected Uno?

                            Any help appreciated.

                            barduinoB 1 Reply Last reply
                            0
                            • A akbooer

                              @barduino

                              Please excuse newness and ignorance (which go hand-in-hand.) Do I understand correctly that this sketch replaces a serial gateway? If so, what changes might be required to make this work for an ethernet gateway? Or, perhaps, do I have this all completely wrong?

                              I'm wanting to check out an ethernet connection between a Vera controller (or equivalent) and a Uno, on which I plan to run an internet gateway when I have built some sensors. Not yet having connected a radio, can I use this to mock up some sensors sending data to the Vera gateway plugin, just from an ethernet connected Uno?

                              Any help appreciated.

                              barduinoB Offline
                              barduinoB Offline
                              barduino
                              wrote on last edited by
                              #14

                              @akbooer

                              Hi, this sketch does not replace a gateway. It simulates a node with many sensors.

                              So its like having an arduino with 24 sensors connected to it (all fake, done by software) it still needs the gateway and radios, etc.

                              Some folks here in the forum have made experiences in creating sensors directly on a gateway, not sure if it is supported.

                              If so, it might be possible to Mock sensors in the gatway using such a technique...

                              Food for thought/investigation,

                              Cheers

                              1 Reply Last reply
                              0
                              • A Offline
                                A Offline
                                akbooer
                                wrote on last edited by
                                #15

                                OK and thanks for the quick response!
                                I knew I knew nothing.

                                So, just to be sure, I run this on an Arduino with a radio, but not sensors. This is going to talk to my Arduino gateway, with radio, and either serial or ethernet connection to the controller, whichever I choose.

                                barduinoB 1 Reply Last reply
                                0
                                • A akbooer

                                  OK and thanks for the quick response!
                                  I knew I knew nothing.

                                  So, just to be sure, I run this on an Arduino with a radio, but not sensors. This is going to talk to my Arduino gateway, with radio, and either serial or ethernet connection to the controller, whichever I choose.

                                  barduinoB Offline
                                  barduinoB Offline
                                  barduino
                                  wrote on last edited by
                                  #16

                                  @akbooer

                                  That is correct.

                                  Also, because i'm having some issues updating the source code in git hub here is the latest version (lib 1.5) MockMySensors.ino and l(lib 1.4) FakeMySensorsOrig.ino

                                  Cheers

                                  1 Reply Last reply
                                  1
                                  • A Offline
                                    A Offline
                                    akbooer
                                    wrote on last edited by
                                    #17

                                    Thanks so much.

                                    1 Reply Last reply
                                    0
                                    • ch3b7C Offline
                                      ch3b7C Offline
                                      ch3b7
                                      wrote on last edited by ch3b7
                                      #18

                                      all sensors present good but when finish i get a loop sended:

                                      send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                      send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                      send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                      send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                      send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                      send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                      send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                      send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                      send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                      send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                      send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                      send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                      send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                      send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                      send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                      send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                      send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                      send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                      send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0

                                      im use (lib 1.5) MockMySensors.ino

                                      barduinoB 1 Reply Last reply
                                      0
                                      • ch3b7C ch3b7

                                        all sensors present good but when finish i get a loop sended:

                                        send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                        send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                        send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                        send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                        send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                        send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                        send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                        send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                        send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                        send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                        send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                        send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                        send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                        send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                        send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                        send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                        send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                        send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                        send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0

                                        im use (lib 1.5) MockMySensors.ino

                                        barduinoB Offline
                                        barduinoB Offline
                                        barduino
                                        wrote on last edited by
                                        #19

                                        @ch3b7

                                        Very interesting.
                                        I was not able to repruduce what you are describing above.

                                        According to your message we have:

                                        • Node 50 sending to node 0

                                        • Child sensor id 0

                                        • Message type 1 : SET

                                        • MessageSub Type 16: V_TRIPPED

                                        • Payload type 7: P_CUSTOM

                                        • Payload length 5

                                        Which is very strange.
                                        In MockMySensors there is no childid=0, the first sensor is #define ID_S_DOOR 1 and the node ID is set to 254 (but perhpas you have changed this)
                                        Also V_TRIPPED should be sending a bolean value...

                                        Could you upload your scetch?

                                        here is my log: SetUP

                                        send: 254-254-0-0 s=255,c=0,t=17,pt=0,l=3,sg=0,st=ok:1.5
                                        send: 254-254-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
                                        read: 0-0-254 s=255,c=3,t=6,pt=0,l=1,sg=0:M
                                        sensor started, id=254, parent=0, distance=1
                                        GW Started
                                        Send Sketch Info: send: 254-254-0-0 s=255,c=3,t=11,pt=0,l=14,sg=0,st=ok:MockMySensors 
                                        send: 254-254-0-0 s=255,c=3,t=12,pt=0,l=4,sg=0,st=ok:v0.3
                                        MockMySensors v0.3
                                        Get Config: Metric
                                        Presenting Nodes
                                        ________________
                                          S_DOOR
                                        send: 254-254-0-0 s=1,c=0,t=0,pt=0,l=0,sg=0,st=ok:
                                          S_MOTION
                                        send: 254-254-0-0 s=2,c=0,t=1,pt=0,l=0,sg=0,st=ok:
                                          S_SMOKE
                                        send: 254-254-0-0 s=3,c=0,t=2,pt=0,l=0,sg=0,st=ok:
                                          S_LIGHT
                                        send: 254-254-0-0 s=4,c=0,t=3,pt=0,l=0,sg=0,st=ok:
                                          S_DIMMER
                                        send: 254-254-0-0 s=5,c=0,t=4,pt=0,l=0,sg=0,st=ok:
                                          S_COVER
                                        send: 254-254-0-0 s=6,c=0,t=5,pt=0,l=0,sg=0,st=ok:
                                          S_TMEP
                                        send: 254-254-0-0 s=7,c=0,t=6,pt=0,l=0,sg=0,st=ok:
                                          S_HUM
                                        send: 254-254-0-0 s=8,c=0,t=7,pt=0,l=0,sg=0,st=ok:
                                          S_BARO
                                        send: 254-254-0-0 s=9,c=0,t=8,pt=0,l=0,sg=0,st=ok:
                                          S_WIND
                                        send: 254-254-0-0 s=10,c=0,t=9,pt=0,l=0,sg=0,st=ok:
                                          S_RAIN
                                        send: 254-254-0-0 s=11,c=0,t=10,pt=0,l=0,sg=0,st=ok:
                                          S_UV
                                        send: 254-254-0-0 s=12,c=0,t=11,pt=0,l=0,sg=0,st=ok:
                                          S_WEIGHT
                                        send: 254-254-0-0 s=13,c=0,t=12,pt=0,l=0,sg=0,st=ok:
                                          S_POWER
                                        send: 254-254-0-0 s=14,c=0,t=13,pt=0,l=0,sg=0,st=ok:
                                          S_DISTANCE
                                        send: 254-254-0-0 s=16,c=0,t=15,pt=0,l=0,sg=0,st=ok:
                                          S_LIGHT_LEVEL
                                        send: 254-254-0-0 s=17,c=0,t=16,pt=0,l=0,sg=0,st=ok:
                                          S_LOCK
                                        send: 254-254-0-0 s=18,c=0,t=19,pt=0,l=0,sg=0,st=ok:
                                          S_IR
                                        send: 254-254-0-0 s=19,c=0,t=20,pt=0,l=0,sg=0,st=ok:
                                          S_WATER
                                        send: 254-254-0-0 s=20,c=0,t=21,pt=0,l=0,sg=0,st=ok:
                                          S_AIR_QUALITY
                                        send: 254-254-0-0 s=21,c=0,t=22,pt=0,l=0,sg=0,st=ok:
                                          S_SCENE_CONTROLLER
                                        send: 254-254-0-0 s=23,c=0,t=25,pt=0,l=0,sg=0,st=ok:
                                          S_CUSTOM
                                        send: 254-254-0-0 s=24,c=0,t=23,pt=0,l=0,sg=0,st=ok:
                                        ________________
                                        

                                        And the loop section

                                        ########################
                                        RandomNumber:76
                                        Send Battery Level
                                        send: 254-254-0-0 s=255,c=3,t=0,pt=1,l=1,sg=0,st=ok:76
                                        Request Time
                                        send: 254-254-0-0 s=255,c=3,t=1,pt=0,l=0,sg=0,st=ok:
                                        read: 0-0-254 s=255,c=3,t=1,pt=0,l=10,sg=0:1439720967
                                        Time value received: 1439720967
                                        Motion is: Quiet
                                        send: 254-254-0-0 s=2,c=1,t=16,pt=2,l=2,sg=0,st=ok:0
                                        Smoke is: Quiet
                                        send: 254-254-0-0 s=3,c=1,t=16,pt=2,l=2,sg=0,st=ok:0
                                        Light is: On
                                        send: 254-254-0-0 s=4,c=1,t=2,pt=2,l=2,sg=0,st=ok:1
                                        Dimmer is set to: 255
                                        send: 254-254-0-0 s=5,c=1,t=3,pt=2,l=2,sg=0,st=ok:255
                                        Cover is : Idle
                                        send: 254-254-0-0 s=6,c=1,t=31,pt=2,l=2,sg=0,st=ok:31
                                        Temperature is: 34
                                        send: 254-254-0-0 s=7,c=1,t=0,pt=4,l=4,sg=0,st=ok:34
                                        Humitidty is: 76
                                        send: 254-254-0-0 s=8,c=1,t=1,pt=4,l=4,sg=0,st=ok:76
                                        Atmosferic Pressure is: 103363
                                        send: 254-254-0-0 s=9,c=1,t=4,pt=4,l=4,sg=0,st=ok:103363
                                        Weather forecast: unstable
                                        send: 254-254-0-0 s=9,c=1,t=5,pt=0,l=8,sg=0,st=ok:unstable
                                        Wind Speed is: 76
                                        send: 254-254-0-0 s=10,c=1,t=8,pt=4,l=4,sg=0,st=ok:76
                                        Wind Gust is: 86
                                        send: 254-254-0-0 s=10,c=1,t=9,pt=4,l=4,sg=0,st=ok:86
                                        Wind Direction is: 272
                                        send: 254-254-0-0 s=10,c=1,t=10,pt=4,l=4,sg=0,st=ok:272
                                        Rain ammount  is: 76
                                        send: 254-254-0-0 s=11,c=1,t=6,pt=4,l=4,sg=0,st=ok:76
                                        Rain rate  is: 1
                                        send: 254-254-0-0 s=11,c=1,t=7,pt=7,l=5,sg=0,st=ok:1.0
                                        Ultra Violet level is: 11
                                        send: 254-254-0-0 s=12,c=1,t=11,pt=4,l=4,sg=0,st=ok:11
                                        Weight is: 113
                                        send: 254-254-0-0 s=13,c=1,t=12,pt=4,l=4,sg=0,st=ok:113
                                        Impedance is: 113
                                        send: 254-254-0-0 s=14,c=1,t=14,pt=4,l=4,sg=0,st=ok:113
                                        Watt is: 113
                                        send: 254-254-0-0 s=14,c=1,t=17,pt=4,l=4,sg=0,st=ok:113
                                        KWH is: 113
                                        send: 254-254-0-0 s=14,c=1,t=18,pt=4,l=4,sg=0,st=ok:113
                                        Voltage is: 113
                                        send: 254-254-0-0 s=14,c=1,t=38,pt=4,l=4,sg=0,st=ok:113
                                        Current is: 113
                                        send: 254-254-0-0 s=14,c=1,t=39,pt=4,l=4,sg=0,st=ok:113
                                        Distance is: 113
                                        send: 254-254-0-0 s=16,c=1,t=13,pt=4,l=4,sg=0,st=ok:113
                                        Light is: 113
                                        send: 254-254-0-0 s=17,c=1,t=23,pt=4,l=4,sg=0,st=ok:113
                                        Lock is: On
                                        send: 254-254-0-0 s=18,c=1,t=36,pt=2,l=2,sg=0,st=ok:1
                                        Infrared is: 255
                                        send: 254-254-0-0 s=19,c=1,t=32,pt=2,l=2,sg=0,st=ok:255
                                        Water flow is: 113
                                        send: 254-254-0-0 s=20,c=1,t=34,pt=4,l=4,sg=0,st=ok:113
                                        Water volume is: 113
                                        send: 254-254-0-0 s=20,c=1,t=35,pt=4,l=4,sg=0,st=ok:113
                                        Air Quality is: 76
                                        send: 254-254-0-0 s=21,c=1,t=24,pt=4,l=4,sg=0,st=ok:76
                                        Scene is: On
                                        send: 254-254-0-0 s=23,c=1,t=19,pt=2,l=2,sg=0,st=ok:1
                                        Custom value is: 76
                                        send: 254-254-0-0 s=24,c=1,t=25,pt=4,l=4,sg=0,st=ok:76
                                        send: 254-254-0-0 s=24,c=1,t=26,pt=4,l=4,sg=0,st=ok:76
                                        send: 254-254-0-0 s=24,c=1,t=27,pt=4,l=4,sg=0,st=ok:76
                                        send: 254-254-0-0 s=24,c=1,t=28,pt=4,l=4,sg=0,st=ok:76
                                        send: 254-254-0-0 s=255,c=3,t=0,pt=1,l=1,sg=0,st=ok:76
                                        #########################
                                        
                                        ch3b7C 1 Reply Last reply
                                        0
                                        • barduinoB barduino

                                          @ch3b7

                                          Very interesting.
                                          I was not able to repruduce what you are describing above.

                                          According to your message we have:

                                          • Node 50 sending to node 0

                                          • Child sensor id 0

                                          • Message type 1 : SET

                                          • MessageSub Type 16: V_TRIPPED

                                          • Payload type 7: P_CUSTOM

                                          • Payload length 5

                                          Which is very strange.
                                          In MockMySensors there is no childid=0, the first sensor is #define ID_S_DOOR 1 and the node ID is set to 254 (but perhpas you have changed this)
                                          Also V_TRIPPED should be sending a bolean value...

                                          Could you upload your scetch?

                                          here is my log: SetUP

                                          send: 254-254-0-0 s=255,c=0,t=17,pt=0,l=3,sg=0,st=ok:1.5
                                          send: 254-254-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
                                          read: 0-0-254 s=255,c=3,t=6,pt=0,l=1,sg=0:M
                                          sensor started, id=254, parent=0, distance=1
                                          GW Started
                                          Send Sketch Info: send: 254-254-0-0 s=255,c=3,t=11,pt=0,l=14,sg=0,st=ok:MockMySensors 
                                          send: 254-254-0-0 s=255,c=3,t=12,pt=0,l=4,sg=0,st=ok:v0.3
                                          MockMySensors v0.3
                                          Get Config: Metric
                                          Presenting Nodes
                                          ________________
                                            S_DOOR
                                          send: 254-254-0-0 s=1,c=0,t=0,pt=0,l=0,sg=0,st=ok:
                                            S_MOTION
                                          send: 254-254-0-0 s=2,c=0,t=1,pt=0,l=0,sg=0,st=ok:
                                            S_SMOKE
                                          send: 254-254-0-0 s=3,c=0,t=2,pt=0,l=0,sg=0,st=ok:
                                            S_LIGHT
                                          send: 254-254-0-0 s=4,c=0,t=3,pt=0,l=0,sg=0,st=ok:
                                            S_DIMMER
                                          send: 254-254-0-0 s=5,c=0,t=4,pt=0,l=0,sg=0,st=ok:
                                            S_COVER
                                          send: 254-254-0-0 s=6,c=0,t=5,pt=0,l=0,sg=0,st=ok:
                                            S_TMEP
                                          send: 254-254-0-0 s=7,c=0,t=6,pt=0,l=0,sg=0,st=ok:
                                            S_HUM
                                          send: 254-254-0-0 s=8,c=0,t=7,pt=0,l=0,sg=0,st=ok:
                                            S_BARO
                                          send: 254-254-0-0 s=9,c=0,t=8,pt=0,l=0,sg=0,st=ok:
                                            S_WIND
                                          send: 254-254-0-0 s=10,c=0,t=9,pt=0,l=0,sg=0,st=ok:
                                            S_RAIN
                                          send: 254-254-0-0 s=11,c=0,t=10,pt=0,l=0,sg=0,st=ok:
                                            S_UV
                                          send: 254-254-0-0 s=12,c=0,t=11,pt=0,l=0,sg=0,st=ok:
                                            S_WEIGHT
                                          send: 254-254-0-0 s=13,c=0,t=12,pt=0,l=0,sg=0,st=ok:
                                            S_POWER
                                          send: 254-254-0-0 s=14,c=0,t=13,pt=0,l=0,sg=0,st=ok:
                                            S_DISTANCE
                                          send: 254-254-0-0 s=16,c=0,t=15,pt=0,l=0,sg=0,st=ok:
                                            S_LIGHT_LEVEL
                                          send: 254-254-0-0 s=17,c=0,t=16,pt=0,l=0,sg=0,st=ok:
                                            S_LOCK
                                          send: 254-254-0-0 s=18,c=0,t=19,pt=0,l=0,sg=0,st=ok:
                                            S_IR
                                          send: 254-254-0-0 s=19,c=0,t=20,pt=0,l=0,sg=0,st=ok:
                                            S_WATER
                                          send: 254-254-0-0 s=20,c=0,t=21,pt=0,l=0,sg=0,st=ok:
                                            S_AIR_QUALITY
                                          send: 254-254-0-0 s=21,c=0,t=22,pt=0,l=0,sg=0,st=ok:
                                            S_SCENE_CONTROLLER
                                          send: 254-254-0-0 s=23,c=0,t=25,pt=0,l=0,sg=0,st=ok:
                                            S_CUSTOM
                                          send: 254-254-0-0 s=24,c=0,t=23,pt=0,l=0,sg=0,st=ok:
                                          ________________
                                          

                                          And the loop section

                                          ########################
                                          RandomNumber:76
                                          Send Battery Level
                                          send: 254-254-0-0 s=255,c=3,t=0,pt=1,l=1,sg=0,st=ok:76
                                          Request Time
                                          send: 254-254-0-0 s=255,c=3,t=1,pt=0,l=0,sg=0,st=ok:
                                          read: 0-0-254 s=255,c=3,t=1,pt=0,l=10,sg=0:1439720967
                                          Time value received: 1439720967
                                          Motion is: Quiet
                                          send: 254-254-0-0 s=2,c=1,t=16,pt=2,l=2,sg=0,st=ok:0
                                          Smoke is: Quiet
                                          send: 254-254-0-0 s=3,c=1,t=16,pt=2,l=2,sg=0,st=ok:0
                                          Light is: On
                                          send: 254-254-0-0 s=4,c=1,t=2,pt=2,l=2,sg=0,st=ok:1
                                          Dimmer is set to: 255
                                          send: 254-254-0-0 s=5,c=1,t=3,pt=2,l=2,sg=0,st=ok:255
                                          Cover is : Idle
                                          send: 254-254-0-0 s=6,c=1,t=31,pt=2,l=2,sg=0,st=ok:31
                                          Temperature is: 34
                                          send: 254-254-0-0 s=7,c=1,t=0,pt=4,l=4,sg=0,st=ok:34
                                          Humitidty is: 76
                                          send: 254-254-0-0 s=8,c=1,t=1,pt=4,l=4,sg=0,st=ok:76
                                          Atmosferic Pressure is: 103363
                                          send: 254-254-0-0 s=9,c=1,t=4,pt=4,l=4,sg=0,st=ok:103363
                                          Weather forecast: unstable
                                          send: 254-254-0-0 s=9,c=1,t=5,pt=0,l=8,sg=0,st=ok:unstable
                                          Wind Speed is: 76
                                          send: 254-254-0-0 s=10,c=1,t=8,pt=4,l=4,sg=0,st=ok:76
                                          Wind Gust is: 86
                                          send: 254-254-0-0 s=10,c=1,t=9,pt=4,l=4,sg=0,st=ok:86
                                          Wind Direction is: 272
                                          send: 254-254-0-0 s=10,c=1,t=10,pt=4,l=4,sg=0,st=ok:272
                                          Rain ammount  is: 76
                                          send: 254-254-0-0 s=11,c=1,t=6,pt=4,l=4,sg=0,st=ok:76
                                          Rain rate  is: 1
                                          send: 254-254-0-0 s=11,c=1,t=7,pt=7,l=5,sg=0,st=ok:1.0
                                          Ultra Violet level is: 11
                                          send: 254-254-0-0 s=12,c=1,t=11,pt=4,l=4,sg=0,st=ok:11
                                          Weight is: 113
                                          send: 254-254-0-0 s=13,c=1,t=12,pt=4,l=4,sg=0,st=ok:113
                                          Impedance is: 113
                                          send: 254-254-0-0 s=14,c=1,t=14,pt=4,l=4,sg=0,st=ok:113
                                          Watt is: 113
                                          send: 254-254-0-0 s=14,c=1,t=17,pt=4,l=4,sg=0,st=ok:113
                                          KWH is: 113
                                          send: 254-254-0-0 s=14,c=1,t=18,pt=4,l=4,sg=0,st=ok:113
                                          Voltage is: 113
                                          send: 254-254-0-0 s=14,c=1,t=38,pt=4,l=4,sg=0,st=ok:113
                                          Current is: 113
                                          send: 254-254-0-0 s=14,c=1,t=39,pt=4,l=4,sg=0,st=ok:113
                                          Distance is: 113
                                          send: 254-254-0-0 s=16,c=1,t=13,pt=4,l=4,sg=0,st=ok:113
                                          Light is: 113
                                          send: 254-254-0-0 s=17,c=1,t=23,pt=4,l=4,sg=0,st=ok:113
                                          Lock is: On
                                          send: 254-254-0-0 s=18,c=1,t=36,pt=2,l=2,sg=0,st=ok:1
                                          Infrared is: 255
                                          send: 254-254-0-0 s=19,c=1,t=32,pt=2,l=2,sg=0,st=ok:255
                                          Water flow is: 113
                                          send: 254-254-0-0 s=20,c=1,t=34,pt=4,l=4,sg=0,st=ok:113
                                          Water volume is: 113
                                          send: 254-254-0-0 s=20,c=1,t=35,pt=4,l=4,sg=0,st=ok:113
                                          Air Quality is: 76
                                          send: 254-254-0-0 s=21,c=1,t=24,pt=4,l=4,sg=0,st=ok:76
                                          Scene is: On
                                          send: 254-254-0-0 s=23,c=1,t=19,pt=2,l=2,sg=0,st=ok:1
                                          Custom value is: 76
                                          send: 254-254-0-0 s=24,c=1,t=25,pt=4,l=4,sg=0,st=ok:76
                                          send: 254-254-0-0 s=24,c=1,t=26,pt=4,l=4,sg=0,st=ok:76
                                          send: 254-254-0-0 s=24,c=1,t=27,pt=4,l=4,sg=0,st=ok:76
                                          send: 254-254-0-0 s=24,c=1,t=28,pt=4,l=4,sg=0,st=ok:76
                                          send: 254-254-0-0 s=255,c=3,t=0,pt=1,l=1,sg=0,st=ok:76
                                          #########################
                                          
                                          ch3b7C Offline
                                          ch3b7C Offline
                                          ch3b7
                                          wrote on last edited by
                                          #20

                                          @barduino

                                          sorry your sketch work good! the problem im have is with the @AWI example!

                                          @AWI

                                          all sensors present good but when finish i get a loop sended:

                                          send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                          send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                          send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                          send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                          send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                          send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                          send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                          send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                          send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                          send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                          send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                          send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                          send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                          send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                          send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                          send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                          send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                          send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0
                                          send: 50-50-0-0 s=0,c=1,t=16,pt=7,l=5,sg=0,st=ok:0.0

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


                                          17

                                          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