Presenting initial value with home sensors-node?

Hello!

This is the sketch I am using in my home sensors-node:
http://pastebin.com/VS8ySBaH
It will send a different code from the ir attached depending if the light is switched on or off.
However it does not show up in HA since no initial value is sent
Any idea how I can fix it?
It works fine in domoticz

There’s a general example of how to send an initial value and check that the controller received it here:

I have looked at that page but still not sure how to implement it in my code…

I don’t want to use on/off to make pin high/low as in the example. I want to use on/off to send a different ircode. That is not a state, or is it?

Would really appreciate if someone could help me out.

// Enable debug prints
//#define MY_DEBUG

// Enable and select radio type attached
#define MY_RADIO_NRF24
//#define MY_RADIO_RFM69

#include <SPI.h>
#include <MySensors.h>
#include <IRremote.h>

unsigned int base[] = {4500, 4450, 600, 550, 550, 550, 550, 550, 550, 1650, 550, 550, 550, 550, 550, 1650, 550, 550, 4500, 4450, 600, 550, 600, 550, 600, 550, 600, 1600, 600, 550, 600, 550, 600, 1600, 600, 500, 4550, 4400, 650, 500, 600, 550, 600, 550, 600, 1600, 600, 550, 600, 550, 600, 1600, 600, 500, 4500, 4450, 600, 550, 600, 550, 600, 550, 600, 1600, 550, 550, 550, 550, 550, 1650, 550, 550, 4500, 4450, 600, 550, 550, 550, 550, 550, 550, 1650, 550, 550, 550, 550, 550, 1650, 550};
unsigned int clean[] = {4550, 4400, 600, 550, 600, 1600, 600, 550, 600, 1600, 600, 550, 600, 1600, 600, 550, 600, 550, 4450, 4450, 600, 550, 550, 1650, 600, 550, 600, 1650, 600, 550, 550, 1650, 600, 550, 600, 550, 4450, 4450, 600, 550, 600, 1650, 600, 550, 550, 1650, 600, 550, 550, 1650, 600, 550, 550, 550, 4450, 4450, 600, 550, 600, 1650, 600, 550, 550, 1700, 550, 600, 550, 1700, 600, 550, 600, 550, 4450, 4450, 600, 550, 600, 1650, 550, 600, 550, 1700, 550, 600, 500, 1700, 550, 600, 550};

#define CHILD_1  3  // childId

IRsend irsend;
bool initialValueSent = false;
MyMessage msg(CHILD_1, V_STATUS);

void setup()
{

}

void presentation()  {
  // Send the sketch version information to the gateway and Controller
  sendSketchInfo("IR Sensor", "1.0");

  // Register a sensors to  Use binary light for test purposes.
  present(CHILD_1, S_BINARY);
}

void loop()
{
  if (!initialValueSent) {
    Serial.println("Sending initial value");
    send(msg.set(0));
    Serial.println("Requesting initial value from controller");
    request(CHILD_1, V_STATUS);
    wait(2000, C_SET, V_STATUS);
  }
}

void receive(const MyMessage &message) {
  int khz = 38; // 38kHz carrier frequency for the NEC protocol
  if (message.type == V_STATUS) {
    if (!initialValueSent) {
      Serial.println("Receiving initial value from controller");
      initialValueSent = true;
    }
    int incomingRelayStatus = message.getInt();
    if (incomingRelayStatus) {
      irsend.sendRaw(base, sizeof(base) / sizeof(base[0]), khz);
    } else {
      irsend.sendRaw(clean, sizeof(clean) / sizeof(clean[0]), khz);
    }
    // Send state as feedback to controller.
    send(msg.set(incomingRelayStatus?1:0));
  }
}