Hello.
I try to save config data from web socket with rpc.
After I get the response in web socket log:
← {“id”:2,“src”:“esp32_CB4990”,“result”:{“saved”:true}}
and alert message:
Error: RPC call timeout {…}
What it can be a problem?
Hello.
I try to save config data from web socket with rpc.
After I get the response in web socket log:
← {“id”:2,“src”:“esp32_CB4990”,“result”:{“saved”:true}}
and alert message:
Error: RPC call timeout {…}
What it can be a problem?
a few obvious things to check
Might be helpful if you share a code snippet of how you’re doing the save of config data, or what you RPC call looks like
main.js file:
componentDidMount() {
const logframe = (marker, frame) => {
this.setState(
state => ({
connected: state.connected,
frames: state.frames.concat(marker + JSON.stringify(frame))
}));
};
// Setup JSON-RPC engine
var rpc = mkrpc('ws://' + location.host + '/rpc');
rpc.onopen = ev => {
this.setState({connected: true});
rpc.call('Config.Get').then(res => this.set_data());
};
rpc.onclose = ev => this.setState({connected: false});
rpc.onout = ev => logframe('-> ', ev);
rpc.onin = ev => {
logframe('<- ', ev);
this.oncallback(ev);
};
this.rpc = rpc;
};
const onclick = ev => {
var pppos = {enable: true, apn: state.pppos_apn, user: state.pppos_user, pass: state.pppos_pass};
var sta = {enable: true, ssid: state.wifi_sta_ssid, pass: state.wifi_sta_pass};
var ap = {ssid: state.wifi_ap_ssid, pass: state.wifi_ap_pass, hidden: state.wifi_ap_hidden};
var port = {id: Number(state.device_id), baud_rate: Number(state.device_baud_rate), data_bits: Number(state.device_data_bits),
stop_bits: Number(state.device_stop_bits), parity: Number(state.device_parity), time_out: Number(state.device_time_out)};
var topics = {energy: state.mqtt_topic_energy, energy1: state.mqtt_topic_energy1, energy2: state.mqtt_topic_energy2,
energy3: state.mqtt_topic_energy3, energy4: state.mqtt_topic_energy4,
volume: state.mqtt_topic_volume, volume1: state.mqtt_topic_volume1, volume2: state.mqtt_topic_volume2,
volume3: state.mqtt_topic_volume3, volume4: state.mqtt_topic_volume4,
temperature: state.mqtt_topic_temperature, temperature1: state.mqtt_topic_temperature1, temperature2: state.mqtt_topic_temperature2,
temperature3: state.mqtt_topic_temperature3, temperature4: state.mqtt_topic_temperature4,
flowrate: state.mqtt_topic_flowrate, flowrate1: state.mqtt_topic_flowrate1, flowrate2: state.mqtt_topic_flowrate2,
flowrate3: state.mqtt_topic_flowrate3, flowrate4: state.mqtt_topic_flowrate4,
get_data_time: state.mqtt_topic_get_data_time, meter_errors: state.mqtt_topic_meter_errors,
service_errors: state.mqtt_topic_service_errors};
var meter = {enable: state.device_enable, type: state.device_type, polling_period: Number(state.device_polling_period),
sending_data_period: Number(state.device_sending_data_period), port: port};
var mqtt = {enable: state.mqtt_enable, server: state.mqtt_server, user: state.mqtt_login, pass: state.mqtt_password,
ssl_cert: state.mqtt_ssl_cert, ssl_key: state.mqtt_ssl_key, ssl_ca_cert: state.mqtt_ssl_ca};
var uconf = {mqtt: {topics: topics}, meter: meter};
var config = {pppos: pppos, wifi: {sta: sta, ap: ap}, mqtt: mqtt, uconf: uconf};
this.setState({spin: true});
this.rpc.call('Config.Set', {config, save: true, reboot: true})
.catch(err => alert('Error: ' + err))
.then(ev => this.setState({spin: false}));
};
I found the problem!
It was the exception in my rpc callback method!..
Topic closed.