     WiFi.begin(ssid, pass);
   
     if (WiFi.waitForConnectResult() != WL_CONNECTED) {
+      Serial.println("WiFi connected");
       return;
-      Serial.println("WiFi connected");
     }
   }
   
   if (!client.connected()) {
-    if (client.connect("arduinoClient")) {
+    if (client.connect("cottage-443rx1")) {
+      Serial.println("mqtt connected\n");
     }
   }
 

// Copyright 2016 the project authors as listed in the AUTHORS file.
// All rights reserved. Use of this source code is governed by the
// license that can be found in the LICENSE file.

#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include "WirelessConfig.h"
#include "RXCore433.h"

#include "MqttDevice2262n.h"
#include "MeatThermometer1.h"
#include "BluelineDevice.h"
#include "ArduinoTHSensor.h"
#include "Device1527.h"
#include "LacrossTX141.h"
#include "ArduinoLightSensor.h"
#include "Device2262.h"
//#include "ArduinoDS18B20Sensor.h"
//#include "ArduinoTHSensor2.h"

#define RX_433_PIN D4

IPAddress server(mqttServer[0], mqttServer[1],
                 mqttServer[2], mqttServer[3]);

WiFiClient wclient;
ESP8266WiFiGenericClass wifi;
PubSubClient client(wclient, server);

RXCore433 receiver(RX_433_PIN);


  Serial.begin(9600);
  Serial.println("Started\n");

#ifdef USE_CERTS
  wclient.setCertificate_P(client_cert, client_cert_len);
  wclient.setPrivateKey_P(client_key, client_key_len);
#endif

  // note you can only use a subset of the devices at the same time.  This
  // is because the interrupt handlers need to be in ram and only so many of 
  // them can fit at the same time.
  receiver.registerDevice(new MqttDevice2262n(200, 75, 2, &client, "house/2262/200"));
  receiver.registerDevice(new MqttDevice2262n(350, 50, 4, &client, "house/2262/200"));
  receiver.registerDevice(new Device2262(&client, "house/2262"));
  receiver.registerDevice(new Device1527(350, 50, 4, &client, "house/1527/350"));
  receiver.registerDevice(new LacrossTX141(&client, "house/lacrossTX141"));
  receiver.registerDevice(new MeatThermometer1(&client, "house/meat/temp"));
  // receiver.registerDevice(new BluelineDevice(0x1efd, &client, "esp/house/blueline"));
  // receiver.registerDevice(new ArduinoTHSensor(&client, "esp/house/arduinoTHSensor"));
  // receiver.registerDevice(new ArduinoLightSensor(&client, "esp/house/arduinoLightSensor"));
  // receiver.registerDevice(new ArduinoDS18B20Sensor(&client, "esp/house/arduinoDS18B20Sensor"));
  // receiver.registerDevice(new ArduinoTHSensor2(&client, "esp/house/arduinoTHSensor"));
  // turn of the Access Point as we are not using it
  wifi.mode(WIFI_STA);
}
