Skip to content

Commit

Permalink
Move AP locked status to its own json value
Browse files Browse the repository at this point in the history
  • Loading branch information
dkerr64 committed Oct 29, 2024
1 parent 6f8a331 commit 229dc19
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
Binary file modified docs/webpage/webpage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/web.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,8 @@ void handle_status()
ADD_STR(json, "macAddress", macAddress);
ADD_STR(json, "wifiSSID", wifiSSID);
ADD_STR(json, "wifiRSSI", (std::to_string(WiFi.RSSI()) + " dBm, Channel " + std::to_string(WiFi.channel())).c_str());
ADD_STR(json, "wifiBSSID", (WiFi.BSSIDstr() + (wifiConf.bssid_set ? " (locked)" : "")).c_str());
ADD_STR(json, "wifiBSSID", WiFi.BSSIDstr().c_str());
ADD_BOOL(json, "lockedAP", wifiConf.bssid_set)
ADD_INT(json, "GDOSecurityType", userConfig->gdoSecurityType);
ADD_STR(json, "garageDoorState", garage_door.active ? DOOR_STATE(garage_door.current_state) : DOOR_STATE(255));
ADD_STR(json, "garageLockState", LOCK_STATE(garage_door.current_lock));
Expand Down
6 changes: 6 additions & 0 deletions src/www/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ function setElementsFromStatus(status) {
document.getElementById(key).value = value;
document.getElementById("wifiPowerValue").innerHTML = value;
break;
case "lockedAP":
document.getElementById("lockedAP").style.display = (value) ? "table" : "none";
break;
case "clients":
document.getElementById(key).innerHTML = (value > 0) ? `Yes (${value})` : 'No';
break;
case "localIP":
document.getElementById(key).innerHTML = value;
document.getElementById("IPaddress").placeholder = value;
Expand Down
12 changes: 6 additions & 6 deletions src/www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
</tr>
<tr>
<td>WiFi AP:</td>
<td id="wifiBSSID"></td>
<td><span id="wifiBSSID"></span><br><sup style="font-size: 0.6em;"><span id="lockedAP"
style="display: none">(Locked to AP)</span></sup></td>
</tr>
<tr>
<td>MAC Address:</td>
Expand All @@ -89,7 +90,8 @@
</tr>
<tr>
<td>HomeKit ID:</td>
<td><span id="accessoryID"></span><br><sup style="font-size: 0.6em;">(clients:<span id="clients"></span>)</sup></td>
<td><span id="accessoryID"></span><br><sup style="font-size: 0.6em;">HomeKit connected: <span
id="clients">No</span></sup></td>
</tr>
</table>
</div>
Expand Down Expand Up @@ -365,10 +367,8 @@
<td></td>
</tr>
<tr>
<td>
<input type="button" value="Save Settings" onclick="saveSettings()">
</td>
<td>
<td colspan="2" style="text-align: center;">
<input type="button" value="Save Settings" onclick="saveSettings()">&nbsp;
<input type="button" value="Reset Door" onclick="resetDoor()">&nbsp;
<input type="button" value="Set WiFi SSID" onclick="setSSID()">
</td>
Expand Down
3 changes: 2 additions & 1 deletion src/www/status.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"syslogIP": "192.168.99.2",
"wifiSSID": "Test",
"wifiRSSI": "-55 dBm, Channel 6",
"wifiBSSID": "AA:BB:CC:DD:EE:FF (locked)",
"wifiBSSID": "AA:BB:CC:DD:EE:FF",
"lockedAP": true,
"GDOSecurityType" : 2,
"garageLightOn": false,
"garageDoorState": "Closed",
Expand Down

0 comments on commit 229dc19

Please sign in to comment.