mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
Call read commands from Web #2116
This commit is contained in:
@@ -207,13 +207,66 @@ function check_upgrade(version: string) {
|
||||
|
||||
// START DATA
|
||||
|
||||
// EMS-ESP Application Settings
|
||||
let settings = {
|
||||
locale: 'en',
|
||||
tx_mode: 1,
|
||||
ems_bus_id: 11,
|
||||
syslog_enabled: false,
|
||||
syslog_level: 3,
|
||||
trace_raw: false,
|
||||
syslog_mark_interval: 0,
|
||||
syslog_host: '192.168.1.8',
|
||||
syslog_port: 514,
|
||||
boiler_heatingoff: false,
|
||||
remote_timeout: 24,
|
||||
remote_timeout_en: false,
|
||||
shower_timer: true,
|
||||
shower_alert: false,
|
||||
shower_alert_coldshot: 10,
|
||||
shower_alert_trigger: 7,
|
||||
shower_min_duration: 180,
|
||||
rx_gpio: 4,
|
||||
tx_gpio: 5,
|
||||
dallas_gpio: 14,
|
||||
dallas_parasite: false,
|
||||
led_gpio: 2,
|
||||
hide_led: true,
|
||||
low_clock: false,
|
||||
telnet_enabled: true,
|
||||
notoken_api: false,
|
||||
readonly_mode: false,
|
||||
analog_enabled: true,
|
||||
pbutton_gpio: 34,
|
||||
solar_maxflow: 30,
|
||||
board_profile: 'E32V2',
|
||||
fahrenheit: false,
|
||||
bool_format: 1,
|
||||
bool_dashboard: 1,
|
||||
enum_format: 1,
|
||||
weblog_level: 6,
|
||||
weblog_buffer: 50,
|
||||
weblog_compact: true,
|
||||
phy_type: 1,
|
||||
eth_power: 15,
|
||||
eth_phy_addr: 0,
|
||||
eth_clock_mode: 1,
|
||||
platform: 'ESP32',
|
||||
modbus_enabled: false,
|
||||
modbus_port: 502,
|
||||
modbus_max_clients: 10,
|
||||
modbus_timeout: 10000,
|
||||
developer_mode: true
|
||||
};
|
||||
|
||||
// LOG
|
||||
const LOG_SETTINGS_ENDPOINT = REST_ENDPOINT_ROOT + 'logSettings';
|
||||
let log_settings = {
|
||||
level: 6,
|
||||
max_messages: 50,
|
||||
compact: true,
|
||||
psram: true
|
||||
psram: true,
|
||||
developer_mode: settings.developer_mode
|
||||
};
|
||||
|
||||
// NTP
|
||||
@@ -478,9 +531,6 @@ const signin = admin_signin;
|
||||
|
||||
const generate_token = { token: '1234' };
|
||||
|
||||
//
|
||||
// EMS-ESP Project specific
|
||||
//
|
||||
const EMSESP_SETTINGS_ENDPOINT = REST_ENDPOINT_ROOT + 'settings';
|
||||
const EMSESP_CORE_DATA_ENDPOINT = REST_ENDPOINT_ROOT + 'coreData';
|
||||
const EMSESP_SENSOR_DATA_ENDPOINT = REST_ENDPOINT_ROOT + 'sensorData';
|
||||
@@ -493,6 +543,7 @@ const EMSESP_DEVICEENTITIES_ENDPOINT2 = REST_ENDPOINT_ROOT + 'deviceEntities/:id
|
||||
const EMSESP_DASHBOARD_DATA_ENDPOINT = REST_ENDPOINT_ROOT + 'dashboardData';
|
||||
|
||||
const EMSESP_BOARDPROFILE_ENDPOINT = REST_ENDPOINT_ROOT + 'boardProfile';
|
||||
|
||||
const EMSESP_WRITE_DEVICEVALUE_ENDPOINT = REST_ENDPOINT_ROOT + 'writeDeviceValue';
|
||||
const EMSESP_WRITE_DEVICENAME_ENDPOINT = REST_ENDPOINT_ROOT + 'writeDeviceName';
|
||||
const EMSESP_WRITE_TEMPSENSOR_ENDPOINT =
|
||||
@@ -502,10 +553,10 @@ const EMSESP_CUSTOMIZATION_ENTITIES_ENDPOINT =
|
||||
REST_ENDPOINT_ROOT + 'customizationEntities';
|
||||
const EMSESP_RESET_CUSTOMIZATIONS_ENDPOINT =
|
||||
REST_ENDPOINT_ROOT + 'resetCustomizations';
|
||||
|
||||
const EMSESP_SCHEDULE_ENDPOINT = REST_ENDPOINT_ROOT + 'schedule';
|
||||
const EMSESP_CUSTOMENTITIES_ENDPOINT = REST_ENDPOINT_ROOT + 'customEntities';
|
||||
const EMSESP_MODULES_ENDPOINT = REST_ENDPOINT_ROOT + 'modules';
|
||||
|
||||
const EMSESP_ACTION_ENDPOINT = REST_ENDPOINT_ROOT + 'action';
|
||||
|
||||
// these are used in the API calls only
|
||||
@@ -663,56 +714,6 @@ const emsesp_allvalues = {
|
||||
}
|
||||
};
|
||||
|
||||
let settings = {
|
||||
locale: 'en',
|
||||
tx_mode: 1,
|
||||
ems_bus_id: 11,
|
||||
syslog_enabled: false,
|
||||
syslog_level: 3,
|
||||
trace_raw: false,
|
||||
syslog_mark_interval: 0,
|
||||
syslog_host: '192.168.1.8',
|
||||
syslog_port: 514,
|
||||
boiler_heatingoff: false,
|
||||
remote_timeout: 24,
|
||||
remote_timeout_en: false,
|
||||
shower_timer: true,
|
||||
shower_alert: false,
|
||||
shower_alert_coldshot: 10,
|
||||
shower_alert_trigger: 7,
|
||||
shower_min_duration: 180,
|
||||
rx_gpio: 4,
|
||||
tx_gpio: 5,
|
||||
dallas_gpio: 14,
|
||||
dallas_parasite: false,
|
||||
led_gpio: 2,
|
||||
hide_led: true,
|
||||
low_clock: false,
|
||||
telnet_enabled: true,
|
||||
notoken_api: false,
|
||||
readonly_mode: false,
|
||||
analog_enabled: true,
|
||||
pbutton_gpio: 34,
|
||||
solar_maxflow: 30,
|
||||
board_profile: 'E32V2',
|
||||
fahrenheit: false,
|
||||
bool_format: 1,
|
||||
bool_dashboard: 1,
|
||||
enum_format: 1,
|
||||
weblog_level: 6,
|
||||
weblog_buffer: 50,
|
||||
weblog_compact: true,
|
||||
phy_type: 1,
|
||||
eth_power: 15,
|
||||
eth_phy_addr: 0,
|
||||
eth_clock_mode: 1,
|
||||
platform: 'ESP32',
|
||||
modbus_enabled: false,
|
||||
modbus_port: 502,
|
||||
modbus_max_clients: 10,
|
||||
modbus_timeout: 10000
|
||||
};
|
||||
|
||||
const emsesp_coredata = {
|
||||
connected: true,
|
||||
// connected: false,
|
||||
@@ -4848,16 +4849,17 @@ router
|
||||
if (data.device === 'system') {
|
||||
if (cmd === 'info') {
|
||||
return emsesp_info;
|
||||
}
|
||||
if (cmd === 'format') {
|
||||
} else if (cmd === 'format') {
|
||||
console.log('formatting...');
|
||||
return status(200);
|
||||
}
|
||||
if (cmd === 'restart') {
|
||||
} else if (cmd === 'restart') {
|
||||
console.log('restarting...');
|
||||
system_status.status = 'restarting';
|
||||
countHardwarePoll = 0;
|
||||
return status(200);
|
||||
} else if (cmd === 'read') {
|
||||
console.log('send read command:', data.data);
|
||||
return status(200);
|
||||
}
|
||||
}
|
||||
return status(404); // not found
|
||||
|
||||
Reference in New Issue
Block a user