Giter Site home page Giter Site logo

Comments (6)

Nidhxba avatar Nidhxba commented on August 18, 2024 1

Hello, I was able to connect the indicator_basis example to MQTT of AWS. But a default value is being publised and not the actual sensor readings from the "indicator_sensor.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 -->
sensecap_indicator

These lines handle the data subscribing to the MQTT->

aws_iot.c

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, &paramsQOS0);

        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, &paramsQOS1);
        if (rc == MQTT_REQUEST_TIMEOUT_ERROR) {
            ESP_LOGW(TAG, "QOS1 publish ack not received.");
            rc = SUCCESS;
        }
    }

END


aws_iot.h

#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_ */

END


Tasks_common.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_ */

END


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

from sensecap_indicator_esp32.

Love4yzp avatar Love4yzp commented on August 18, 2024

Could you share the modifications you've made?
If it's inconvenient, just placeholder it.

from sensecap_indicator_esp32.

Love4yzp avatar Love4yzp commented on August 18, 2024

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 #29.

from sensecap_indicator_esp32.

Love4yzp avatar Love4yzp commented on August 18, 2024

if using MQTTS, you'll need to modify the corresponding credentials such as *.pem.
The demo is for MQTT.

from sensecap_indicator_esp32.

Nidhxba avatar Nidhxba commented on August 18, 2024

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..!

from sensecap_indicator_esp32.

Love4yzp avatar Love4yzp commented on August 18, 2024

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.

from sensecap_indicator_esp32.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.