bugfix hostname
This commit is contained in:
parent
1802f4954c
commit
6e899cdbad
|
@ -60,7 +60,7 @@ void setup() {
|
|||
// Connect to and initialise WiFi network
|
||||
OTGWSerial.println(F("Attempting to connect to WiFi network\r"));
|
||||
setLed(LED1, ON);
|
||||
startWiFi(_HOSTNAME, 240); // timeout 240 seconds
|
||||
startWiFi(CSTR(settingHostname), 240); // timeout 240 seconds
|
||||
blinkLED(LED1, 3, 100);
|
||||
setLed(LED1, OFF);
|
||||
|
||||
|
@ -153,7 +153,7 @@ void doTaskEvery60s(){
|
|||
if (WiFi.status() != WL_CONNECTED)
|
||||
{
|
||||
//disconnected, try to reconnect then...
|
||||
startWiFi(_HOSTNAME, 240);
|
||||
startWiFi(CSTR(settingHostname), 240);
|
||||
//check OTGW and telnet
|
||||
startTelnet();
|
||||
startOTGWstream();
|
||||
|
|
|
@ -51,7 +51,7 @@ Looking for the documentation, go here (work in progress): <br> https://github.
|
|||
| Version | Release notes |
|
||||
|-|-|
|
||||
| 0.8.2 | Added: Command Queue to MQTT command topic<br>Bugfix: Values not updating in WebUI fixed<br>Added: verbose debug modes<br>
|
||||
Added check for littlefs githash<br>Added: Interval setting for sensor readout<br>Adding: Send OTGW commands on boot|
|
||||
Added check for littlefs githash<br>Added: Interval setting for sensor readout<br>Adding: Send OTGW commands on boot<br>Bugfix: Hostname now actually changes if needed.|
|
||||
| 0.8.1 | Improved ot msg processing<br>MQTT: added `otgw-firmware/version`, `otgw-firmware/reboot_count`, `otgw-firmware/version` and `otgw-firmware/uptime` (seconds)<br>Bugfix: typoo in topic name `master_low_off_pomp_control_function` -> `master_low_off_pump_control_function`<br>Bugfix: Home Assistant thermostat operation mode (flame icon) template<br>Feature: Add support for Dallas temperature sensors, defaults GPIO10, pushes data to `otgw-firmware/sensors/<Dallas-sensor-ID>` |
|
||||
| 0.8.0 | **Breaking Change: MQTT topic naming convention has changed from `<mqqt top prefix>/<sensor>` to `<mqtt top prefix>/value/<node id>/<sensor>` for data publshed and `<mqtt top prefix>/set/<node id>/<command>` for subscriptions** <br> Update Homeasssistant Discovery: add OTGW as a device and group all exposed entities as childs <br> Update Homeasssistant Discovery: add climate (thermostat) enity, uses temporary temperature override (OTGW `TT` command) (Home Assistant Core v2021.2.0+)<br> Bugfix #14: reduce MQTT connect timeout < the watchdog timeout to prevent reboot on a timout<br> Adding LLMNR responder (http://otgw/ will work now too)<br>New restapi: Telegraf endpoint (/api/v1/otgw/telegraf)<br> Fixing bugs in core OTGW msg processor for ASF flas|
|
||||
| 0.7.8 | Update Home Assistant Discovery <br> Flexible Home Assistant prefix <br> Bugfix: Removed hardcoded OTGW topic <br> Bugfix: NTP timezone discovery removed |
|
||||
|
|
|
@ -4,6 +4,10 @@ void handleDebug(){
|
|||
char c;
|
||||
c = TelnetStream.read();
|
||||
switch (c){
|
||||
case 'q':
|
||||
DebugTln("Read settings");
|
||||
readSettings(true);
|
||||
break;
|
||||
case 'm':
|
||||
DebugTln("Configure MQTT Discovery");
|
||||
DebugTf("Enable MQTT: %s", CBOOLEAN(settingMQTTenable));
|
||||
|
@ -13,7 +17,7 @@ void handleDebug(){
|
|||
if (WiFi.status() != WL_CONNECTED)
|
||||
{
|
||||
DebugTln("Reconnecting to wifi");
|
||||
startWiFi(_HOSTNAME, 240);
|
||||
startWiFi(CSTR(settingHostname), 240);
|
||||
//check OTGW and telnet
|
||||
startTelnet();
|
||||
startOTGWstream();
|
||||
|
|
|
@ -27,7 +27,7 @@ void writeSettings(bool show)
|
|||
DebugT(F("Start writing setting data "));
|
||||
|
||||
//const size_t capacity = JSON_OBJECT_SIZE(6); // save more setting, grow # of objects accordingly
|
||||
DynamicJsonDocument doc(512);
|
||||
DynamicJsonDocument doc(1024);
|
||||
JsonObject root = doc.to<JsonObject>();
|
||||
root["hostname"] = settingHostname;
|
||||
root["MQTTenable"] = settingMQTTenable;
|
||||
|
@ -71,7 +71,7 @@ void readSettings(bool show)
|
|||
}
|
||||
|
||||
// Deserialize the JSON document
|
||||
StaticJsonDocument<512> doc;
|
||||
StaticJsonDocument<1024> doc;
|
||||
DeserializationError error = deserializeJson(doc, file);
|
||||
if (error)
|
||||
{
|
||||
|
@ -109,12 +109,6 @@ void readSettings(bool show)
|
|||
// Close the file (Curiously, File's destructor doesn't close the file)
|
||||
file.close();
|
||||
|
||||
//Update some settings right now
|
||||
MDNS.setHostname(CSTR(settingHostname)); // start advertising with new(?) settingHostname
|
||||
|
||||
//Resetart MQTT connection every "save settings"
|
||||
startMQTT();
|
||||
|
||||
DebugTln(F(" .. done\r\n"));
|
||||
|
||||
if (show) {
|
||||
|
@ -156,6 +150,13 @@ void updateSetting(const char *field, const char *newValue)
|
|||
settingMQTTtopTopic = settingMQTTtopTopic.substring(0, pos-1);
|
||||
}
|
||||
|
||||
//Update some settings right now
|
||||
startMDNS(CSTR(settingHostname));
|
||||
startLLMNR(CSTR(settingHostname));
|
||||
|
||||
//Resetart MQTT connection every "save settings"
|
||||
startMQTT();
|
||||
|
||||
Debugln();
|
||||
DebugTf("Need reboot before new %s.local will be available!\r\n\n", CSTR(settingHostname));
|
||||
}
|
||||
|
@ -173,9 +174,10 @@ void updateSetting(const char *field, const char *newValue)
|
|||
}
|
||||
if (stricmp(field, "MQTThaprefix")==0) {
|
||||
settingMQTThaprefix = String(newValue);
|
||||
if (settingMQTThaprefix.length()==0) settingMQTThaprefix = HOME_ASSISTANT_DISCOVERY_PREFIX;
|
||||
if (settingMQTThaprefix.length()==0) settingMQTThaprefix = HOME_ASSISTANT_DISCOVERY_PREFIX;
|
||||
}
|
||||
if (stricmp(field, "MQTTOTmessage")==0) settingMQTTOTmessage = EVALBOOLEAN(newValue);
|
||||
if (stricmp(field, "MQTTOTmessage")==0) settingMQTTOTmessage = EVALBOOLEAN(newValue);
|
||||
if (strstr(field, "mqtt") != NULL) startMQTT();//restart MQTT on change of any setting
|
||||
|
||||
if (stricmp(field, "NTPenable")==0) settingNTPenable = EVALBOOLEAN(newValue);
|
||||
if (stricmp(field, "NTPtimezone")==0) {
|
||||
|
@ -204,6 +206,10 @@ void updateSetting(const char *field, const char *newValue)
|
|||
|
||||
//finally update write settings
|
||||
writeSettings(false);
|
||||
// if (strstr(field, "hostname")!= NULL) {
|
||||
// //restart wifi
|
||||
// startWIFI( CSTR(settingHostname), 240)
|
||||
// }
|
||||
|
||||
} // updateSetting()
|
||||
|
||||
|
|
Loading…
Reference in New Issue