mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 00:39:50 +03:00
bitmask for bool custom entities as hex value
This commit is contained in:
@@ -61,7 +61,8 @@ const CustomEntitiesDialog = ({
|
||||
setEditItem({
|
||||
...selectedItem,
|
||||
device_id: selectedItem.device_id.toString(16).toUpperCase(),
|
||||
type_id: selectedItem.type_id.toString(16).toUpperCase()
|
||||
type_id: selectedItem.type_id.toString(16).toUpperCase(),
|
||||
factor: selectedItem.value_type === DeviceValueType.BOOL ? selectedItem.factor.toString(16).toUpperCase() : selectedItem.factor
|
||||
});
|
||||
}
|
||||
}, [open, selectedItem]);
|
||||
@@ -82,6 +83,9 @@ const CustomEntitiesDialog = ({
|
||||
if (typeof editItem.type_id === 'string') {
|
||||
editItem.type_id = parseInt(editItem.type_id, 16);
|
||||
}
|
||||
if (editItem.value_type === DeviceValueType.BOOL && typeof editItem.factor === 'string') {
|
||||
editItem.factor = parseInt(editItem.factor, 16);
|
||||
}
|
||||
onSave(editItem);
|
||||
} catch (error) {
|
||||
setFieldErrors(error as ValidateFieldsError);
|
||||
@@ -315,7 +319,7 @@ const CustomEntitiesDialog = ({
|
||||
<ValidatedTextField
|
||||
fieldErrors={fieldErrors}
|
||||
name="factor"
|
||||
label="Bytes"
|
||||
label={LL.BYTES()}
|
||||
value={numberValue(editItem.factor as number)}
|
||||
sx={{ width: '11ch' }}
|
||||
variant="outlined"
|
||||
@@ -333,7 +337,7 @@ const CustomEntitiesDialog = ({
|
||||
<ValidatedTextField
|
||||
fieldErrors={fieldErrors}
|
||||
name="factor"
|
||||
label="Mask"
|
||||
label={LL.BITMASK()}
|
||||
value={editItem.factor as string}
|
||||
sx={{ width: '11ch' }}
|
||||
variant="outlined"
|
||||
|
||||
Reference in New Issue
Block a user