diff --git a/interface/package.json b/interface/package.json index 6cfa89f3a..f7031d810 100644 --- a/interface/package.json +++ b/interface/package.json @@ -24,8 +24,8 @@ "dependencies": { "@alova/adapter-xhr": "^1.0.6", "@alova/scene-react": "^1.6.1", - "@emotion/react": "^11.11.4", - "@emotion/styled": "^11.11.5", + "@emotion/react": "^11.12.0", + "@emotion/styled": "^11.12.0", "@mui/icons-material": "^5.16.4", "@mui/material": "^5.16.4", "@table-library/react-table-library": "4.1.7", diff --git a/interface/src/framework/system/SystemStatus.tsx b/interface/src/framework/system/SystemStatus.tsx index 5a6d65383..3a60cc832 100644 --- a/interface/src/framework/system/SystemStatus.tsx +++ b/interface/src/framework/system/SystemStatus.tsx @@ -314,16 +314,6 @@ const SystemStatus: FC = () => { return ( <> - - - - - - - - - - @@ -347,7 +337,6 @@ const SystemStatus: FC = () => { - @@ -375,8 +364,8 @@ const SystemStatus: FC = () => { )} - + { text={data.emsesp_version} to="/settings/upload" /> - + + + + { text={formatNumber(data.free_heap) + ' KB' + ' ' + LL.FREE_MEMORY()} to="/system/espsystemstatus" /> - + { text={networkStatus()} to="/settings/network/status" /> - + { text={data.mqtt_status ? LL.ACTIVE() : LL.INACTIVE(0)} to="/settings/mqtt/status" /> - + { text={ntpStatus()} to="/settings/ntp/status" /> - + =16.8.0" peerDependenciesMeta: "@types/react": optional: true - checksum: 10c0/6df892fd9e04b5c8c37aacfd7f461631e04e00e845edc3c5b2955ab8ad681abf5cd49584101f579427e08b82f2f88369c78d37ae2fe9360a8f68fd4e51b8e448 + checksum: 10c0/a2035e0a5788ec6748b595ae898732aa845515dea52657fcf2661288d01c7da16133588fdaa4288c05175dc4c39938546af265bb039065efca20a729c486da9b languageName: node linkType: hard -"@emotion/serialize@npm:^1.1.2, @emotion/serialize@npm:^1.1.3, @emotion/serialize@npm:^1.1.4": - version: 1.1.4 - resolution: "@emotion/serialize@npm:1.1.4" +"@emotion/serialize@npm:^1.2.0": + version: 1.2.0 + resolution: "@emotion/serialize@npm:1.2.0" dependencies: - "@emotion/hash": "npm:^0.9.1" - "@emotion/memoize": "npm:^0.8.1" - "@emotion/unitless": "npm:^0.8.1" - "@emotion/utils": "npm:^1.2.1" + "@emotion/hash": "npm:^0.9.2" + "@emotion/memoize": "npm:^0.9.0" + "@emotion/unitless": "npm:^0.9.0" + "@emotion/utils": "npm:^1.3.0" csstype: "npm:^3.0.2" - checksum: 10c0/164d936f72382594c47b9c24e67a51c7fc16b83d9a36b84eec5e4cb9bf7be029218a490ef4b44233a1b53423bdb3905d65b597cde3ebba759d40dab7a4c99121 + checksum: 10c0/bac56ccc42b4842bbb55139296bfef812ec6d26cf92db1a7adfc90dcab8d2b717706828ff474feff227ef1a5f611020c5a2443ba600ed01d28095f0201b352e2 languageName: node linkType: hard @@ -761,30 +781,37 @@ __metadata: languageName: node linkType: hard -"@emotion/styled@npm:^11.11.5": - version: 11.11.5 - resolution: "@emotion/styled@npm:11.11.5" +"@emotion/sheet@npm:^1.3.0": + version: 1.3.0 + resolution: "@emotion/sheet@npm:1.3.0" + checksum: 10c0/99ce618d426e0646f58591200619cf3cd6f452e829c0b0339f66b3e4bfd7d51773f49d0200e14334861bee9db1dfb5d46328b20eafbfdd28f857584688fad8f4 + languageName: node + linkType: hard + +"@emotion/styled@npm:^11.12.0": + version: 11.12.0 + resolution: "@emotion/styled@npm:11.12.0" dependencies: "@babel/runtime": "npm:^7.18.3" - "@emotion/babel-plugin": "npm:^11.11.0" - "@emotion/is-prop-valid": "npm:^1.2.2" - "@emotion/serialize": "npm:^1.1.4" + "@emotion/babel-plugin": "npm:^11.12.0" + "@emotion/is-prop-valid": "npm:^1.3.0" + "@emotion/serialize": "npm:^1.2.0" "@emotion/use-insertion-effect-with-fallbacks": "npm:^1.0.1" - "@emotion/utils": "npm:^1.2.1" + "@emotion/utils": "npm:^1.3.0" peerDependencies: "@emotion/react": ^11.0.0-rc.0 react: ">=16.8.0" peerDependenciesMeta: "@types/react": optional: true - checksum: 10c0/27da6ad7f5b374d61cfe6647cc2f93ee3ceb1139a51907050576ee30da0a50a27b0bbed45f76889d560d2a8ccf8bc4a4f7126cad3f00127e107c11093dc0a801 + checksum: 10c0/f87466ade3c872c6452091969f2784b97dcec821f812f641088e1289ad039ddea7165e8b1221895911f199469d07a9ffc786434e496ae3cb62156f72a5686ad7 languageName: node linkType: hard -"@emotion/unitless@npm:^0.8.1": - version: 0.8.1 - resolution: "@emotion/unitless@npm:0.8.1" - checksum: 10c0/a1ed508628288f40bfe6dd17d431ed899c067a899fa293a13afe3aed1d70fac0412b8a215fafab0b42829360db687fecd763e5f01a64ddc4a4b58ec3112ff548 +"@emotion/unitless@npm:^0.9.0": + version: 0.9.0 + resolution: "@emotion/unitless@npm:0.9.0" + checksum: 10c0/f907d968a49315bb654b5734edf3315e52350f77c160a63f3437f14d80610dc78fd8295e759e7339055c45bd25c74c46363235c5971aae5587f7eeb969580c4c languageName: node linkType: hard @@ -804,6 +831,13 @@ __metadata: languageName: node linkType: hard +"@emotion/utils@npm:^1.3.0": + version: 1.3.0 + resolution: "@emotion/utils@npm:1.3.0" + checksum: 10c0/a42ec56b78e4fea16d120da31fb1d5ccffb9ad372e26c620eb6fe3ca5bb63f9d0d88497af01cd503e4baea9b1dd6d4fe04b897b7720c26a53eee8b993bc8000d + languageName: node + linkType: hard + "@emotion/weak-memoize@npm:^0.3.1": version: 0.3.1 resolution: "@emotion/weak-memoize@npm:0.3.1" @@ -811,6 +845,13 @@ __metadata: languageName: node linkType: hard +"@emotion/weak-memoize@npm:^0.4.0": + version: 0.4.0 + resolution: "@emotion/weak-memoize@npm:0.4.0" + checksum: 10c0/64376af11f1266042d03b3305c30b7502e6084868e33327e944b539091a472f089db307af69240f7188f8bc6b319276fd7b141a36613f1160d73d12a60f6ca1a + languageName: node + linkType: hard + "@esbuild/aix-ppc64@npm:0.21.5": version: 0.21.5 resolution: "@esbuild/aix-ppc64@npm:0.21.5" @@ -2013,8 +2054,8 @@ __metadata: "@alova/adapter-xhr": "npm:^1.0.6" "@alova/scene-react": "npm:^1.6.1" "@babel/core": "npm:^7.24.9" - "@emotion/react": "npm:^11.11.4" - "@emotion/styled": "npm:^11.11.5" + "@emotion/react": "npm:^11.12.0" + "@emotion/styled": "npm:^11.12.0" "@eslint/js": "npm:^9.7.0" "@mui/icons-material": "npm:^5.16.4" "@mui/material": "npm:^5.16.4" diff --git a/lib/ESPAsyncWebServer/src/AsyncJson.h b/lib/ESPAsyncWebServer/src/AsyncJson.h index c1c604d54..1db57c991 100644 --- a/lib/ESPAsyncWebServer/src/AsyncJson.h +++ b/lib/ESPAsyncWebServer/src/AsyncJson.h @@ -41,7 +41,7 @@ class ChunkPrint : public Print { } }; -// added msgPack by Proddy +// added msgPack by proddy for EMS-ESP class AsyncJsonResponse : public AsyncAbstractResponse { protected: JsonDocument _jsonBuffer; diff --git a/lib/ESPAsyncWebServer/src/ESPAsyncWebServer.h b/lib/ESPAsyncWebServer/src/ESPAsyncWebServer.h index 7526b6254..c864d40ce 100644 --- a/lib/ESPAsyncWebServer/src/ESPAsyncWebServer.h +++ b/lib/ESPAsyncWebServer/src/ESPAsyncWebServer.h @@ -329,9 +329,7 @@ class AsyncWebServerRequest { AsyncResponseStream * beginResponseStream(const String & contentType, size_t bufferSize = 1460); AsyncWebServerResponse * beginResponse_P(int code, const String & contentType, const uint8_t * content, size_t len, AwsTemplateProcessor callback = nullptr); AsyncWebServerResponse * beginResponse_P(int code, const String & contentType, PGM_P content, AwsTemplateProcessor callback = nullptr); - - // added by proddy for EMS-ESP - AsyncWebServerResponse * beginResponse(const String & contentType, const uint8_t * content, size_t len); + AsyncWebServerResponse * beginResponse(const String & contentType, const uint8_t * content, size_t len); // added by proddy for EMS-ESP size_t headers() const; // get header count bool hasHeader(const String & name) const; // check if header exists diff --git a/scripts/boot_app0.bin b/scripts/boot_app0.bin deleted file mode 100755 index 13562cabb..000000000 Binary files a/scripts/boot_app0.bin and /dev/null differ diff --git a/scripts/bootloader.bin b/scripts/bootloader.bin deleted file mode 100644 index 01419bff9..000000000 Binary files a/scripts/bootloader.bin and /dev/null differ diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 06d1151f1..91f578182 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -580,6 +580,7 @@ void Mqtt::ha_status() { #endif // These come from the heartbeat MQTT topic + // we don't use camelCase as it would change the HA entity_id and impact historic data publish_system_ha_sensor_config(DeviceValueType::STRING, "EMS Bus", "bus_status", DeviceValueUOM::NONE); publish_system_ha_sensor_config(DeviceValueType::STRING, "Uptime", "uptime", DeviceValueUOM::NONE); publish_system_ha_sensor_config(DeviceValueType::INT8, "Uptime (sec)", "uptime_sec", DeviceValueUOM::SECONDS); diff --git a/src/system.cpp b/src/system.cpp index 0d76b31ed..25ffdc458 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -1359,6 +1359,7 @@ bool System::get_value_info(JsonObject root, const char * command) { // export status information including the device information // http://ems-esp/api/system/info +// TODO camelCase - #1860 bool System::command_info(const char * value, const int8_t id, JsonObject output) { JsonObject node; @@ -1413,7 +1414,7 @@ bool System::command_info(const char * value, const int8_t id, JsonObject output #endif EMSESP::esp8266React.getNetworkSettingsService()->read([&](NetworkSettings & settings) { if (WiFi.status() == WL_CONNECTED && !settings.bssid.isEmpty()) { - node["BSSID"] = "set"; // TODO why is this not the actual value?? + node["BSSID"] = "set"; // we don't disclose the name } node["TxPower setting"] = settings.tx_power; node["static ip config"] = settings.staticIPConfig; @@ -1591,6 +1592,7 @@ bool System::command_info(const char * value, const int8_t id, JsonObject output obj["name"] = emsdevice->name(); // custom name obj["device id"] = Helpers::hextoa(emsdevice->device_id()); obj["product id"] = emsdevice->product_id(); + obj["brand"] = emsdevice->brand_to_char(); obj["version"] = emsdevice->version(); obj["entities"] = emsdevice->count_entities(); char result[500]; diff --git a/test/api_test.http b/test/api_test.http index 8af1807e8..71012060a 100755 --- a/test/api_test.http +++ b/test/api_test.http @@ -146,3 +146,23 @@ Content-Type: application/json < ./standalone_file_export/emsesp_settings.json ------WebKitFormBoundary7MA4YWxkTrZu0gW-- +# test calling Home Assistant script +# https://developers.home-assistant.io/docs/api/rest/#post-apiservicesdomainservice +POST {{host_standalone}}/api + +# HA + +@ha = http://192.168.1.42:8123 +@ha_token = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIwMzMyZjU1MjhlZmM0NGIyOTgyMjIxNThiODU1NDkyNSIsImlhdCI6MTcyMTMwNDg2NSwiZXhwIjoyMDM2NjY0ODY1fQ.Q-Y7E_i7clH3ff4Ma-OMmhZfbN7aMi_CahKwmoar + +### + +GET {{ha}}/api/services +Content-Type: application/json +Authorization: Bearer {{ha_token}} + +### + +POST {{ha}}/api/services/script/test_notify +Content-Type: application/json +Authorization: Bearer {{ha_token}} diff --git a/test/api_test.sh b/test/api_test.sh new file mode 100755 index 000000000..c6e464831 --- /dev/null +++ b/test/api_test.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# API + +curl -X GET http://ems-esp.local/api/system/info +echo "\n" + +# HA + +ha_url="http://192.168.1.42:8123" +ha_token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIwMzMyZjU1MjhlZmM0NGIyOTgyMjIxNThiODU1NDkyNSIsImlhdCI6MTcyMTMwNDg2NSwiZXhwIjoyMDM2NjY0ODY1fQ.Q-Y7E_i7clH3ff4Ma-OMmhZfbN7aMi_CahKwmoar" + +curl -X POST \ + ${ha_url}/api/services/script/test_notify \ + -H "Authorization: Bearer ${ha_token}" \ + -H "Content-Type: application/json" \