Coder Social home page Coder Social logo

mathcoll / t6 Goto Github PK

View Code? Open in Web Editor NEW
34.0 5.0 8.0 93.24 MB

t6 is a "Data-first" IoT platform to connect physical Objects with time-series DB and perform Data Analysis.

Home Page: https://api.internetcollaboratif.info

License: GNU General Public License v3.0

JavaScript 63.31% Shell 0.86% CSS 4.09% HTML 16.00% Pug 15.65% Starlark 0.03% Python 0.06%
home-automation iot iot-platform nodejs things flow internet-of-things mqtt timeseries-db sensors

t6's Introduction

t6 logo

t6 - Connect real world Object & Devices to Digital Api

t6 is a "Data-first" IoT platform to connect physical Objects with time-series DB and perform Data Analysis. Please referes to CONTRIBUTING.md in case you would like to help :-)

Stable version GitHub commit activity GitHub commit activity GitHub commit activity GitHub contributors Netlify Status

Codacy Badge CII Best Practices Mentioned in Awesome phodal awesome-iot Mentioned in Awesome HQarroum awesome-iot

#nodejs #things #api #flow #home-automation #mqtt #iot #esp8266 #middleware #sensor #internet-of-things #iot-platform #sensors #iot-framework #timeseries


IoT and Physical World

Physical World are composed by your sensors and actuators, real physical Objects/Devices. In t6, physical Objects needs* a virtual Object as a reference in t6 and then, they are able to add Data to Flows.

* : remain optional

Sample nodeMCU and Arduino scripts are available in the sensors repository and on t6iot Arduino library.

t6 API first: Live, eat, and breathe the API-first lifestyle of t6

Detailed Api documentation will help you to connect your sensors to t6. Installing t6 on your own server is easy, follow the installation guide on Wiki page. More detailed explanation on wiki is also available.

t6 schematic

sequenceDiagram;
    Object->>t6 Sockets: basic auth
    t6 Sockets-->>Object: welcome message
    t6 Sockets-->>Object: claim request
    Object->>t6 Sockets: claim Object
    t6 Sockets-->>Object: claimed
    loop As many as wished
        Object->>t6 Sockets: channel subscribe
        Object->>t6 Sockets: channel unsubscribe
        t6 Sockets-->>Object: channels
    end

    User->>+Object: Http GET /index
    Object-->>+User: html Ui and assets
    User->>t6 Sockets: Http /unsubscribe
    t6 Sockets-->>User: channels

    loop Custom frequency
        t6 Sockets->>Object: measureRequest
        Object-->>t6 Rest Api: Http POST /api/v2.0.1/data
        Object-->>t6 Sockets: remindMeToMeasure
    end

t6 Android Application

t6 is available on the Android Google Play Store for free. This Application is using exactly the same code and Api from this repository.

Some additional Application screenshots.

Helping and contributing to t6

Please refers to CONTRIBUTING.md in case you would like to help & contribute :-)

t6's People

Contributors

dependabot[bot] avatar mathcoll avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

t6's Issues

TypeError: Cannot read property 'pushSubscription' of null

Describe the bug
Running the test script return an harmless error on the server log saying it can't push notification to user.
The test passe successfully as this push notification is asynchroneous and after the payload is sent to enduser.

To Reproduce
Steps to reproduce the behavior:

  1. run the full ./bin/test.sh
  2. during the process it will first create a user (without any pushSubscription details)
  3. then, later on, probably on "./test/sources.json" the script is testing "POST can build a source for an Object"
  4. the synchroneous response from server is a Status 201 ๐Ÿ†—
  5. on the backend server is trying to send a pushnotification to user and output the following error on server console :
  "TypeError: Cannot read property 'pushSubscription' of null\n" +
    '    at /media/Documents/Projets/2019/internetcollaboratif.info/t6/t6notifications.js:14:25\n' +
    '    at new Promise (<anonymous>)\n' +
    '    at Object.t6notifications.sendPush (/media/Documents/Projets/2019/internetcollaboratif.info/t6/t6notifications.js:9:48)\n' +
    '    at ChildProcess.<anonymous> (/media/Documents/Projets/2019/internetcollaboratif.info/t6/routes/objects.js:430:37)\n' +
    '    at ChildProcess.emit (node:events:388:22)\n' +
    '    at maybeClose (node:internal/child_process:1063:16)\n' +
    '    at Socket.<anonymous> (node:internal/child_process:449:11)\n' +
    '    at Socket.emit (node:events:376:20)\n' +
    '    at Pipe.<anonymous> (node:net:666:12)'
]

Expected behavior
When the pushSubscription is not defined:

  • No push is sent to enduser
  • No error is logged to server console

When the pushSubscription is defined:

  • A push is sent to enduser
  • No error is logged to server console

Screenshots
n/a

Desktop (please complete the following information):
n/a : server side error

Smartphone (please complete the following information):
n/a : server side error

Additional context
Probably a bug elsewhere in the code as the sendPush() is used multiple times

Known issues

Hey,

I tried to install following the wiki steps, but I got some unexpected errors during the process, I'll try to list them here in order to improve the installing instructions

  1. I got an error when running npm install:
