Navigation

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

    Michael M

    @Michael M

    0
    Reputation
    3
    Posts
    138
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Michael M Follow

    Best posts made by Michael M

    This user hasn't posted anything yet.

    Latest posts made by Michael M

    • RE: Actuators receiving extra data

      @AcidUK said:

      int requestedLevel = message.getInt();

      It works like a charm now 🙂 Thank you

      posted in Troubleshooting
      Michael M
      Michael M
    • RE: Actuators receiving extra data

      @AcidUK Perhaps I'm an earlier generation of monkey then you are, because I can't get it to work properly 🙂 Could you please tell me what steps did you take to get this working? I've changed MyMessage.cpp to this:

      /*
      int16_t MyMessage::getInt() const {
      	if (miGetPayloadType() == P_INT16) { 
      		return iValue;
      	} else if (miGetPayloadType() == P_STRING) {
      		return atoi(data);
      	} else {
      		return 0;
      	}
      }
      */
      
      int16_t MyMessage::getInt() const {
          if (miGetPayloadType() == P_INT16) { 
              return iValue;
          } else if (miGetPayloadType() == P_STRING) {
              // Null terminate string according to message length to prevent reading old bytes from data
              char* ca;
              ca = (char *) data;
              ca += miGetLength();
              *ca = '\0';
              
              return atoi(data);
          } else {
              return 0;
          }
      }
      

      Then I reflashed gateway and sensor and the result is the same as before:

      read: 0-0-2 s=0,c=0,t=3,pt=0,l=2,sg=0:35
      351mableLED
      Changing level to 100, from 0
      

      Am I missing something besides my programming skills ? 🙂

      posted in Troubleshooting
      Michael M
      Michael M
    • RE: Actuators receiving extra data

      I'm getting the same behavior with latest dev (as of 27.12.2015). I'm using ESP8266 mqtt client gateway.

      Gateway:

      0;0;3;0;9;Message arrived on topic: mysensorsgwin/2/1/1/1/3
      0;0;3;0;9;send: 0-0-2-2 s=1,c=1,t=3,pt=0,l=2,sg=0,st=ok:50
      0;0;3;0;9;read: 2-2-0 s=1,c=1,t=3,pt=0,l=2,sg=0:50
      0;0;3;0;9;Sending message on topic: mysensorsgwout/2/1/1/1/3
      0;0;3;0;9;read: 2-2-0 s=0,c=1,t=2,pt=2,l=2,sg=0:1
      0;0;3;0;9;Sending message on topic: mysensorsgwout/2/0/1/0/2
      0;0;3;0;9;read: 2-2-0 s=0,c=1,t=3,pt=2,l=2,sg=0:100
      0;0;3;0;9;Sending message on topic: mysensorsgwout/2/0/1/0/3
      

      Sensor:

      read: 0-0-2 s=1,c=1,t=3,pt=0,l=2,sg=0:50
      send: 2-2-0-0 s=1,c=1,t=3,pt=0,l=2,sg=0,st=ok:50
      501mableLED
      Changing level to 100, from 0
      send: 2-2-0-0 s=0,c=1,t=2,pt=2,l=2,sg=0,st=ok:1
      send: 2-2-0-0 s=0,c=1,t=3,pt=2,l=2,sg=0,st=ok:100```
      posted in Troubleshooting
      Michael M
      Michael M