diff --git a/app/src/components/Common.js b/app/src/components/Common.js
index 74909966..69d060d1 100644
--- a/app/src/components/Common.js
+++ b/app/src/components/Common.js
@@ -566,7 +566,7 @@ export function HotspotToggle() {
label='WiFi Hotspot'
disabled={disabled}
checked={on === true}
- onChange={(e, data) => setHotspot(data.checked)}
+ onChange={checked => setHotspot(checked)}
/>
{disabled && }
);
@@ -580,7 +580,7 @@ export function ThrottleToggle() {
label='CPU Power-save'
disabled={disabled}
checked={on === true}
- onChange={(e, data) => setThrottle(data.checked)}
+ onChange={checked => setThrottle(checked)}
/>
{disabled && }
);
diff --git a/app/src/components/admin/Settings.js b/app/src/components/admin/Settings.js
index 56803033..25cf2e85 100644
--- a/app/src/components/admin/Settings.js
+++ b/app/src/components/admin/Settings.js
@@ -144,7 +144,7 @@ export class Settings extends React.Component {
label='Download on Startup'
disabled={disabled || download_on_startup === null}
checked={download_on_startup === true}
- onChange={(checked) => this.handleInputChange(null, 'download_on_startup', checked)}
+ onChange={checked => this.handleInputChange(null, 'download_on_startup', checked)}
/>
@@ -153,7 +153,7 @@ export class Settings extends React.Component {
label='WiFi Hotspot on Startup'
disabled={disabled || hotspot_on_startup === null}
checked={hotspot_on_startup === true}
- onChange={(checked) => this.handleInputChange(null, 'hotspot_on_startup', checked)}
+ onChange={checked => this.handleInputChange(null, 'hotspot_on_startup', checked)}
/>
@@ -162,7 +162,7 @@ export class Settings extends React.Component {
label='CPU Power-save on Startup'
disabled={disabled || throttle_on_startup === null}
checked={throttle_on_startup === true}
- onChange={(checked) => this.handleInputChange(null, 'throttle_on_startup', checked)}
+ onChange={checked => this.handleInputChange(null, 'throttle_on_startup', checked)}
/>
diff --git a/wrolpi/admin.py b/wrolpi/admin.py
index 760e98df..124592b7 100644
--- a/wrolpi/admin.py
+++ b/wrolpi/admin.py
@@ -47,9 +47,9 @@ def hotspot_status() -> HotspotStatus:
def enable_hotspot():
- """Turn the wifi interface into a hotspot.
+ """Turn the Wi-Fi interface into a hotspot.
- If wifi is already running, replace that with a hotspot.
+ If Wi-Fi is already running, replace that with a hotspot.
"""
status = hotspot_status()
logger.warning(f'Hotspot status: {status}')
@@ -76,7 +76,7 @@ def enable_hotspot():
def disable_hotspot():
- """Turn off the wifi interface."""
+ """Turn off the Wi-Fi interface."""
cmd = (SUDO_BIN, NMCLI_BIN, 'radio', 'wifi', 'off')
try:
subprocess.check_call(cmd)
diff --git a/wrolpi/root_api.py b/wrolpi/root_api.py
index 98b615e7..07fa3d20 100644
--- a/wrolpi/root_api.py
+++ b/wrolpi/root_api.py
@@ -327,6 +327,8 @@ class CustomJSONEncoder(json.JSONEncoder):
return obj.__json__()
elif isinstance(obj, datetime):
return obj.timestamp()
+ elif isinstance(obj, date):
+ return datetime(obj.year, obj.month, obj.day).timestamp()
elif isinstance(obj, Decimal):
return str(obj)
elif isinstance(obj, Base):
diff --git a/wrolpi/status.py b/wrolpi/status.py
index cf2928a0..490eadef 100755
--- a/wrolpi/status.py
+++ b/wrolpi/status.py
@@ -117,9 +117,10 @@ def get_cpu_info_psutil() -> CPUInfo:
# Prefer "coretemp", fallback to the first temperature.
temp = psutil.sensors_temperatures()
name = 'coretemp' if 'coretemp' in temp else list(temp.keys())[0]
- temperature = int(temp.get(name)[0].current)
- high_temperature = int(temp.get(name)[0].high)
- critical_temperature = int(temp.get(name)[0].critical)
+ # Temperatures may be None.
+ temperature = int(temp.get(name)[0].current or 0)
+ high_temperature = int(temp.get(name)[0].high or 0)
+ critical_temperature = int(temp.get(name)[0].critical or 0)
info = CPUInfo(
cores=psutil.cpu_count(logical=True),