Error: Package exports for '/home/jonathas/projects/t6/node_modules/snyk-docker-plugin/node_modules/uuid' do not define a valid '.' target
    at resolveExportsTarget (internal/modules/cjs/loader.js:460:13)
    at resolveExports (internal/modules/cjs/loader.js:393:16)
    at Function.Module._findPath (internal/modules/cjs/loader.js:492:20)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:787:27)
    at Function.Module._load (internal/modules/cjs/loader.js:693:27)
    at Module.require (internal/modules/cjs/loader.js:864:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/jonathas/projects/t6/node_modules/snyk-docker-plugin/lib/experimental.ts:4:1)
    at Module._compile (internal/modules/cjs/loader.js:971:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1011:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] snyk-protect: `snyk protect`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] snyk-protect script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I could solve the issue just updating the node, I was using version v13.0.1 and updated to nvm install v14.0.0. Even after that, I got another error:

Failed to get vulns

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] snyk-protect: `snyk protect`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] snyk-protect script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/jonathas/.npm/_logs/2020-09-25T01_02_33_793Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] prepublish: `npm run snyk-protect`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] prepublish script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

It solved after I ran npm run snyk-protect though.

  1. I should rename all files located in /data with my hostname, not only the listed in the wiki

  2. File t6BuildVersion.json is missing in the project root, I made a generic one with content

{
    "t6BuildVersion": "eb65f80c1d3d76959ae1cd1eca3c33eb",
    "t6BuildDate": "21/09/2020 20:42:06"
}
  1. Firebase certificate missing used in for notifications: require("./data/certificates/t6-app-firebase-adminsdk-rw4am-8cd8dc25f3.json"); I've created an service account in firebase for my project. Done.

  2. Another private key missing in settings: fs.readFileSync("/path/to/data/certificates/dkim/privatekey.txt", "utf8")
    I've just comment that line for a while.

  3. Now I'm stuck here, "Activating influxDb", I've already installed influxdb, but nothing happens after this message.

npm start

> [email protected] start /home/jonathas/projects/t6
> node ./bin/www

24/Sep/2020:23:26:45 -0300 [INFO] [ 'Activating influxdb: http://localhost:8086/t6' ]

Err 503 on adding datapoint to a Flow requiring a signed payload

Describe the bug
Err 503 on adding datapoint to a Flow requiring a signed payload

To Reproduce
Steps to reproduce the behavior:

  1. create a Flow with attribute: "require_signed": true and an object having its own secret_key
  2. POST /data to that Flow without any signed payload
  3. Server is currently responding a 503

at signatureCheck (/media/Documents/Projets/2019/internetcollaboratif.info/t6/routes/data.js:98:7) at nextTask (/media/Documents/Projets/2019/internetcollaboratif.info/t6/node_modules/async/dist/async.js:5756:27) at next (/media/Documents/Projets/2019/internetcollaboratif.info/t6/node_modules/async/dist/async.js:5764:13) ] Trace: Error: Error: Callback was already called. at process.<anonymous> (/media/Documents/Projets/2019/internetcollaboratif.info/t6/node_modules/libnmap/lib/libnmap.js:116:17) at process.emit (node:events:388:22) at process._fatalException (node:internal/process/execution:163:25) at processPromiseRejections (node:internal/process/promises:227:11) at processTicksAndRejections (node:internal/process/task_queues:94:32) at process.<anonymous> (/media/Documents/Projets/2019/internetcollaboratif.info/t6/node_modules/libnmap/lib/libnmap.js:116:11) at process.emit (node:events:388:22) at process._fatalException (node:internal/process/execution:163:25) at processPromiseRejections (node:internal/process/promises:227:11) at processTicksAndRejections (node:internal/process/task_queues:94:32) 02/Oct/2021:21:02:56 +0200 [0m[31m[ERROR] [

Expected behavior
201 status code and success response

Docker / Docker-Compose support

Hey guys,
Pretty nice the installation guide you did there.
I'd like to know if the project has an official Docker Repository.
And if you suggest an Docker-Compose template.

Best regards!

Question - Windows

I'm pretty new to all this, sorry if it's a dumb question :

is there a way to get t6 up and running on Windows 10 ??

Server return errors on authentification, on POST datapoints, and on getting datapoints to display on dahsboard

Describe the bug
Server return errors on authentification, on POST datapoints, and on getting datapoints to display on dahsboard

503 ServiceUnavailableError -> ServerError [ServiceUnavailableError]: Response timeout

To Reproduce
Steps to reproduce the behavior:

  1. Keep the server going for multiple weeks/months
  2. some Api call might fails and return either a 40x or a 429 due to latency on gathering items from influxDb
  3. As a result the server returns error because the header has already been sent

Assumption
retention4w.requestest is full of "anonymous" logs
thos anonymous data are not usefull for the monthly report but can be used on security check for multiple auth attemps

Option
Set a short retention policy on anonymous Api calls so that the other non-anonymous data will be available for monthlyreport
Use that short retention on checkForTooManyFailure() function
/!\ Stop the mess on events + requests

Rules

When will the rules be enclosed in github release

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.