Comments (5)
Upon looking further, it might be because I'm using HTTP instead of MQTT?
I see a RMAKER_MQTT_EVENT_PUBLISHED in rmaker_common_event_handler in esp_insights_mqtt.c. Which then does a esp_event_post(INSIGHTS_EVENT, INSIGHTS_EVENT_TRANSPORT_SEND_SUCCESS, &data, sizeof(data), portMAX_DELAY);
from esp-insights.
Just tried looks good!
from esp-insights.
Hello @antoniuschan99 thanks for reaching out.
Does that mean there is an available event handler to retrieve the success/fail? I see in esp_insights.c line 247 an insights_event_handler() function so I have some code like this but it's failing to catch the event
Since the events go through common event handler, it does get delivered to all the subscribers in theory. Is the observation same for all the events?
5 seconds delay is good but it is not always useful as the messages are sent periodically. with minimum interval of 30 seconds.
Please remove that particular delay and go to deep_sleep after the transport send success event is received. You should also put a timeout for waiting on this event as well and go to sleep anyway. (This avoids deep_sleep logic not triggering in case of n/w issues etc). On the next boot cycle older messages will get sent on priority anyway.
PS: Waiting on transport send event also becomes less useful because of the fact you will not be able to distinguish between same event for other messages as well, which doesn't necessarily contain the heap dump you took right before.
from esp-insights.
Thanks for the reply. I am having trouble catching the event. Both in my implementation of the event handler and also in insights_event_handler in esp_insights.c when I have INSIGHTS_DEBUG_ENABLED in menuconfig. I don't see ESP_LOGI(TAG, "Data send success, msg_id:%d.", data ? data->msg_id : 0); get logged in the console.
The gist of the code is:
esp_insights_config_t config = {
.log_type = ESP_DIAG_LOG_TYPE_ERROR | ESP_DIAG_LOG_TYPE_WARNING | ESP_DIAG_LOG_TYPE_EVENT,
.node_id = "123456",
.auth_key = insights_auth_key_start,
};
esp_err_t ret = esp_insights_init(&config);
if (ret != ESP_OK) {
ESP_LOGE(TAG, "Failed to initialize ESP Insights, err:0x%x", ret);
return;
}
ret = esp_diag_heap_metrics_dump();
if (ret != ESP_OK) {
ESP_LOGE(TAG, "Failed to Dump Heap Metrics");
return;
}
}
And here are the logs.
I (2126) esp_netif_handlers: sta ip: 192.168.4.65, mask: 255.255.255.0, gw: 192.168.4.1
I (2126) WiFiConnect: Connected to IP Event Handler
I (2546) esp_rmaker_time: Initializing SNTP. Using the SNTP server: pool.ntp.org
I (2546) esp_rmaker_work_queue: Work Queue created.
I (2566) RTC_STORE: (write_at_offset): size 1025, available: 1025, filled 0, read_ptr 0, to_write 1
I (2566) RTC_STORE: (write_at_offset): size 1025, available: 1025, filled 0, read_ptr 0, to_write 8
I (2576) RTC_STORE: (write_at_offset): size 1025, available: 1025, filled 0, read_ptr 0, to_write 40
I (2586) RTC_STORE: before write_complete, filled 0, size 1025, read_offset 0, len 49
I (2596) RTC_STORE: after write_complete, filled 49, size 1025, read_offset 0, len 49
I (3216) esp_insights: =========================================
I (3226) esp_insights: Insights enabled for Node ID 123456
I (3236) esp_insights: =========================================
I (3236) RTC_STORE: (write_at_offset): size 2048, available: 2048, filled 0, read_ptr 0, to_write 1
I (3246) RTC_STORE: (write_at_offset): size 2048, available: 2048, filled 0, read_ptr 0, to_write 120
I (3256) RTC_STORE: before write_complete, filled 0, size 2048, read_offset 0, len 121
I (3266) RTC_STORE: after write_complete, filled 121, size 2048, read_offset 0, len 121
W (3236) insights_transport: connect callback not set
I (3286) esp_rmaker_work_queue: RainMaker Work Queue task started.
I (3296) esp_insights: Scheduling Insights timer for 60 seconds.
I (3306) esp_insights: Insights metrics metadata changed
I (3306) esp_insights: Insights meta data length 1099
Also, is calling esp_insights_init(&config) enough to send data to esp insights cloud, or do I need to also call esp_diag_heap_metrics_dump(). And is there also a need to call esp_insights_send_data()?
Thank you!
from esp-insights.
@antoniuschan99 thanks for diving deeper. That's indeed the case.
Please apply attached change, and see if this satisfies your requirement.
http_tport_status_events.patch [Edited]
from esp-insights.
Related Issues (20)
- Breaking backwards compatible change `log_printfv` HOT 1
- ESP Insights examples (https case)- No logs in Dashboard HOT 6
- ESP Insights - MQTT case - No Error, Warning and Event logs in Dashboard. HOT 5
- Can't get crash stack info. HOT 1
- How to change node id HOT 2
- Reboot Reset Reason HOT 4
- Custom metrics demo HOT 4
- Cannot login from CLI with password HOT 1
- Upload firmware package .zip with API? HOT 1
- Firmware Image Uploaded not Resolving String Information in Error Messages HOT 10
- Getting an Invalid Chip in Esp Insights Dashboard HOT 7
- projbuild_gitconfig.py fails due to the empty _CMAKE_TOOLCHAIN_PREFIX argument HOT 4
- ESP Insights simultaneous HTTP request error HOT 2
- spam "wifi:Haven't to connect to a suitable AP now!" when using 4G or ethernet HOT 3
- eFuse error when running on qemu-system-riscv32 HOT 4
- Missing menu point ESP-INSIGHTS HOT 4
- We could not find the firmware image to cross-reference this log entry. Please upload a firmware image to get cross-referenced information for this log entry. HOT 2
- Problem finding where the reset happened in the code with ESP-Insights HOT 1
- Problem orchestrating ESP-Insights send with second HTTP POST HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esp-insights.