     char address[255];
     
     strncpy(address, "homeautomation/+/_all/_all", 254);
-    mqtt_client.subscribe(address);
+    subscription_count = subscribe_one(address, subscriptions, subscription_count);
 
     for (int i = 0; i < MAX_DEVICES; ++i) {
       if (strlen(config.devices[i].address_segment[0].segment) > 0) {
-        String announce = "_subject : " + DeviceAddress(config.devices[i]);
-        announce += " , _state : off";
-        announce.toCharArray(lamp, 255);
-
-        mqtt_client.publish("homeautomation/0/lighting/_announce", lamp);
-        
+        mqtt_announce(config.devices[i]);
+
         strncpy(address, "homeautomation/+/_all", 254);
 
         for(int j = 0; j < ADDRESS_SEGMENTS; j++){

#define CONFIG_VERSION "001"

// Maximum number of devices connected to IO pins.
#define MAX_DEVICES 8

// Length of name strings. (hostname, room names, lamp names, etc.)
#define NAME_LEN 32

// Each device has an address in the form 'role/location1/location2/etc'
// eg: 'lighting/kitchen/worktop/left'.
#define ADDRESS_SEGMENTS 6
#define ADDRESS_SEGMENT_LEN 32


enum Io_Type {

          }
          address[strlen(address) -4] = '\0';
          strncat(address, config.devices[i].address_segment[j].segment, 254 - strlen(address));
          if (j < (ADDRESS_SEGMENTS -1) &&
              strlen(config.devices[i].address_segment[j +1].segment) > 0) {
            strncat(address, "/_all", 254 - strlen(address));
          }
          subscription_count = subscribe_one(address, subscriptions, subscription_count);
        }
      }
    }
