Giter VIP home page Giter VIP logo

iot-edge-filewatcher's Introduction

iot-edge-filewatcher

Azure IoT Edge module which reads CSV files and puts the rows as messages on the IoT Edge routing

Image URI

This module is open source so you can build your own Docker container.

For convenience, a Linux AMD64 version is availabel at svelde/iot-edge-filewatcher:1.0.0-amd64

Container create options

This module makes use of Docker volumes to detect and access CSV files on disk.

Use these container create options:

{
  "HostConfig": {
    "Binds": [
      "[Host folder]:/app/exchange"
    ]
  }
}

An example is:

{
  "HostConfig": {
    "Binds": [
      "/var/iot-edge-filewatcher/exchange:/app/exchange"
    ]
  }
}

The module will automatically create the 'exchange' folder. Please give the folder elevated rights to allow renaming files after processing.

This can be done with:

sudo chmod 666 exchange

Module twin desired properties

The module check the 'exchange' folder every few seconds to detect new files using a certain search pattern.

if a file is found, it expects the column names on the first row and it tries to map the column to the rows in the file.

It splits each line using a delimeter.

After processing, the file is renamed using a new extension which is appended to the orginal filename.

With desired properties, we can change the behavior:

  • delimiter, a single character - Default ','
  • interval, the interval in milliseconds - Default 10000
  • searchPattern, the pattern mapped on filenames - Default '*.txt'
  • renameExtension, the appended extension to prevent a file being read twice - Default '.old'
  • lineDelay, delays the processing of the file for each line sent - Default 0

Messages

The messages outputted are equal to the columns and lines of the incoming file.

If the file contains 11 rows (1 header row and 10 rows with values), the module will send 10 messages.

Empty lines in the file are ignored.

Each messages gets also these extra values:

  • lineNumber
  • fileName
  • timestamp
  • moduleId
  • deviceId

File access

Keep in mind the module needs access to the folder. Please check the console log output of the module to see if right are elevated correctly.

A simple check for access to the file is built in.

File location

This module is tested with files available on the local file system only.

Contributions

Sourcecode is available at GitHub.

An example container is available on Docker Hub.

Our project accepts GitHub pull requests :-)

iot-edge-filewatcher's People

Contributors

sandervandevelde avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.