mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
rename devicedata nodes
This commit is contained in:
@@ -96,7 +96,7 @@ class EMSESPDevicesForm extends Component<
|
|||||||
};
|
};
|
||||||
|
|
||||||
noDeviceData = () => {
|
noDeviceData = () => {
|
||||||
return (this.state.deviceData?.deviceData || []).length === 0;
|
return (this.state.deviceData?.data || []).length === 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
createDeviceItems() {
|
createDeviceItems() {
|
||||||
@@ -330,7 +330,7 @@ class EMSESPDevicesForm extends Component<
|
|||||||
<p></p>
|
<p></p>
|
||||||
<Box bgcolor="info.main" p={1} mt={1} mb={1}>
|
<Box bgcolor="info.main" p={1} mt={1} mb={1}>
|
||||||
<Typography variant="body1" color="initial">
|
<Typography variant="body1" color="initial">
|
||||||
{deviceData.deviceName}
|
{deviceData.name}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
{!this.noDeviceData() && (
|
{!this.noDeviceData() && (
|
||||||
@@ -341,14 +341,14 @@ class EMSESPDevicesForm extends Component<
|
|||||||
>
|
>
|
||||||
<TableHead></TableHead>
|
<TableHead></TableHead>
|
||||||
<TableBody>
|
<TableBody>
|
||||||
{deviceData.deviceData.map((item, i) => {
|
{deviceData.data.map((item, i) => {
|
||||||
if (i % 2) {
|
if (i % 2) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<TableRow key={i}>
|
<TableRow key={i}>
|
||||||
<TableCell component="th" scope="row">{deviceData.deviceData[i]}</TableCell>
|
<TableCell component="th" scope="row">{deviceData.data[i]}</TableCell>
|
||||||
<TableCell align="right">{deviceData.deviceData[i + 1]}</TableCell>
|
<TableCell align="right">{deviceData.data[i + 1]}</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,6 @@ export interface EMSESPDevices {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface EMSESPDeviceData {
|
export interface EMSESPDeviceData {
|
||||||
deviceName: string;
|
name: string;
|
||||||
deviceData: string[];
|
data: string[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -677,8 +677,8 @@ void EMSESP::device_info_web(const uint8_t unique_id, JsonObject & root) {
|
|||||||
for (const auto & emsdevice : emsdevices) {
|
for (const auto & emsdevice : emsdevices) {
|
||||||
if (emsdevice) {
|
if (emsdevice) {
|
||||||
if (emsdevice->unique_id() == unique_id) {
|
if (emsdevice->unique_id() == unique_id) {
|
||||||
root["deviceName"] = emsdevice->to_string_short(); // can't use c_str() because of scope
|
root["name"] = emsdevice->to_string_short(); // can't use c_str() because of scope
|
||||||
JsonArray data = root.createNestedArray("deviceData");
|
JsonArray data = root.createNestedArray("data");
|
||||||
emsdevice->device_info_web(data);
|
emsdevice->device_info_web(data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -741,7 +741,7 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, std::
|
|||||||
for (const auto & emsdevice : emsdevices) {
|
for (const auto & emsdevice : emsdevices) {
|
||||||
if (emsdevice) {
|
if (emsdevice) {
|
||||||
if (emsdevice->is_device_id(device_id)) {
|
if (emsdevice->is_device_id(device_id)) {
|
||||||
LOG_DEBUG(F("Updating details on already existing device ID 0x%02X"), device_id);
|
LOG_DEBUG(F("Updating details for already active device ID 0x%02X"), device_id);
|
||||||
emsdevice->product_id(product_id);
|
emsdevice->product_id(product_id);
|
||||||
emsdevice->version(version);
|
emsdevice->version(version);
|
||||||
// only set brand if it doesn't already exist
|
// only set brand if it doesn't already exist
|
||||||
|
|||||||
Reference in New Issue
Block a user