This commit is contained in:
proddy
2021-04-03 13:08:25 +02:00
parent 166f8f6c3a
commit e1f777e33a
2 changed files with 182 additions and 231 deletions

View File

@@ -17,4 +17,13 @@ and to run it
% npm run dev % npm run dev
``` ```
The hardcoded data is limited at the moment and can be easily extended by changing the file `/mock-api/server.js` ## Notes
- It's for local development only
- `src/.env.development` is no longer required
- CORS is removed, also the build flag
- new file `interface/src/setupProxy.js`
- new files `mock-api/server.js` with the hardcoded data. Requires its own npm packages for express
## ToDo
- add filter rule to prevent from exposing yourself to malicious attacks when running the dev server(https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a)

View File

@@ -1,103 +1,51 @@
const express = require('express'); const express = require('express');
const path = require('path'); const path = require('path');
const bodyParser = require("body-parser");
const app = express(); const app = express();
const port = process.env.PORT || 3080; const port = process.env.PORT || 3080;
app.use(express.static(path.join(__dirname, '../interface/build')));
app.use(express.json());
const ENDPOINT_ROOT = "/rest/"; const ENDPOINT_ROOT = "/rest/";
const FEATURES_ENDPOINT = ENDPOINT_ROOT + "features"; // NTP
const NTP_STATUS_ENDPOINT = ENDPOINT_ROOT + "ntpStatus"; const NTP_STATUS_ENDPOINT = ENDPOINT_ROOT + "ntpStatus";
const NTP_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "ntpSettings"; const NTP_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "ntpSettings";
const TIME_ENDPOINT = ENDPOINT_ROOT + "time";
const ntp_settings = {
"enabled": true, "server": "time.google.com", "tz_label": "Europe/Amsterdam", "tz_format": "CET-1CEST,M3.5.0,M10.5.0/3"
};
const ntp_status = {
"status": 1, "utc_time": "2021-04-01T14:25:42Z", "local_time": "2021-04-01T16:25:42", "server": "time.google.com", "uptime": 856
}
// AP
const AP_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "apSettings"; const AP_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "apSettings";
const AP_STATUS_ENDPOINT = ENDPOINT_ROOT + "apStatus"; const AP_STATUS_ENDPOINT = ENDPOINT_ROOT + "apStatus";
const ap_settings = {
"provision_mode": 1, "ssid": "ems-esp", "password": "ems-esp-neo", "local_ip": "192.168.4.1",
"gateway_ip": "192.168.4.1", "subnet_mask": "255.255.255.0"
};
const ap_status = {
"status": 1, "ip_address": "192.168.4.1", "mac_address": "3C:61:05:03:AB:2D", "station_num": 0
};
// NETWORK
const NETWORK_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "networkSettings"; const NETWORK_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "networkSettings";
const NETWORK_STATUS_ENDPOINT = ENDPOINT_ROOT + "networkStatus"; const NETWORK_STATUS_ENDPOINT = ENDPOINT_ROOT + "networkStatus";
const OTA_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "otaSettings";
const MQTT_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "mqttSettings";
const MQTT_STATUS_ENDPOINT = ENDPOINT_ROOT + "mqttStatus";
const VERIFY_AUTHORIZATION_ENDPOINT = ENDPOINT_ROOT + "verifyAuthorization";
const SYSTEM_STATUS_ENDPOINT = ENDPOINT_ROOT + "systemStatus";
const SECURITY_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "securitySettings";
const SCAN_NETWORKS_ENDPOINT = ENDPOINT_ROOT + "scanNetworks"; const SCAN_NETWORKS_ENDPOINT = ENDPOINT_ROOT + "scanNetworks";
const LIST_NETWORKS_ENDPOINT = ENDPOINT_ROOT + "listNetworks"; const LIST_NETWORKS_ENDPOINT = ENDPOINT_ROOT + "listNetworks";
const network_settings = {
// POSTs ssid: "myWifi", password: 'myPassword', hostname: 'ems-esp', static_ip_config: false
const RESTART_ENDPOINT = ENDPOINT_ROOT + "restart"; };
const FACTORY_RESET_ENDPOINT = ENDPOINT_ROOT + "factoryReset"; const network_status =
const UPLOAD_FIRMWARE_ENDPOINT = ENDPOINT_ROOT + "uploadFirmware"; {
const SIGN_IN_ENDPOINT = ENDPOINT_ROOT + "signIn";
const TIME_ENDPOINT = ENDPOINT_ROOT + "time";
// EMS-ESP Project specific
const EMSESP_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "emsespSettings";
const EMSESP_ALLDEVICES_ENDPOINT = ENDPOINT_ROOT + "allDevices";
const EMSESP_SCANDEVICES_ENDPOINT = ENDPOINT_ROOT + "scanDevices";
const EMSESP_DEVICEDATA_ENDPOINT = ENDPOINT_ROOT + "deviceData";
const EMSESP_STATUS_ENDPOINT = ENDPOINT_ROOT + "emsespStatus";
const EMSESP_BOARDPROFILE_ENDPOINT = ENDPOINT_ROOT + "boardProfile";
app.use(bodyParser.json());
app.use(express.static(path.join(__dirname, '../interface/build')));
app.get(FEATURES_ENDPOINT, (req, res) => {
res.json({
"project": true, "security": true, "mqtt": true, "ntp": true, "ota": true, "upload_firmware": true
});
});
app.get(VERIFY_AUTHORIZATION_ENDPOINT, (req, res) => {
res.json({
access_token: '1234'
});
});
app.post(RESTART_ENDPOINT, (req, res) => {
res.sendStatus(200);
});
app.post(FACTORY_RESET_ENDPOINT, (req, res) => {
res.sendStatus(200);
});
app.post(UPLOAD_FIRMWARE_ENDPOINT, (req, res) => {
res.sendStatus(200);
});
app.post(TIME_ENDPOINT, (req, res) => {
res.sendStatus(200);
});
app.post(SIGN_IN_ENDPOINT, (req, res) => {
res.json({
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiYWRtaW4iOnRydWUsInZlcnNpb24iOiIzLjAuMmIwIn0.MsHSgoJKI1lyYz77EiT5ZN3ECMrb4mPv9FNy3udq0TU"
});
});
app.get(NETWORK_STATUS_ENDPOINT, (req, res) => {
res.json(
{
"status": 3, "local_ip": "10.10.10.101", "mac_address": "3C:61:05:03:AB:2C", "rssi": -41, "ssid": "home", "status": 3, "local_ip": "10.10.10.101", "mac_address": "3C:61:05:03:AB:2C", "rssi": -41, "ssid": "home",
"bssid": "06:ED:DA:FE:B4:68", "channel": 11, "subnet_mask": "255.255.255.0", "gateway_ip": "10.10.10.1", "bssid": "06:ED:DA:FE:B4:68", "channel": 11, "subnet_mask": "255.255.255.0", "gateway_ip": "10.10.10.1",
"dns_ip_1": "10.10.10.1", "dns_ip_2": "0.0.0.0" "dns_ip_1": "10.10.10.1", "dns_ip_2": "0.0.0.0"
} };
); const list_networks = {
});
app.get(NETWORK_SETTINGS_ENDPOINT, (req, res) => {
res.json({
ssid: "myWifi", password: 'myPassword', hostname: 'ems-esp', static_ip_config: false
});
});
app.post(NETWORK_SETTINGS_ENDPOINT, (req, res) => {
res.json({});
});
app.get(LIST_NETWORKS_ENDPOINT, (req, res) => {
res.json({
"networks": [ "networks": [
{ "rssi": -40, "ssid": "", "bssid": "FC:EC:DA:FD:B4:68", "channel": 11, "encryption_type": 3 }, { "rssi": -40, "ssid": "", "bssid": "FC:EC:DA:FD:B4:68", "channel": 11, "encryption_type": 3 },
{ "rssi": -41, "ssid": "home", "bssid": "02:EC:DA:FD:B4:68", "channel": 11, "encryption_type": 3 }, { "rssi": -41, "ssid": "home", "bssid": "02:EC:DA:FD:B4:68", "channel": 11, "encryption_type": 3 },
@@ -108,108 +56,68 @@ app.get(LIST_NETWORKS_ENDPOINT, (req, res) => {
{ "rssi": -75, "ssid": "", "bssid": "C6:C9:E3:FF:A5:DE", "channel": 2, "encryption_type": 3 }, { "rssi": -75, "ssid": "", "bssid": "C6:C9:E3:FF:A5:DE", "channel": 2, "encryption_type": 3 },
{ "rssi": -76, "ssid": "Bruin", "bssid": "C0:C9:E3:FF:A5:DE", "channel": 2, "encryption_type": 3 }, { "rssi": -76, "ssid": "Bruin", "bssid": "C0:C9:E3:FF:A5:DE", "channel": 2, "encryption_type": 3 },
] ]
}); };
});
app.get(SCAN_NETWORKS_ENDPOINT, (req, res) => { // OTA
res.sendStatus(202); const OTA_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "otaSettings";
}); const ota_settings = {
app.get(AP_SETTINGS_ENDPOINT, (req, res) => {
res.json({
"provision_mode": 1, "ssid": "ems-esp", "password": "ems-esp-neo", "local_ip": "192.168.4.1",
"gateway_ip": "192.168.4.1", "subnet_mask": "255.255.255.0"
});
});
app.get(AP_STATUS_ENDPOINT, (req, res) => {
res.json({
"status": 1, "ip_address": "192.168.4.1", "mac_address": "3C:61:05:03:AB:2D", "station_num": 0
});
});
app.post(AP_SETTINGS_ENDPOINT, (req, res) => {
res.json({});
});
app.get(OTA_SETTINGS_ENDPOINT, (req, res) => {
res.json({
"enabled": true, "port": 8266, "password": "ems-esp-neo" "enabled": true, "port": 8266, "password": "ems-esp-neo"
}); };
});
app.post(OTA_SETTINGS_ENDPOINT, (req, res) => { // MQTT
res.json({}); const MQTT_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "mqttSettings";
}); const MQTT_STATUS_ENDPOINT = ENDPOINT_ROOT + "mqttStatus";
const mqtt_settings = {
app.get(MQTT_SETTINGS_ENDPOINT, (req, res) => {
res.json({
"enabled": true, "host": "192.168.1.4", "port": 1883, "base": "ems-esp32", "username": "", "password": "", "enabled": true, "host": "192.168.1.4", "port": 1883, "base": "ems-esp32", "username": "", "password": "",
"client_id": "ems-esp32", "keep_alive": 60, "clean_session": true, "max_topic_length": 128, "client_id": "ems-esp32", "keep_alive": 60, "clean_session": true, "max_topic_length": 128,
"publish_time_boiler": 10, "publish_time_thermostat": 10, "publish_time_solar": 10, "publish_time_mixer": 10, "publish_time_boiler": 10, "publish_time_thermostat": 10, "publish_time_solar": 10, "publish_time_mixer": 10,
"publish_time_other": 10, "publish_time_sensor": 10, "mqtt_qos": 0, "mqtt_retain": false, "dallas_format": 1, "publish_time_other": 10, "publish_time_sensor": 10, "mqtt_qos": 0, "mqtt_retain": false, "dallas_format": 1,
"bool_format": 1, "ha_climate_format": 1, "ha_enabled": true, "nested_format": true, "subscribe_format": 0 "bool_format": 1, "ha_climate_format": 1, "ha_enabled": true, "nested_format": true, "subscribe_format": 0
}); };
}); const mqtt_status = {
app.post(MQTT_SETTINGS_ENDPOINT, (req, res) => {
res.json({});
});
app.get(MQTT_STATUS_ENDPOINT, (req, res) => {
res.json({
"enabled": true, "connected": true, "client_id": "ems-esp32", "disconnect_reason": 0, "mqtt_fails": 0 "enabled": true, "connected": true, "client_id": "ems-esp32", "disconnect_reason": 0, "mqtt_fails": 0
}); };
});
app.get(NTP_SETTINGS_ENDPOINT, (req, res) => { // SYSTEM
res.json({ const FEATURES_ENDPOINT = ENDPOINT_ROOT + "features";
"enabled": true, "server": "time.google.com", "tz_label": "Europe/Amsterdam", "tz_format": "CET-1CEST,M3.5.0,M10.5.0/3" const VERIFY_AUTHORIZATION_ENDPOINT = ENDPOINT_ROOT + "verifyAuthorization";
}); const SYSTEM_STATUS_ENDPOINT = ENDPOINT_ROOT + "systemStatus";
}); const SECURITY_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "securitySettings";
const RESTART_ENDPOINT = ENDPOINT_ROOT + "restart";
app.post(NTP_SETTINGS_ENDPOINT, (req, res) => { const FACTORY_RESET_ENDPOINT = ENDPOINT_ROOT + "factoryReset";
res.json({}); const UPLOAD_FIRMWARE_ENDPOINT = ENDPOINT_ROOT + "uploadFirmware";
}); const SIGN_IN_ENDPOINT = ENDPOINT_ROOT + "signIn";
const system_status = {
app.get(NTP_STATUS_ENDPOINT, (req, res) => {
res.json({
"status": 1, "utc_time": "2021-04-01T14:25:42Z", "local_time": "2021-04-01T16:25:42", "server": "time.google.com", "uptime": 856
});
});
app.get(SYSTEM_STATUS_ENDPOINT, (req, res) => {
res.json({
"esp_platform": "ESP32", "max_alloc_heap": 113792, "psram_size": 0, "free_psram": 0, "cpu_freq_mhz": 240, "esp_platform": "ESP32", "max_alloc_heap": 113792, "psram_size": 0, "free_psram": 0, "cpu_freq_mhz": 240,
"free_heap": 193340, "sdk_version": "v3.3.5-1-g85c43024c", "flash_chip_size": 4194304, "flash_chip_speed": 40000000, "free_heap": 193340, "sdk_version": "v3.3.5-1-g85c43024c", "flash_chip_size": 4194304, "flash_chip_speed": 40000000,
"fs_total": 65536, "fs_used": 16384, "uptime": "000+00:15:42.707" "fs_total": 65536, "fs_used": 16384, "uptime": "000+00:15:42.707"
}); };
}); const security_settings = {
app.get(SECURITY_SETTINGS_ENDPOINT, (req, res) => {
res.json({
"jwt_secret": "naughty!", "users": [{ "username": "admin", "password": "admin", "admin": true }, { "username": "guest", "password": "guest", "admin": false }] "jwt_secret": "naughty!", "users": [{ "username": "admin", "password": "admin", "admin": true }, { "username": "guest", "password": "guest", "admin": false }]
}); };
}); const features = {
"project": true, "security": true, "mqtt": true, "ntp": true, "ota": true, "upload_firmware": true
};
const verify_authentication = { access_token: '1234' };
const signin = {
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiYWRtaW4iOnRydWUsInZlcnNpb24iOiIzLjAuMmIwIn0.MsHSgoJKI1lyYz77EiT5ZN3ECMrb4mPv9FNy3udq0TU"
};
app.post(SECURITY_SETTINGS_ENDPOINT, (req, res) => { // EMS-ESP Project specific
res.json({}); const EMSESP_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "emsespSettings";
}); const EMSESP_ALLDEVICES_ENDPOINT = ENDPOINT_ROOT + "allDevices";
const EMSESP_SCANDEVICES_ENDPOINT = ENDPOINT_ROOT + "scanDevices";
// EMS-ESP Project stuff const EMSESP_DEVICEDATA_ENDPOINT = ENDPOINT_ROOT + "deviceData";
const EMSESP_STATUS_ENDPOINT = ENDPOINT_ROOT + "emsespStatus";
app.get(EMSESP_SETTINGS_ENDPOINT, (req, res) => { const EMSESP_BOARDPROFILE_ENDPOINT = ENDPOINT_ROOT + "boardProfile";
res.json({ const emsesp_settings = {
"tx_mode": 1, "tx_delay": 0, "ems_bus_id": 11, "syslog_enabled": false, "syslog_level": 3, "tx_mode": 1, "tx_delay": 0, "ems_bus_id": 11, "syslog_enabled": false, "syslog_level": 3,
"trace_raw": false, "syslog_mark_interval": 0, "syslog_host": "192.168.1.4", "syslog_port": 514, "trace_raw": false, "syslog_mark_interval": 0, "syslog_host": "192.168.1.4", "syslog_port": 514,
"master_thermostat": 0, "shower_timer": true, "shower_alert": false, "rx_gpio": 23, "tx_gpio": 5, "master_thermostat": 0, "shower_timer": true, "shower_alert": false, "rx_gpio": 23, "tx_gpio": 5,
"dallas_gpio": 3, "dallas_parasite": false, "led_gpio": 2, "hide_led": false, "api_enabled": true, "dallas_gpio": 3, "dallas_parasite": false, "led_gpio": 2, "hide_led": false, "api_enabled": true,
"analog_enabled": false, "pbutton_gpio": 0, "board_profile": "S32" "analog_enabled": false, "pbutton_gpio": 0, "board_profile": "S32"
}); };
}); const emsesp_alldevices = {
app.get(EMSESP_ALLDEVICES_ENDPOINT, (req, res) => {
res.json({
"devices": [{ "devices": [{
"id": 1, "type": "Thermostat", "brand": "---", "name": "RC20/Moduline 300", "id": 1, "type": "Thermostat", "brand": "---", "name": "RC20/Moduline 300",
"deviceid": 23, "productid": 77, "version": "03.03" "deviceid": 23, "productid": 77, "version": "03.03"
@@ -221,19 +129,16 @@ app.get(EMSESP_ALLDEVICES_ENDPOINT, (req, res) => {
"deviceid": 9, "productid": 190, "version": "01.03" "deviceid": 9, "productid": 190, "version": "01.03"
}], }],
"sensors": [] "sensors": []
}); }
}); const emsesp_status = {
app.get(EMSESP_STATUS_ENDPOINT, (req, res) => {
res.json({
"status": 0, "rx_received": 344, "tx_sent": 104, "rx_quality": 100, "tx_quality": 100 "status": 0, "rx_received": 344, "tx_sent": 104, "rx_quality": 100, "tx_quality": 100
}); };
}); const emsesp_devicedata_1 = {
"name": "Thermostat: RC20/Moduline 300", "data": ["16:28:21 01/04/2021", "", "date/time",
app.post(EMSESP_DEVICEDATA_ENDPOINT, (req, res) => { "(0)", "", "error code", 15, "°C", "(hc1) setpoint room temperature", 20.5, "°C",
const id = req.body.id; "(hc1) current room temperature", "auto", "", "(hc1) mode"]
if (id == 2) { };
res.json({ const emsesp_devicedata_2 = {
"name": "Boiler: Nefit GBx72/Trendline/Cerapur/Greenstar Si/27i", "data": ["off", "", "heating active", "off", "", "name": "Boiler: Nefit GBx72/Trendline/Cerapur/Greenstar Si/27i", "data": ["off", "", "heating active", "off", "",
"warm water active", 5, "°C", "selected flow temperature", 0, "%", "burner selected max power", 0, "%", "warm water active", 5, "°C", "selected flow temperature", 0, "%", "burner selected max power", 0, "%",
"heating pump modulation", 42.7, "°C", "current flow temperature", 39, "°C", "return temperature", 1.2, "heating pump modulation", 42.7, "°C", "current flow temperature", 39, "°C", "return temperature", 1.2,
@@ -256,19 +161,61 @@ app.post(EMSESP_DEVICEDATA_ENDPOINT, (req, res) => {
"(warm water) disinfecting", "off", "", "(warm water) charging", "off", "", "(warm water) recharging", "on", "", "(warm water) disinfecting", "off", "", "(warm water) charging", "off", "", "(warm water) recharging", "on", "",
"(warm water) temperature ok", "off", "", "(warm water) active", "on", "", "(warm water) heating", 262387, "", "(warm water) temperature ok", "off", "", "(warm water) active", "on", "", "(warm water) heating", 262387, "",
"(warm water) # starts", "64 days 14 hours 13 minutes", null, "(warm water) active time"] "(warm water) # starts", "64 days 14 hours 13 minutes", null, "(warm water) active time"]
}); };
}
// NETWORK
app.get(NETWORK_STATUS_ENDPOINT, (req, res) => { res.json(network_status); });
app.get(NETWORK_SETTINGS_ENDPOINT, (req, res) => { res.json(network_settings); });
app.post(NETWORK_SETTINGS_ENDPOINT, (req, res) => { res.json(network_settings); });
app.get(LIST_NETWORKS_ENDPOINT, (req, res) => { res.json(list_networks); });
app.get(SCAN_NETWORKS_ENDPOINT, (req, res) => { res.sendStatus(202); });
// AP
app.get(AP_SETTINGS_ENDPOINT, (req, res) => { res.json(ap_settings); });
app.get(AP_STATUS_ENDPOINT, (req, res) => { res.json(ap_status); });
app.post(AP_SETTINGS_ENDPOINT, (req, res) => { res.json(ap_settings); });
// OTA
app.get(OTA_SETTINGS_ENDPOINT, (req, res) => { res.json(ota_settings); });
app.post(OTA_SETTINGS_ENDPOINT, (req, res) => { res.json(ota_settings); });
// MQTT
app.get(MQTT_SETTINGS_ENDPOINT, (req, res) => { res.json(mqtt_settings); });
app.post(MQTT_SETTINGS_ENDPOINT, (req, res) => { res.json(mqtt_settings); });
app.get(MQTT_STATUS_ENDPOINT, (req, res) => { res.json(mqtt_status); });
// NTP
app.get(NTP_SETTINGS_ENDPOINT, (req, res) => { res.json(ntp_settings); });
app.post(NTP_SETTINGS_ENDPOINT, (req, res) => { res.json(ntp_settings); });
app.get(NTP_STATUS_ENDPOINT, (req, res) => { res.json(ntp_status); });
app.post(TIME_ENDPOINT, (req, res) => { res.sendStatus(200); });
// SYSTEM
app.get(SYSTEM_STATUS_ENDPOINT, (req, res) => { res.json(system_status); });
app.get(SECURITY_SETTINGS_ENDPOINT, (req, res) => { res.json(security_settings); });
app.post(SECURITY_SETTINGS_ENDPOINT, (req, res) => { res.json(security_settings); });
app.get(FEATURES_ENDPOINT, (req, res) => { res.json(features); });
app.get(VERIFY_AUTHORIZATION_ENDPOINT, (req, res) => { res.json(verify_authentication); });
app.post(RESTART_ENDPOINT, (req, res) => { res.sendStatus(200); });
app.post(FACTORY_RESET_ENDPOINT, (req, res) => { res.sendStatus(200); });
app.post(UPLOAD_FIRMWARE_ENDPOINT, (req, res) => { res.sendStatus(200); });
app.post(SIGN_IN_ENDPOINT, (req, res) => { res.json(signin); });
// EMS-ESP Project stuff
app.get(EMSESP_SETTINGS_ENDPOINT, (req, res) => { res.json(emsesp_settings); });
app.post(EMSESP_SETTINGS_ENDPOINT, (req, res) => { res.json(emsesp_settings); });
app.get(EMSESP_ALLDEVICES_ENDPOINT, (req, res) => { res.json(emsesp_alldevices); });
app.get(EMSESP_STATUS_ENDPOINT, (req, res) => { res.json(emsesp_status); });
app.post(EMSESP_DEVICEDATA_ENDPOINT, (req, res) => {
const id = req.body.id;
if (id == 1) { if (id == 1) {
res.json({ res.json(emsesp_devicedata_1);
"name": "Thermostat: RC20/Moduline 300", "data": ["16:28:21 01/04/2021", "", "date/time", }
"(0)", "", "error code", 15, "°C", "(hc1) setpoint room temperature", 20.5, "°C", if (id == 2) {
"(hc1) current room temperature", "auto", "", "(hc1) mode"] res.json(emsesp_devicedata_2);
});
} }
}); });
app.post(EMSESP_BOARDPROFILE_ENDPOINT, (req, res) => { app.post(EMSESP_BOARDPROFILE_ENDPOINT, (req, res) => {
const board_profile = req.body.code; const board_profile = req.body.code;
@@ -335,10 +282,5 @@ app.post(EMSESP_BOARDPROFILE_ENDPOINT, (req, res) => {
}); });
app.post(EMSESP_SETTINGS_ENDPOINT, (req, res) => {
res.json({});
});
app.listen(port); app.listen(port);
console.log(`Mock API Server is up and running at: http://localhost:${port}`); console.log(`Mock API Server is up and running at: http://localhost:${port}`);