Skip to content
This repository has been archived by the owner on Dec 7, 2019. It is now read-only.

Commit

Permalink
Merge pull request #15 from jp112sdl/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
jp112sdl authored Sep 17, 2017
2 parents d5b6db4 + 95bfa31 commit 310b2f9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
3 changes: 1 addition & 2 deletions OTA.ino
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ void startOTAhandling() {
else if (error == OTA_END_ERROR) Serial.println("End Failed");
});

String Hostname = "Sonoff-OTA-" + WiFi.macAddress();
ArduinoOTA.setHostname(Hostname.c_str());
ArduinoOTA.setHostname(GlobalConfig.Hostname.c_str());
//ArduinoOTA.setPassword((const char *)"sonoffota");
ArduinoOTA.begin();
}
3 changes: 2 additions & 1 deletion SonoffHMLOX.ino
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#define PING_ENABLED false
#define PINGINTERVALSECONDS 300

const String FIRMWARE_VERSION = "1.0.6";
const String FIRMWARE_VERSION = "1.0.7";
const char GITHUB_REPO_URL[] PROGMEM = "https://api.github.com/repos/jp112sdl/SonoffHMLOX/releases/latest";

enum BackendTypes_e {
Expand Down Expand Up @@ -204,6 +204,7 @@ void setup() {
}

if (!loadSystemConfig()) startWifiManager = true;
//Ab hier ist die Config geladen und alle Variablen sind mit deren Werten belegt!

if (doWifiConnect()) {
Serial.println(F("WLAN erfolgreich verbunden!"));
Expand Down
4 changes: 2 additions & 2 deletions WM.ino
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ bool doWifiConnect() {
//WiFiManagerParameter custom_loxusername("loxusername", "Loxone Username", "", VARIABLESIZE);
//WiFiManagerParameter custom_loxpassword("loxpassword", "Loxone Password", "", VARIABLESIZE,4);
WiFiManagerParameter custom_loxudpport("loxudpport", "Loxone UDP Port", LoxoneConfig.UDPPort, 10, 0, "pattern='[0-9]{1,5}'");
WiFiManagerParameter custom_sonoffname("sonoff", "Sonoff Gerätename", GlobalConfig.DeviceName, VARIABLESIZE, 0, "pattern='[A-Za-z0-9]+'");
WiFiManagerParameter custom_sonoffname("sonoff", "Sonoff Gerätename", GlobalConfig.DeviceName, VARIABLESIZE, 0, "pattern='[A-Za-z0-9_ -]+'");

char*chrRestoreOldState = "0";
if (GlobalConfig.restoreOldRelayState) chrRestoreOldState = "1" ;
Expand All @@ -56,7 +56,7 @@ bool doWifiConnect() {
if (GlobalConfig.LEDDisabled) chrLEDDisabled = "1" ;
WiFiManagerParameter custom_cbleddisabled("leddisabled_switch", "LED deaktiviert: ", chrLEDDisabled, 8, 1);

WiFiManagerParameter custom_powervariablename("hmpowervariable_pow", "Variable für Leistung", HomeMaticConfig.PowerVariableName, VARIABLESIZE, 0, "pattern='[A-Za-z0-9]+'");
WiFiManagerParameter custom_powervariablename("hmpowervariable_pow", "Variable für Leistung", HomeMaticConfig.PowerVariableName, VARIABLESIZE, 0, "pattern='[A-Za-z0-9_ -]+'");
String del = String(GlobalConfig.MeasureInterval);
char delBuf[8];
del.toCharArray(delBuf, 8);
Expand Down
4 changes: 2 additions & 2 deletions Web.ino
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ const char HTTP_CALIB_BUTTON[] PROGMEM = "<div></div><div><input class='lnkbtn'
const char HTTP_CALIB_INPUT[] PROGMEM = "<div><table><tr><td>Last (W):</td><td align='right'><input class='i' type='text' id='cwatt' name='cwatt' placeholder='Watt' pattern='[0-9]{1,4}'></td></tr><tr><td>Spannung (V):</td><td align='right'><input class='i' type='text' id='cvolt' name='cvolt' placeholder='Volt' pattern='[0-9]{1,3}' value='230'></td></tr></table></div>";
const char HTTP_DOCALIB_BUTTON[] PROGMEM = "<div><button name='doCalibrate' value='1' type='submit'>Kalibrieren</button></div>";
const char HTTP_UNDOCALIB_BUTTON[] PROGMEM = "<div><button name='undoCalibrate' value='1' type='submit'>Kalib. Reset</button></div>";
const char HTTP_CONF[] PROGMEM = "<div><label>{st}:</label></div><div><input type='text' id='ccuip' name='ccuip' pattern='((^|\\.)((25[0-5])|(2[0-4]\\d)|(1\\d\\d)|([1-9]?\\d))){4}$' maxlength=16 placeholder='{st}' value='{ccuip}'></div><div><label>Ger&auml;tename:</label></div><div><input type='text' id='devicename' name='devicename' pattern='[A-Za-z0-9]+' placeholder='Ger&auml;tename' value='{dn}'></div><div><label for='rstate' class='lcb' title='Stellt den Schaltzustand nach einer Stromunterbrechung wiederher'><input class 'cb' id='rstate' type='checkbox' name='rstate' {rs} value=1> {remanenz}</label></div>";
const char HTTP_CONF[] PROGMEM = "<div><label>{st}:</label></div><div><input type='text' id='ccuip' name='ccuip' pattern='((^|\\.)((25[0-5])|(2[0-4]\\d)|(1\\d\\d)|([1-9]?\\d))){4}$' maxlength=16 placeholder='{st}' value='{ccuip}'></div><div><label>Ger&auml;tename:</label></div><div><input type='text' id='devicename' name='devicename' pattern='[A-Za-z0-9_ -]+' placeholder='Ger&auml;tename' value='{dn}'></div><div><label for='rstate' class='lcb' title='Stellt den Schaltzustand nach einer Stromunterbrechung wiederher'><input class 'cb' id='rstate' type='checkbox' name='rstate' {rs} value=1> {remanenz}</label></div>";
const char HTTP_CONF_ADD_SWITCH[] PROGMEM = "<div><label class='lcb' for='leddisabled'><input id='leddisabled' class='cb' type='checkbox' name='leddisabled' {le} value=1> LED deaktiviert</label></div>";
const char HTTP_CONF_POW_MEASURE_INTERVAL[] PROGMEM = "<div></div><div><label>Messintervall</label></div><div><input type='text' id='measureinterval' name='measureinterval' placeholder='Messintervall' pattern='[0-9]{2,3}' value='{mi}'></div>";
const char HTTP_CONF_LOX[] PROGMEM = "<div><label>UDP Port:</label></div><div><input type='text' id='lox_udpport' pattern='[0-9]{1,5}' maxlength='5' name='lox_udpport' placeholder='UDP Port' value='{udp}'></div>";
const char HTTP_CONF_HM_POW[] PROGMEM = "<div><label>Variable f&uuml;r Leistungswert:</label></div><div><input type='text' id='hmpowvar' name='hmpowvar' placeholder='Variablenname' value='{hmpowvar}'></div>";
const char HTTP_CONF_HM_POW[] PROGMEM = "<div><label>Variable f&uuml;r Leistungswert:</label></div><div><input type='text' id='hmpowvar' name='hmpowvar' placeholder='Variablenname' value='{hmpowvar}' pattern='[A-Za-z0-9_ -]+'></div>";
const char HTTP_STATUSLABEL[] PROGMEM = "<div class='l c'>{sl}</div>";
const char HTTP_NEWFW_BUTTON[] PROGMEM = "<div><input class='fwbtn' id='fwbtn' type='button' value='Neue Firmware verf&uuml;gbar' onclick=\"window.open('{fwurl}')\" /></div>";
const char HTTP_CUSTOMSCRIPT[] PROGMEM = "var timerRun = false; function Get(u){ var h = new XMLHttpRequest(); h.open('GET',u,false); h.send(null); return h.responseText; } function SetState(v) { document.getElementById('timer').value = ''; var json_obj = JSON.parse(Get(v)); refreshState(json_obj, false); } function isInt(v){return !isNaN(v) && parseInt(Number(v))==v && !isNaN(parseInt(v,10));} function timerdecrement(t,rekursiv) { if (rekursiv) timerRun=false; if (isInt(t.placeholder)) {t.placeholder = t.placeholder-1; if (t.placeholder > 0 && !timerRun) timerRun = setTimeout(function(){ timerdecrement(t, true) }, 1000); else setTimeout(function(){ refreshState(null, false);}, 1000); }} function refreshState(json_obj, rekursiv) { if (json_obj == null) json_obj = JSON.parse(Get('/getState')); document.getElementById('_ls').innerHTML = (('1' == json_obj.state) ? 'AN' : 'AUS'); var timer = document.getElementById('timer'); timer.placeholder = json_obj.resttimer; if (timer.placeholder == 0) timer.placeholder = 'Sekunden'; else timerdecrement(timer); if (rekursiv) setTimeout(function(){ refreshState(null, true); }, 10000); } /*init refresh:*/ refreshState(null, true); ";
Expand Down

0 comments on commit 310b2f9

Please sign in to comment.