Hi, just wanna give my contribution to the community.
Following is the serial gateway code with support of auto ID, which is still missing in the latest of MySensor (1.4) library (CMIIW).
@OldSurferDude jus request counter states from controller on each reset, worked fine with Domoticz...
or save in eeprom but increase location every write, on power up/reset search eeprom for largest value stored and carry on from that location, one long integer will fit 256 times in atmega328(p) eeprom, is that long enough for you ?