add mac address to wifi status page

This commit is contained in:
Rick Watson 2019-04-29 22:15:07 +01:00
parent 33be3ab1b2
commit e8de21aaf4
2 changed files with 34 additions and 27 deletions

View File

@ -15,6 +15,7 @@ import WifiIcon from '@material-ui/icons/Wifi';
import DNSIcon from '@material-ui/icons/Dns';
import SettingsInputComponentIcon from '@material-ui/icons/SettingsInputComponent';
import SettingsInputAntennaIcon from '@material-ui/icons/SettingsInputAntenna';
import DeviceHubIcon from '@material-ui/icons/DeviceHub';
import SectionContent from '../components/SectionContent';
import { WIFI_STATUS_ENDPOINT } from '../constants/Endpoints';
@ -52,10 +53,10 @@ class WiFiStatus extends Component {
}
dnsServers(status) {
if (!status.dns_ip_1){
if (!status.dns_ip_1) {
return "none";
}
return status.dns_ip_1 + (status.dns_ip_2 ? ','+status.dns_ip_2 : '');
return status.dns_ip_1 + (status.dns_ip_2 ? ',' + status.dns_ip_2 : '');
}
createListItems(data, classes) {
@ -83,6 +84,13 @@ class WiFiStatus extends Component {
<ListItemText primary="IP Address" secondary={data.local_ip} />
</ListItem>
<Divider variant="inset" component="li" />
<ListItem>
<Avatar>
<DeviceHubIcon />
</Avatar>
<ListItemText primary="MAC Address" secondary={data.mac_address} />
</ListItem>
<Divider variant="inset" component="li" />
<ListItem>
<Avatar>#</Avatar>
<ListItemText primary="Subnet Mask" secondary={data.subnet_mask} />
@ -119,18 +127,16 @@ class WiFiStatus extends Component {
</Button>
</div>
);
}
render() {
const { data, fetched, errorMessage, classes } = this.props;
return (
<SectionContent title="WiFi Status">
{
!fetched ?
<div>
<LinearProgress className={classes.fetching}/>
<LinearProgress className={classes.fetching} />
<Typography variant="display1" className={classes.fetching}>
Loading...
</Typography>

View File

@ -55,6 +55,7 @@ void WiFiStatus::wifiStatus(AsyncWebServerRequest *request) {
root["status"] = (uint8_t) status;
if (status == WL_CONNECTED){
root["local_ip"] = WiFi.localIP().toString();
root["mac_address"] = WiFi.macAddress();
root["rssi"] = WiFi.RSSI();
root["ssid"] = WiFi.SSID();
root["bssid"] = WiFi.BSSIDstr();