Adding multiple relay Mysenssor


In struggling to add more relay to Home assistant.

till now only this Sketch is working for me, but i need to ad more relays, pleas help me on ho to ad more relays in this sketch.

 * Documentation:
 * Support Forum:

#include <MySensor.h>
#include <SPI.h>

#define SN "Relay"
#define SV "1.0"
#define CHILD_ID 1
#define RELAY_PIN 3

MySensor gw;
MyMessage msgRelay(CHILD_ID, V_STATUS);

void setup()
  gw.sendSketchInfo(SN, SV);
  // Initialize the digital pin as an output.
  gw.present(CHILD_ID, S_BINARY);

void loop()

void incomingMessage(const MyMessage &message)
  if (message.type == V_STATUS) {
     // Change relay state.
     digitalWrite(RELAY_PIN, message.getBool() ? 1 : 0);
     gw.send(msgRelay.set(message.getBool() ? 1 : 0));

Try here

It’s not working, Home assistant gives me error message, Child id alredi exist, oke chande that, but nothing shows, with the attached sketch the switchs shows up an works, but only one relay, i dont know how to extend it, i need help on that. thank you for your help