This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

tweak mqtt_sample docs to include AWS info

could you tweak the following docs to include info for Amazon web services.

https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/enabling-and-testing-tls-in-mqtt_5f00_simple

I am up and running with the tracker-app against AWS and the shadow, but now the topics structures  are needed.

Maybe also tweak the tracker app to work against AWS and not only use shadow but also MQTT.

ps

Below my brute-force patch to get rid of json-code and get the tracker app working against AWS

/**@brief Get environment data from sensors and send to cloud. */
static void env_data_send(void)
{

char msg_buf[200];
char number_buffer[26];
int length;

if (env_sensors_get_temperature(&env_data) == 0) {
if ( cloud_is_send_allowed(CLOUD_CHANNEL_TEMP, env_data.value) ) {

strcpy( msg_buf, "{ \"state\": { \"reported\" : { \"temperature1\": \"" );
/* Try 15 decimal places of precision to avoid nonsignificant nonzero digits */
length = snprintf((char*)number_buffer, sizeof(number_buffer), "%1.15g", env_data.value);
strcat( msg_buf, number_buffer );
strcat( msg_buf, "\"} } }");
msg.buf = &msg_buf[0];
msg.len = strlen(msg_buf);

err = cloud_send(cloud_backend, &msg);
// cloud_release_data(&msg);
if (err) {
goto error;
}
}
}

ds

Parents
  • Hi.

    I am not quite sure what you mean with "now the topics structures  are needed". Could you elaborate?

    The asset_tracker application is built to be used with nRF Cloud (which is built on AWS), so don't expect any changes there.

    However, you can take a look at the cloud_client sample, which can be used with a generic AWS setup.

    If not, the mqtt_simple sample (with the modifications listed in the blog-post you linked to) is a good starting place to build your own AWS interface.

     

    could you tweak the following docs to include info for Amazon web services.

     Could you explain a bit more what it is you would like to see included in the blog post?

    Best regards,

    Didrik

  • Hi, i already have the cloud sample up and running against AWS, and the tracker also, none of them use MQTT as far as I remember.

    The blog does not mention anything about IP port for AWS, nor anything about config PEER_VERIFY for AWS

    also CONFIG_xx names keep changing name from sample to sample even if same parameter.

    I have compiled this one now for AWS so I will give it a shot.

    Thanks

  • Both the cloud_client sample and the asset_tracker application (which again uses the cloud_client library) uses MQTT, though they have abstracted it a bit away to generic messages.

    As the blog is about how to add TLS to the mqtt_simple sample and is based on the Mosquitto open test broker, I do not think it is necessary to specify how to connect to AWS. It is clearly explained what is needed to change though, and that the parameters used are the ones that are used by test.mosquitto.org, and not necessarily other brokers. The AWS details can be easily found in the AWS documentation.

     

    savenlid said:
    also CONFIG_xx names keep changing name from sample to sample even if same parameter.

    Do you have any examples of this?

    If they are the same configuration option, they must have the same name. Though it is possible that two samples have defined new options for that sample that does the same thing with a different name. I agree that is unfortunate, and I can suggest changes if you point me to any examples.

  • Yes, I understand I also have to do some work and not get spoon-fed.

    I got it working against AWS.

    No problem, my biggest problem is not being able to use SES debugger, so I will focus on that now.

    Thanks again.

    Examples as I see them:

    CONFIG_AWS_IOT_SEC_TAG=16842754 (aws_iot sample)

    CONFIG_SEC_TAG=16842754  (mqtt sample)

    CONFIG_MQTT_BROKER_HOSTNAME="a188lqip0fka86-ats.iot.us-west-2.amazonaws.com"
    CONFIG_AWS_IOT_BROKER_HOST_NAME="a188lqip0fka86-ats.iot.us-west-2.amazonaws.com"

    CONFIG_MQTT_BROKER_PORT=8883
    CONFIG_AWS_IOT_PORT=8883

    everything to do with the cloud could be CLOUD_, if to generic CLOUD_IOT _maybe

  • savenlid said:
    my biggest problem is not being able to use SES debugger, so I will focus on that now.

     Just a heads up. We are seeing a lot of problems related to debugging with SES at the moment. We are working on solving it, and hope to have a new version out soon.

Reply Children
No Data
Related