Ok, so I am obviously missing something here, I saw you mention this solution in my searches, but I am unable to output a serialised hex string. My test code below appears to be setting the packetType correctly for the different types but for P_CUSTOM my results are an empty string...
#include <MySensor.h>
#include <SPI.h>
#define CHILD_ID 3
#define MS_CEPIN 8
#define MS_CSPIN 7
MySensor gw(MS_CEPIN, MS_CSPIN);
unsigned int counter=0;
unsigned int counter2=0;
// Change to V_LIGHT if you use S_LIGHT in presentation below
MyMessage msg(CHILD_ID,V_VAR1);
void setup()
{
gw.begin(NULL, 99);
gw.present(CHILD_ID, S_CUSTOM);
}
// some random buffer for testing
char buffer[10] = {'H','e','l','l','o',' ','Y','o','u','\0'};
void loop()
{
//send something periodically
counter++;
if (counter == 0) {
counter2++;
gw.send(msg.set(buffer)); //pt=0 > P_STRING
gw.send(msg.set(counter2)); //pt=3 > P_UINT16
gw.send(msg.set(buffer,5)); //pt=6 > P_CUSTOM
}
}
My gateway returns the following when raw dumping the received serial data (this was the 61st send)...
mysensorsmqtt: serial recv - 0;0;3;0;9;read: 99-99-0 s=3,c=1,t=24,pt=0,l=9:Hello You
mysensorsmqtt: serial recv - 99;3;1;0;24;Hello You
mysensorsmqtt: serial recv - 0;0;3;0;9;read: 99-99-0 s=3,c=1,t=24,pt=3,l=2:61
mysensorsmqtt: serial recv - 99;3;1;0;24;61
mysensorsmqtt: serial recv - 0;0;3;0;9;read: 99-99-0 s=3,c=1,t=24,pt=6,l=5:
mysensorsmqtt: serial recv - 99;3;1;0;24;
So the "pt=" seems to be set as expected, but no serialised hex. I must be missing something simple.