mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-07-29 01:52:51 +00:00
show gateway/connect but greyed out in webUI
This commit is contained in:
@@ -489,7 +489,8 @@ const Customizations = () => {
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
{devices.devices.map(
|
{devices.devices.map(
|
||||||
(device: Device) =>
|
(device: Device) =>
|
||||||
device.id < 90 && (
|
device.id < 90 &&
|
||||||
|
device.e !== 0 && (
|
||||||
<MenuItem key={device.id} value={device.id}>
|
<MenuItem key={device.id} value={device.id}>
|
||||||
{device.n} ({device.tn})
|
{device.n} ({device.tn})
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
|||||||
@@ -558,16 +558,26 @@ const Devices = memo(() => {
|
|||||||
<CircularProgress sx={{ margin: 1 }} size={18} />
|
<CircularProgress sx={{ margin: 1 }} size={18} />
|
||||||
)}
|
)}
|
||||||
{tableList.map((device: Device) => (
|
{tableList.map((device: Device) => (
|
||||||
<Row key={device.id} item={device}>
|
<Row key={device.id} item={device} disabled={device.e === 0}>
|
||||||
<Cell>
|
<Cell>
|
||||||
<DeviceIcon type_id={device.t} />
|
<DeviceIcon type_id={device.t} />
|
||||||
|
|
||||||
{device.n}
|
<span style={{ color: device.e === 0 ? 'grey' : 'white' }}>
|
||||||
<span style={{ color: 'lightblue' }}>
|
{device.n}
|
||||||
({device.e})
|
|
||||||
</span>
|
</span>
|
||||||
|
{device.e !== 0 && (
|
||||||
|
<span style={{ color: 'lightblue' }}>
|
||||||
|
({device.e})
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</Cell>
|
||||||
|
<Cell stiff>
|
||||||
|
<ButtonTooltip
|
||||||
|
title={`DeviceID: 0x${('00' + device.d.toString(16).toUpperCase()).slice(-2)}, ProductID: ${device.p}`}
|
||||||
|
>
|
||||||
|
<span>{device.tn}</span>
|
||||||
|
</ButtonTooltip>
|
||||||
</Cell>
|
</Cell>
|
||||||
<Cell stiff>{device.tn}</Cell>
|
|
||||||
</Row>
|
</Row>
|
||||||
))}
|
))}
|
||||||
</Body>
|
</Body>
|
||||||
|
|||||||
@@ -64,8 +64,6 @@ void WebDataService::core_data(AsyncWebServerRequest * request) {
|
|||||||
// list is already sorted by device type
|
// list is already sorted by device type
|
||||||
JsonArray devices = root["devices"].to<JsonArray>();
|
JsonArray devices = root["devices"].to<JsonArray>();
|
||||||
for (const auto & emsdevice : EMSESP::emsdevices) {
|
for (const auto & emsdevice : EMSESP::emsdevices) {
|
||||||
// ignore controller and gateway
|
|
||||||
if (emsdevice && (emsdevice->device_type() != EMSdevice::DeviceType::CONTROLLER && emsdevice->device_type() != EMSdevice::DeviceType::GATEWAY && emsdevice->count_entities() > 0)) {
|
|
||||||
JsonObject obj = devices.add<JsonObject>();
|
JsonObject obj = devices.add<JsonObject>();
|
||||||
obj["id"] = emsdevice->unique_id(); // a unique id
|
obj["id"] = emsdevice->unique_id(); // a unique id
|
||||||
obj["tn"] = emsdevice->device_type_2_device_name_translated(); // translated device type name
|
obj["tn"] = emsdevice->device_type_2_device_name_translated(); // translated device type name
|
||||||
@@ -77,7 +75,6 @@ void WebDataService::core_data(AsyncWebServerRequest * request) {
|
|||||||
obj["v"] = emsdevice->version(); // version
|
obj["v"] = emsdevice->version(); // version
|
||||||
obj["e"] = emsdevice->count_entities(); // number of entities
|
obj["e"] = emsdevice->count_entities(); // number of entities
|
||||||
obj["url"] = emsdevice->device_type_name(); // non-translated, lower-case, used for API URL in customization page
|
obj["url"] = emsdevice->device_type_name(); // non-translated, lower-case, used for API URL in customization page
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// add any custom entities
|
// add any custom entities
|
||||||
|
|||||||
Reference in New Issue
Block a user