Drupal module import from The Things NetWork

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 notes and if you want just a file you can try ttn_to_file link. 

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 want to acces the data with a view 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';