#ifdef LANG_DE
    #include "html_confSens_DE.h"
#else
    #include "html_confSens.h"
#endif

void httpServerHandlePage_confSens() {
    httpServerSendHtmlHeadChunked();
    httpServer.sendContent_P(html_js_confpages_start);
    httpServer.sendContent_P(html_confSens_script);
    httpServer.sendContent_P(html_js_confpages_end);
    httpServer.sendContent_P(html_head_end);
    httpServer.sendContent_P(html_bodytag_jsinit);
    httpServerSendHtmlBodyPageheadChunked();
    httpServer.sendContent_P(html_confSens_body_start);

    #ifdef ENABLE_SENSORS_ONEWIRE
        httpServer.sendContent_P(html_confSens_oneWire_start);
        char assignedSensorName[21];
        for (uint8_t i=0; i < oneWireSensors.getDeviceCount(); i++) {
            //Serial.print("Device ");
            //Serial.print(i);
            //Serial.print(" Address: ");
            //oneWireSensors_printAddress(oneWireSensors_IndexToAddress[i]);
            //Serial.println();
            char buf[100];


            float _tempC;
            _tempC = oneWireSensors.getTempC(oneWireSensors_IndexToAddress[i]);

            if(oneWireSensor_assignedDevToIndex[ONEWIRE_SENSOR_INDEX_FEED] == i) sprintf(assignedSensorName, "FEED");
            else if(oneWireSensor_assignedDevToIndex[ONEWIRE_SENSOR_INDEX_RETURN] == i) sprintf(assignedSensorName, "RETURN");
            else if(oneWireSensor_assignedDevToIndex[ONEWIRE_SENSOR_INDEX_OUT] == i) sprintf(assignedSensorName, "OUT");
            else assignedSensorName[0] = '\0';

            sprintf(buf, "<tr><td>%d</td><td>%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x</td><td>%.1f</td><td>", i, oneWireSensors_IndexToAddress[i][0], oneWireSensors_IndexToAddress[i][1], oneWireSensors_IndexToAddress[i][2], oneWireSensors_IndexToAddress[i][3], oneWireSensors_IndexToAddress[i][4], oneWireSensors_IndexToAddress[i][5], oneWireSensors_IndexToAddress[i][6], oneWireSensors_IndexToAddress[i][7], _tempC);
            httpServer.sendContent(buf);

            sprintf(buf, "\n<select name=\"assignSens_%d\" id=\"assignSens_%d\">", i, i);
            httpServer.sendContent(buf);

            httpServer.sendContent_P(html_confSens_oneWire_AssignSelector_options);

            sprintf(buf, "</select></td></tr>\n");
            httpServer.sendContent(buf);

            //sprintf(buf, "<tr><td>%d</td><td id='sensAddr_%d'></td><td id='sensVal_%d'></td><td id='sensAss_%d'></td></tr>\n", i, i, i, i);
            httpServer.sendContent(buf);
        }
        httpServer.sendContent_P(html_confSens_oneWire_end);
    #endif

    #ifdef ENABLE_SENSOR_DHT22
        httpServer.sendContent_P(html_confSens_dht);
    #endif
    
    //httpServer.sendContent("\n<tr><td>Beidln</td><td>1</td></tr>");

    httpServer.sendContent_P(html_confSens_body_end);
    httpServerSendHtmlFooterChunked();
}
