show not available when a dallas sensor is offline

This commit is contained in:
proddy
2020-10-22 18:57:27 +02:00
parent 4cffadcea2
commit 71461eefd5

View File

@@ -70,6 +70,13 @@ type EMSESPDevicesFormProps = RestFormProps<EMSESPDevices> &
AuthenticatedContextProps &
WithWidthProps;
function formatTemp(t: string) {
if (t == null) {
return "(not available)";
}
return t + " °C";
}
class EMSESPDevicesForm extends Component<
EMSESPDevicesFormProps,
EMSESPDevicesFormState
@@ -194,7 +201,7 @@ class EMSESPDevicesForm extends Component<
{sensorData.id}
</TableCell>
<TableCell align="right">
{sensorData.temp}&nbsp;&deg;C
{formatTemp(sensorData.temp)}
</TableCell>
</TableRow>
))}