@ustredna , try changing this line:
send(msg.set(value==HIGH));
by
send(msg.set(value));
The same for msg2 line:
send(msg2.set(value==HIGH));
to
send(msg2.set(value));
And if you only need to update the GW on every 7 seconds (and not immediately), change the sleep:
sleep( 7000 ) ;
Hope it helps!