     const int deskheight = ultrasonic.distanceRead();
     Serial.printf("Desk height: %d CM\n", deskheight);
 
-    Serial.printf("Sending desk height of '%d' to %s:%i/%s\n", deskheight, HTTP_HOST.c_str(), HTTP_PORT, HTTP_URI.c_str());
+    Serial.printf("Sending desk height of '%d' to %s:%i%s\n", deskheight, HTTP_HOST.c_str(), HTTP_PORT, HTTP_URI.c_str());
 
     // Create http client
+    // https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266HTTPClient/
     HTTPClient http;
     http.begin(HTTP_HOST, HTTP_PORT, HTTP_URI);
-    http.addHeader("User-Agent", "Desk height sensor - Wemos D1");
+    http.setAuthorization(HTTP_USER, HTTP_PASSWORD);
+    
+    http.setUserAgent("Deskheight sensor - Wemos D1");
+    http.addHeader("content-type", "application/json");
 
-    int httpCode = http.POST(String(deskheight));
+    // '{"value": "<deskheight>", "homeassistant_sensor": { "name": "deskheight", "state": "<deskheight>", "attributes": { "friendly_name": "Desk Height", "unit_of_measurement": "cm" }}}'
+    String payload = String("{ \"value\": \"") + deskheight + String("\", \"homeassistant_sensor\": { \"name\": \"deskheight\",\"state\": \"") + deskheight + String("\", \"attributes\": { \"friendly_name\": \"Desk Height\", \"unit_of_measurement\": \"cm\" }}}");
+
+    int httpCode = http.POST(payload);
+    int statusLed = HTTP_LED_ERROR_PIN;
 
     // httpCode will be negative on error
     if(httpCode > 0) {

  Serial.begin(115200);
  Serial.println("Starting...");
  pinMode(WIFI_STATUS_LED_PIN, OUTPUT);
  pinMode(LED_STATUS_PIN, OUTPUT);
  connectToWifi();
}


        if(httpCode == HTTP_CODE_OK) {
            String payload = http.getString();
            Serial.println(payload);
            statusLed = HTTP_LED_SUCCESS_PIN;
        }
    } else {
        Serial.printf("[HTTP] POST... failed, error: %s\n", http.errorToString(httpCode).c_str());
