Asset Tracker v2 application. How to subscribe to non-AWS specific topic:

I have built and successfully run this application with the nRF Cloud and then I achieved a partial success with running this application with the AWS IoT.

When I run this app with the AWS IoT, I can see all relevant data sent from my nRF9160DK to the shadow topics of my thing created on AWS IoT, like the battery voltage values and time stamp values. 

However, I would also like to see, in the relevant AWS IoT topics, the data sent from my nRF9160DK device that relates to button presses on the nRF9160DK device.

Apparently, the data that relates to the button presses on the nRF9160DK device should be available in the AWS IoT topic: "<imei>/messages" but there is no data that I could see in this AWS IoT topic, despite receiving without any problems the battery voltage values and time stamp values in the AWS IoT shadow topics of my thing created on the AWS IoT.

According to the info in the nRF9160DK Get Started guide, in order to subscribe to non AWS specific topics, you need to:

1. Specify the number of additional topics that needs to be subscribed to, by setting the option: CONFIG_AWS_IOT_APP_SUBSCRIPTION_LIST_COUNT. (I can see that this option is already set to: 3).

2. Pass a list containing application-specific topics in the function: aws_iot_subscription_topics_add() , after the function call: aws_iot_init() and before the function call: aws_iot_connect().

From my analysis of the file: aws_iot_integration.c  that is located in: asset_tracker_v2\src\cloud\aws_iot_integration.c , it appears that the topic: "<imei>/messages" is already included in the list of topics to which my nRF9160DK device will publish the relevant data.

I found a section of code in the main.c source file for sample: AWS-IoT that I consider to use in the app: Asset Tracker v2, in order to be able to subscribe to non AWS specific topics on AWS IoT,  while running the app: Asset Tracker v2 with AWS IoT. (I attach a copy of the section of code from the source file main.c for the sample:AWS-IoT).

I have two questions:

1. Is the non AWS specific topic the same as the application specific topic?

2. If  I need to insert the section of code from the main.c of the sample: AWS-IoT to the main.c of the app: Asset Tracker v2 (in order to be able to see the data in the AWS IoT topic:  <imei>/messages) , where exactly shall I insert this section of code in the main.c  source file for app: Asset Tracker v2 (or may be in another source .c file for this app)?

Regards,

JM

Section of code from the main.c for sample aws-IoT.docx

