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

asset_tracker_v2 without aws

Hello all,

I try to get the asset tracker v2 to work against a eclipse mqtt broker. For the first steps I use the mqtt.eclipseprojects.io broker before I hosting my own broker.

First step was I use the mqtt simple project and get this running against that broker.

Second step was I try to implement my own cloud libary and use aws_iot.c/aws_iot.h/aws_iot_integration.c as an inspiration and put this library into the asset_tracker_v2 instead of AWS, but this was a little bit overwhelming and I run all the time in build errors.

So I thought  to get a better understanding of what everything does, how the messages look, etc. I use the asset_tracker_v2 sample as it is, disable all the tls an fota stuff manually, wrote some more logs and then use the mqtt.eclipseprojects.io instead of an aws broker. I know this this not will be working correctly, cause asset_tracker check it's settings against cloud, etc. But just to get a little bit more insight here and there.

At the moment I be able to publish the first mqtt message $aws/things/CLIENTID/shadow/get with an empty message payload against the mqtt.eclipseprojects.io broker (request of the shadow document), get the Cloud module to sub_state_cloud connected. After a while the SENSOR_EVT_ENVIRONMENTAL_DATA_READY event happens, but the modem tells me MODEM_EVT_MODEM_STATIC_DATA_NOT_READY / MODEM_EVT_MODEM_DYNAMIC_DATA_NOT_READY / MODEM_EVT_BATTERY_DATA_NOT_READY, (all with the 3 errors:

<err> modem_info_params: Link data not obtained: 20 -5

<err> modem_info_params: Network data not obtained: -5

<err> modem_module: modem_info_params_get, error: -11

but the Event handler goes in mode DATA_EVT_DATA_READY and DATA_EVT_DATA_SEND

then I get a log I implemented of the Json message which should be published and then (when it try's to publish this message via mqtt) the firmware breaks and zephyr booted new.

Is this all because the application doesn't get any configuration from the cloud?

What I not really get is, that the modem is ready to send the empty message (shadow document request) in the first place (I also see it with a client which is subscribed to the mqtt.eclipseprojects.io broker) but after this it seem's to be not ready anymore, but I get no log message or anything about a Event or state change in it.

My goal is to collect the sensor data and gps data of the thingy and then publish it to a own eclipse broker hosted in the Open Telekom Cloud
in a first step I don't want to use communication via tls and also no update of the device, so no subscribes from the device are necesary (just to simplify everything a little bit). 

later on I want to use tls and the other fancy stuff, I also find the passive mode really interesting and I really like the asset_tracker_v2 firmware, everything is nice handled via own threads and events. And this is the reason because I started to change asset_tracker_v2 in the first place. It has so many features I want to use later on as well.

Do you think there is any chance for me to go on, or should I step back to mqtt simple and go from there with implementation of sensor data collection, cJSON, build my own Eventhandler and so on.

thank you very much in Advance for any advice.

Have a nice Day.
Greetings

Rudolph

Parents Reply Children
  • Hey Øyvind,

    sorry for the late reply, I had to move forward with some other projects here at work.
    Short Update:
    I tried out passive mode against my self hosted broker, everything was working out of the box. (Cause I can't update the config in real time at the moment, I changed DEFAULT_DEVICE_MODE to false in data_module.c). After that I switched back to active mode and wrote my own cloud_codec, so I could match the settings of the thingsboard CE MQTT broker and send the data to one of our self hosted instances of this. They accept only Json Arrays in the form:

    [{
        "ts":1619614606355,
        "values":{"rsrp":51}
     }, 
     {
        "ts":1619614606324,
        "values":{"temp":33.630000000000003,"hum":19.074999999999999}
     }, 
     {
        "ts":1619614606401,
        "values":{"bat":4378}
    }, ...
    ]

    So I also had to wrote some json_common functions in the style of the already existing. but this was also no big deal. Now Thingy and Asset tracker is working with Thingsboard.

    Next I will dive deeper into the two accelerometer's, cause I want to send this data as well. Am I right, that the high g one (ADXL372) is not in use in the original asset tracker v2 application? When I am finished with that I will let you know. Have a nice day.

    Kind Regard's
    Rudolph

Related