Skip to main content

I have used Drupal for a lot of years for different purpose.

I did create a module for Drupal 7 so all the data from your LoRa nodes can be stored as nodes in drupal and then you can show them as graph or what ever you like - Drupal can do it all.

Download the module from this LINK to zip

Here in the drupal menu you will find some tabels or graphs which show some of my data.

The module is quite simple to get working.

Download module and install.

Go to TheThingsNetwork and make an integration to HTTP in your application

The URL you have to setup is the URL specified in the modules menu hook.

If you do not use clean url's remember ?q=

You shall use :

ttn_post link if you want drupal to create inserts in a special table - my preferred way

ttn_postnode if you want drupal ta make a node with every post - be aware that some servers do not like this way.

ttn_to_file link if you want drupal just to make a file and put data in that.

ttn_to_file is for your own further development ..I just create the basic.

now data will flow into drupal and you can check your content - you will see data content.

if you make a data storage integration, the module will fetch all data 7 days back everytime cron run.

It will insert if the data is not there and update if the data is present in the table.

There are a admin screen where you have to setup the url and the authorization values.

 

if you use the special table there will be a view which already show you data and how to split payload_raw

if you use the node creation model you can see data in content and with a view where you have to make a little "extra" thing when you chose the payload_array field.

you can on the "configure screen" chose which index field you want to show in your tabel or graph.

If you want to try to import a working view. i did create a simpel tabel to show payload_array index 0

copy code below and paste into import view


$view = new view();
$view->name = 'test_data';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'test_data';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'test_data';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '100';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['quantity'] = '9';
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
'field_payload_array' => 'field_payload_array',
);
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
'field_payload_array' => array(
'align' => '',
'separator' => '',
'empty_column' => 0,
),
);
/* Field: Content: datetime */
$handler->display->display_options['fields']['field_datetime']['id'] = 'field_datetime';
$handler->display->display_options['fields']['field_datetime']['table'] = 'field_data_field_datetime';
$handler->display->display_options['fields']['field_datetime']['field'] = 'field_datetime';
$handler->display->display_options['fields']['field_datetime']['settings'] = array(
'format_type' => 'ttn',
'fromto' => 'both',
'multiple_number' => '',
'multiple_from' => '',
'multiple_to' => '',
'show_remaining_days' => 0,
);
/* Field: Content: payload_array */
$handler->display->display_options['fields']['field_payload_array']['id'] = 'field_payload_array';
$handler->display->display_options['fields']['field_payload_array']['table'] = 'field_data_field_payload_array';
$handler->display->display_options['fields']['field_payload_array']['field'] = 'field_payload_array';
$handler->display->display_options['fields']['field_payload_array']['settings'] = array(
'thousand_separator' => '',
'prefix_suffix' => 1,
);
$handler->display->display_options['fields']['field_payload_array']['delta_limit'] = '1';
$handler->display->display_options['fields']['field_payload_array']['delta_offset'] = '0';
/* Sort criterion: Content: datetime (field_datetime) */
$handler->display->display_options['sorts']['field_datetime_value']['id'] = 'field_datetime_value';
$handler->display->display_options['sorts']['field_datetime_value']['table'] = 'field_data_field_datetime';
$handler->display->display_options['sorts']['field_datetime_value']['field'] = 'field_datetime_value';
$handler->display->display_options['sorts']['field_datetime_value']['order'] = 'DESC';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
'data' => 'data',
);
/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'test-data';

 

Tags