Parents
  • Hi,

    Yes, I did.

    However, I did enable it NOT in the prj.conf file but only in the ovelay-aws.conf file, where many lines of code that used to be listed in the prj.conf file as AWS IoT mandatory application specific configurations for AWS IoT (under the nRF Connect SDK 1.7.0) , have now been placed, under nRF Connect SDK 1.8.0.

    I attach copies of the ovelay-aws.conf file and the prj.conf file that I used with the application: asset_tracker_v2 ,using nRF Connect SDK 1.8.0.

    Regards,

    JM

    #
    # Copyright (c) 2021 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    
    CONFIG_AWS_IOT=y
    CONFIG_AWS_IOT_CLIENT_ID_STATIC="your_client_id"
    CONFIG_AWS_IOT_TOPIC_UPDATE_DELTA_SUBSCRIBE=y 
    CONFIG_AWS_IOT_TOPIC_GET_ACCEPTED_SUBSCRIBE=y
    CONFIG_AWS_IOT_TOPIC_GET_REJECTED_SUBSCRIBE=y
    CONFIG_AWS_IOT_AUTO_DEVICE_SHADOW_REQUEST=y
    CONFIG_AWS_IOT_MQTT_RX_TX_BUFFER_LEN=2048 
    CONFIG_AWS_IOT_MQTT_PAYLOAD_BUFFER_LEN=2048
    CONFIG_AWS_IOT_APP_SUBSCRIPTION_LIST_COUNT=3
    CONFIG_AWS_IOT_CLIENT_ID_APP=n
    CONFIG_AWS_FOTA=y
    
    # Options that must be configured in order to establish a connection.
    CONFIG_AWS_IOT_SEC_TAG=201
    CONFIG_AWS_IOT_BROKER_HOST_NAME="a1xrz2twcds6b1-ats.iot.us-east-1.amazonaws.com"
    
    # MQTT Transport library
    # Maximum specified MQTT keepalive timeout for AWS IoT is 1200 seconds.
    CONFIG_MQTT_KEEPALIVE=1200
    

    #
    # Copyright (c) 2021 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    
    # General config
    CONFIG_NEWLIB_LIBC=y
    CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
    CONFIG_ASSERT=y
    CONFIG_REBOOT=y
    CONFIG_RESET_ON_FATAL_ERROR=n
    CONFIG_FPU=y
    
    # Heap and stacks
    CONFIG_HEAP_MEM_POOL_SIZE=32768
    CONFIG_MAIN_STACK_SIZE=1280
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
    CONFIG_HW_STACK_PROTECTION=y
    
    # Logging
    CONFIG_LOG=y
    
    # DK - Used for buttons and LEDs in UI module.
    CONFIG_DK_LIBRARY_INVERT_LEDS=y
    
    # nRF modem library
    CONFIG_NRF_MODEM_LIB=y
    
    # AT Host library - Used to send AT commands directy from an UART terminal and to allow
    #		    integration with nRF Connect for Desktop LTE Link monitor application.
    CONFIG_AT_HOST_LIBRARY=y
    
    # Network
    CONFIG_NETWORKING=y
    CONFIG_NET_NATIVE=n
    CONFIG_NET_SOCKETS=y
    CONFIG_NET_SOCKETS_OFFLOAD=y
    
    # LTE link control
    CONFIG_LTE_AUTO_INIT_AND_CONNECT=n
    CONFIG_LTE_NETWORK_MODE_LTE_M_GPS=n 
    CONFIG_LTE_NETWORK_MODE_NBIOT_GPS=y
    ## Power saving timers.
    ### 320 hours PSM.
    CONFIG_LTE_PSM_REQ_RPTAU="11000001"
    ### 20 seconds active time.
    CONFIG_LTE_PSM_REQ_RAT="00001010"
    
    # Modem info library to obtain information about network and device
    CONFIG_MODEM_INFO=y
    
    # Settings - Used to store real-time device configuration to flash.
    CONFIG_SETTINGS=y
    CONFIG_SETTINGS_FCB=y
    CONFIG_FCB=y
    
    # FOTA
    CONFIG_FOTA_DOWNLOAD=y
    CONFIG_DFU_TARGET=y
    CONFIG_DOWNLOAD_CLIENT=y
    CONFIG_DOWNLOAD_CLIENT_HTTP_FRAG_SIZE_1024=y
    CONFIG_DOWNLOAD_CLIENT_STACK_SIZE=4096
    CONFIG_DOWNLOAD_CLIENT_BUF_SIZE=2300
    CONFIG_DOWNLOAD_CLIENT_MAX_HOSTNAME_SIZE=128
    
    # Flash - Used in FOTA, settings and storage for P-GPS.
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_FLASH_MAP=y
    CONFIG_STREAM_FLASH=y
    CONFIG_MPU_ALLOW_FLASH_WRITE=y
    
    # MCUBOOT
    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_IMG_MANAGER=y
    CONFIG_MCUBOOT_IMG_MANAGER=y
    CONFIG_IMG_ERASE_PROGRESSIVELY=y
    
    # Watchdog
    CONFIG_WATCHDOG_APPLICATION=y
    
    # Event Manager
    CONFIG_EVENT_MANAGER=y
    CONFIG_LINKER_ORPHAN_SECTION_PLACE=y
    CONFIG_EVENT_MANAGER_LOG_EVENT_TYPE=n
    
    # cJSON - Used in cloud data encoding.
    CONFIG_CJSON_LIB=y
    
    # CAF - Common Application Framework
    CONFIG_CAF=y
    CONFIG_LED=y
    CONFIG_CAF_LEDS=y
    CONFIG_CAF_INIT_LOG_LED_READY_EVENTS=n
    CONFIG_CAF_INIT_LOG_LED_EVENTS=n
    CONFIG_CAF_INIT_LOG_MODULE_STATE_EVENTS=n
    
    # Default cloud transport service
    CONFIG_NRF_CLOUD_MQTT=y
    

  • How did you include the overlay config in your build?

Reply Children
No Data
Related