 // mqtt
 char* topic = "esp8266/arduino/s02";
 char* subtopic = "esp8266/cmd/light";
+char* rslttopic = "esp8266/cmd/light/rlst";
 char* hellotopic = "HELLO";
 
 char* willTopic = "clients/relay";

  lightpayload += relaystatus;
  lightpayload += "}";

  sendmqttMsg(subtopic, lightpayload);
}

void sendmqttMsg(char* topictosend, String payload)
{
  if (!client.connected()) {
    if (client.connect((char*) clientName.c_str(), willTopic, 0, true, willMessage)) {
      client.publish(willTopic, "1", true);


boolean reconnect()
{
  if (!client.connected()) {
    if (client.connect((char*) clientName.c_str(), willTopic, 0, true, willMessage)) {
      client.publish(willTopic, "1", true);
      client.publish(hellotopic, "hello again 1 from ESP8266 s02");
      client.subscribe(subtopic);
      Serial.println("connected");
    } else {
      Serial.print("failed, rc=");
      Serial.println(client.state());
    }
  }
  //timemillis = millis();
  return client.connected();
