Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. Robban
    3. Posts
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Posts made by Robban

    • RE: ESP8266 WiFi gateway port for MySensors

      @rapzak said:

      Hi,

      I have added som support, where the gateway can upload data to emoncms, transparant to other functions (not fully testet):

      in gatewayutil add this in top of file, after the ARDUINO check:

      #define EMONCMS
      
      #ifdef EMONCMS
      static WiFiClient emon_client;
      const char* emon_host = "emoncms.org";  
      const int emon_httpPort = 80; 
      const int emon_addr_offset = 10;
      #endif
      

      Change this function to:

      void incomingMessage(const MyMessage &message) {
      //  if (mGetCommand(message) == C_PRESENTATION && inclusionMode) {
      //	gw.rxBlink(3);
      //   } else {
      //	gw.rxBlink(1);
      //   }
         // Pass along the message from sensors to serial line
         serial(PSTR("%d;%d;%d;%d;%d;%s\n"),message.sender, message.sensor, mGetCommand(message), mGetAck(message), message.type, message.getString(convBuf));
      #ifdef EMONCMS
           if (!emon_client.connect(emon_host, emon_httpPort)) {
            Serial.println("emoncms connection failed");
            }
      
            emon_client.print(String("GET /emoncms/input/post.json?&node="+ String(message.sender+emon_addr_offset)+"&json={"+String(message.sensor)+":"+message.getString(convBuf)+"}&apikey=XXXXXXXXXXXXXXXXXXXXXXXXXXXX\r\n"));
            Serial.println(String("GET /emoncms/input/post.json?&node="+ String(message.sender+emon_addr_offset)+"&json={"+String(message.sensor)+":"+message.getString(convBuf)+"}&apikey=XXXXXXXXXXXXXXXXXXXXXXXXXXXX\r\n"));
      #endif
      } 
      

      It will upload data with NODE ID and Sensor ID from the network, with an offset of emon_addr_offset...

      /Rapzak

      Are there any one that can help me implement this in the dev version? Have a nodemcu 1-0 and got errors uploading the 1.5 version so i cant use that. Tried to fix it but ended up with the dev version.

      posted in Development
      Robban
      Robban