Open Nidhxba opened 7 months ago
Could you share the modifications you've made? If it's inconvenient, just placeholder it.
Otherwise you could try the code https://github.com/Seeed-Solution/SenseCAP_Indicator_ESP32/tree/bf7ff29d95cf5591a3f277ff3a930094286a5a4e as you are following the wiki instruction. If you're using the lastes demo of HA, you could follow here https://github.com/Seeed-Solution/SenseCAP_Indicator_ESP32/discussions/29.
if using MQTTS, you'll need to modify the corresponding credentials such as *.pem
.
The demo is for MQTT.
Could you share the modifications you've made? If it's inconvenient, just placeholder it.
I am configuring the "indicator_basis" example and trying to connect that to the AWS MQTT, How can I share the whole file..? I am following a different configuration file, not the HA one..!
Could you share the modifications you've made? If it's inconvenient, just placeholder it.
I am configuring the "indicator_basis" example and trying to connect that to the AWS MQTT, How can I share the whole file..? I am following a different configuration file, not the HA one..!
Just share the core function of you application that you think is working.
Hello, I was able to connect the _indicatorbasis example to MQTT of AWS. But a default value is being publised and not the actual sensor readings from the "_indicatorsensor.c" file, even after successfull connection in the logs it is showing an error -->
I (46805) aws_iot: Subscribe callback Test: test_topic/esp32 co2 : 179.0, tVOC : 180.0
I (46908) aws_iot: Subscribe callback Test: test_topic/esp32 co2 : 179.0, tVOC : 180.0
I (47008) aws_iot: Stack remaining for task 'aws_iot_task' is 3260 bytes
I (47603) city: Get time zone...
E (47613) esp-tls-mbedtls: mbedtls_ssl_setup returned -0x7F00
E (47613) esp-tls: create_ssl_handle failed
E (47613) esp-tls: Failed to open new connection
E (47618) city: Connection failed...
As you can see the default values being publised are 179 and 180. Whereas the actual values are -->
These lines handle the data subscribing to the MQTT->
void iot_subscribe_callback_handler(AWS_IoT_Client *pClient, char *topicName, uint16_t topicNameLen,
IoT_Publish_Message_Params *params, void *pData) {
ESP_LOGI(TAG, "Subscribe callback Test: %.*s\t%.*s", topicNameLen, topicName, (int) params->payloadLen, (char *)params->payload);
}
...............................
.............................
...............................
while((NETWORK_ATTEMPTING_RECONNECT == rc || NETWORK_RECONNECTED == rc || SUCCESS == rc)) {
//Max time the yield function will wait for read messages
rc = aws_iot_mqtt_yield(&client, 100);
if(NETWORK_ATTEMPTING_RECONNECT == rc) {
// If the client is attempting to reconnect we will skip the rest of the loop.
continue;
}
ESP_LOGI(TAG, "Stack remaining for task '%s' is %d bytes", pcTaskGetName(NULL), uxTaskGetStackHighWaterMark(NULL));
vTaskDelay(3000 / portTICK_PERIOD_MS);
// sprintf(cPayload, "%s : %d ", "WiFi RSSI", wifi_app_get_rssi());
paramsQOS0.payloadLen = strlen(cPayload);
rc = aws_iot_mqtt_publish(&client, TOPIC, TOPIC_LEN, ¶msQOS0);
sprintf(cPayload, "%s : %.1f, %s : %.1f", "co2", getco2(), "tVOC", gettvoc());
// sprintf(cPayload, "%s : %.1f, %s : %.1f", "Temp", getTemp(), "Hum", getHum());
paramsQOS1.payloadLen = strlen(cPayload);
rc = aws_iot_mqtt_publish(&client, TOPIC, TOPIC_LEN, ¶msQOS1);
if (rc == MQTT_REQUEST_TIMEOUT_ERROR) {
ESP_LOGW(TAG, "QOS1 publish ack not received.");
rc = SUCCESS;
}
}
#ifndef MAIN_AWS_IOT_H_
#define MAIN_AWS_IOT_H_
#define CONFIG_AWS_EXAMPLE_CLIENT_ID "CaaX"
/**
* Starts AWS IoT task.
*/
void aws_iot_start(void);
#endif /* MAIN_AWS_IOT_H_ */
#ifndef MAIN_TASKS_COMMON_H_
#define MAIN_TASKS_COMMON_H_
// AWS IoT Task
#define AWS_IOT_TASK_STACK_SIZE 9216
#define AWS_IOT_TASK_PRIORITY 6
#define AWS_IOT_TASK_CORE_ID 0
#endif /* MAIN_TASKS_COMMON_H_ */
Please look into the code and check if any errors are there and any corrections to be made in this file or any other file. Thank you
I am trying to connect my SenseCap Indicator to the MQTT broker of AWS. As mentioned in the documentation, I have tried configuring the "ha_config.h" file and it shows an error.
Error message :- _E (11483) esp-tls-mbedtls: mbedtls_sslhandshake returned -0x6C00 I (11484) esp-tls-mbedtls: Certificate verified. E (11484) esp-tls: Failed to open new connection E (11495) city: Connection failed...