mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
show not available when a dallas sensor is offline
This commit is contained in:
@@ -70,6 +70,13 @@ type EMSESPDevicesFormProps = RestFormProps<EMSESPDevices> &
|
|||||||
AuthenticatedContextProps &
|
AuthenticatedContextProps &
|
||||||
WithWidthProps;
|
WithWidthProps;
|
||||||
|
|
||||||
|
function formatTemp(t: string) {
|
||||||
|
if (t == null) {
|
||||||
|
return "(not available)";
|
||||||
|
}
|
||||||
|
return t + " °C";
|
||||||
|
}
|
||||||
|
|
||||||
class EMSESPDevicesForm extends Component<
|
class EMSESPDevicesForm extends Component<
|
||||||
EMSESPDevicesFormProps,
|
EMSESPDevicesFormProps,
|
||||||
EMSESPDevicesFormState
|
EMSESPDevicesFormState
|
||||||
@@ -194,7 +201,7 @@ class EMSESPDevicesForm extends Component<
|
|||||||
{sensorData.id}
|
{sensorData.id}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell align="right">
|
<TableCell align="right">
|
||||||
{sensorData.temp} °C
|
{formatTemp(sensorData.temp)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
))}
|
))}
|
||||||
|
|||||||
Reference in New Issue
Block a user