Giter Site home page Giter Site logo

scorelab / senz Goto Github PK

View Code? Open in Web Editor NEW
51.0 12.0 87.0 2.27 MB

SenZ is a new kind of query language that can be used to communicate with IoT devices. It is easily integrable, incredibly fast, and is in the highest end of security integration.

License: Apache License 2.0

Scala 4.91% Dockerfile 0.28% JavaScript 79.01% HTML 6.34% Python 0.92% Shell 0.15% Ruby 1.31% Rust 0.97% CSS 2.17% Java 2.63% Starlark 0.39% Objective-C 0.91%
senz switch iot

senz's Introduction

Senz

License Codacy Badge Build Status Gitter chat

SenZ is a new kind of query language that can be used to communicate with IoT devices. It is easily integrable, incredibly fast, and is in the highest end of security integration. Also, it is developed live. As said earlier SenZ uses a #twitter like messaging syntax which makes this language more usable, powerful, and understandable. The communication between each of these devices are done via the MySensors switch which was developed using Python; a high-end application switch which works as a message broker. Once client devices are registered in the switch they should share their data to specific people (other client devices). Then, they are capable of sharing messages accordingly.

SenZ

Currently, the MySensors switch is implemented on two languages: one is Python and the other one is Scala. In either case it doesn't matter in which language your clients are built on. You can use either of the implementations to suit your product. As of now there are two implementations which work on the UDP packet connection and TCP packet connections.

Internal Working

SenZ uses five types of messages for the communication:

Type Description
SHARE Share some attributes to some client/device
UNSHARE Stop sharing some attributes
GET Request a SHARES attribute from a client/device
PUT To do some alternation to the device. When you need to control some device/application/client.
DATA Reply to a GET, PUT or a SHARE. To send the reply with the requested data.

SenZ messages follow a Twitter-like message structure.

<type> #<attribute name> <attribute value> #time <current timestamp> @<receiver> ^<sender> <digital signature>
Tag Description
<type> Type of the message. One of the types from SHARE, UNSHARE, GET, PUT, DATA
#<attribute name> Name of the attribute you need to use in the message. It depends on your purpose.
$<attribute name> Name of the attribute which is encrypted
<attribute value> Value of the attribute you are sharing
#time The attribute to represent the current timestamp. This has to be sent in every message
<current timestamp> This is the value of the time attribute
@<receiver> This is the user name of the receiver of the message
^<sender> This is the user name of the sender of the message
<digital signature> The digital signature which is used by SenZ-switch to verify the sender

Setting up the project

Senz server

Sample programs

How to Contribute

Issues

Feel free to submit issues and enhancement requests.

Contribute

  1. Fork the repo on GitHub
  2. Clone the project to your own machine
  3. Commit changes to your own branch
  4. Push your work back up to your fork
  5. Submit a Pull request so that we can review your changes

senz's People

Contributors

adityasrivast avatar akarshani avatar alishamohanty avatar bicycleman15 avatar carpecodeum avatar chaliya96 avatar charithccmc avatar codacy-badger avatar dependabot[bot] avatar josephsemrai avatar kush-daga avatar m1-key avatar pragyesh007 avatar prakashujjwal1010 avatar sarnava1 avatar shivam-sahu avatar simcard0000 avatar subasharavindan avatar sumedhe avatar yashmeh 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

senz's Issues

Setting the project dashboard.

Description
No setup for the core UI layout of the project.

Solution
Setting basic frontend layout with material-ui and redux

Login Page view password feature

Login Page also don't have show password feature. There should be option of show password which enables user to see cross verify that whether they are entering the correct password if they want to see the password.

Porting the python client code from python2 to python3

Description


The support for Python 2 is going to stop by end of 2020, Python 2 cannot be used for Software development. So to avoid that problems in the future we need to port python2 client to python3.
Right now the python client works fine with python2 but shows the following error on using python3
err2
(This is just one of the error)

Mocks


Transferring image from sender to receiver using python3

python3 receiver.py
python3 sender.py

Acceptance Criteria


Update [Required]

  • Changing the syntax of python2 commands to python3 (ex: raw_input() to input())
  • Solving the encoding decoding problem( python3 unlike python2 doesn't perform implicit conversion of byte to string and vice versa)
  • Updating the encryption, decryption and image utility functions to match python3 standards.

Definition of Done

  • Successfully sending image from sender to receiver using python3 .
  • Completion of above acceptance criterias.
  • Approval by mentor.

Estimation


2 hours

Senz Server readme doesn't exist

Describe the bug
Senz Server readme doesn't exist

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Senz readme.md'
  2. Under Setting up project click on Senz Server
  3. See 404 error

Additional context
A detailed working of the senz server will help alot .. :)

Add UNSHARE command support for the senz-server

Description

As of now the senz server doesn't has support for the UNSHARE command.

Update[Required]

  • UNSHARE command support for the senz server

Mocks

  • Sending data again and again from the same device without restarting the server

Definition of Done

  • Able to unregister the device on passing the "UNSHARE.." command.
  • Able to again and again send data from the same device.

No need of password validation in Login Page

Current version of the app supports password validation for login page , which is I guess is not at all required. Once the password has already been set and been verified during registration, then it need not be checked for verification at the time of login because it will be awkward to say to the user that your password is too short at the time of login.
Here validation means checking the password whether it satisfies the standard rules ( like containing an uppercase , lowercase , have a digit, and a special character) or not. Which is not necessary at the time of login to check.
At the time of login, only email must be checked whether it is in right format or not , there is no need for checking password whether it is in right format or not.

Forgot Password Feature

Is your feature request related to a problem? Please describe.
There should exist a forgot password feature so that if any user forgets their password they can change set a new password.

Describe the solution you'd like
There should be a forgot password feature.

Additional context
If this feature gets approved then i would love to work on it!

Setting up tests for the backend

Description
No tests present for the backend part of senz.

Solution
Adding tests using Mocha and Chai in the test/ directory.

Discuss the frontend architecture and technology stack.

Problem
Haven't decided on frontend architecture, dataflow and technology stack.

Solution

  • Research
  • Evaluating the pros and cons of different technologies.
  • Discuss with my mentor.

Alternatives
None

Additional context
Writing code without thinking of its architecture will lead nowhere.

Add -m flag for queries that need monitoring by the senz-web

Issue
Only monitor those queries that the user wants to monitor in the senz-web.

Solution
Add a -m(Monitor) flag at the end of every query if you want to -

  • Create logs of the query
  • Get customised error handling feature.

Mock
While sending queries only those queries should be logged and checked those have a -m flag in the end and the rest of the queries should function as previously.

Adding UNSHARE command support for python client

Description

The python client doesn't has implementation for UNSHARE command

Problems

  • Restarting the server again and again for continuous data sending.
  • Renaming the devices to enable continuous data sending.

Update[Required]

  • Adding an 'UNSHARE' command at last for exchanging data again and again.

Show Password Feature

It would be great to have Show Password Feature.
It help user to see what password he has written. Something like an eye button which when clicked shows the password to the user. It is a standard feature which most of the websites hold.

Strong Password Feature

Currently User can input password which can have only integers , chars , etc.

It would be a better feature if User's Password passes some set criteria. Like password must contain an uppercase, lowercase, integer , special character which will make password strong.

Refactoring the senz web

Problem
No clear directories for frontend and backend given.

Solution
Refactor the code to put the react app in senz-web/frontend and the nodeJS api in senz-web/backend

Documenting the API

Problem
No proper documentation of the API available.

Solution
Using apiDoc to document the API.

Go to projects list after adding new project

Describe the bug
When adding a new project in the dashboard, after clicking on the add button the route remains to be /addProject . Instead of this after adding a new project it should either clear the fields or it should navigate to allProjects page.
To Reproduce
Steps to reproduce the behavior:

  1. Login to the dashboard
  2. Click on 'Projects -> New Project'
  3. Add a new Project by entering information
  4. See error

Expected behavior
The expectation is that either the fields in the addProject form should get cleared, or it should navigate to allProjects route to see a list of added routes

Screenshots
image
The screen that shows after adding the project.
Desktop (please complete the following information):

  • OS: Windows 10
  • Browser chrome

Additional context
Please review this issue and guide about what next steps should be taken, whether to reroute to a new page or clear out the fields.

Analytics Routes and Components for the senz-web

Description
Till now the data shown in the dashboard of senz web was hard coded as there was no scope of logging query in the senz-switch, but after #104 the data can be fetched from the database and can be analyzed in the admin panel.

Error handling for monitored queries

Issue
There is no proper mechanism for error handling of the queries which can be monitored through the admin panel.

Solution

  • Create an endpoint in the senz-web/backend which returns different status codes for different queries.
  • These status codes can then be mapper from a errorMapper Map in the scala project .
  • Customised error messages can then be sent to the user.

Expected Mapper

ErrorMapper = {
  500: "OK",
  501: "#ERR->USER_NOT_AUTHORISED",
  502: "#ERR->PROJECT_NOT_VALID",
  503: "#ERR->USER_PROJECT_NOT_COMPATIBLE",
  504: "#ERR->SENDER_RECEIVER_NOT_COMPATIBLE",
  505: "#ERR->DEVICE_OFFLINE",
  506: "#ERR->PROJECT_OFFLINE",
  507: "#ERR->SENDER_RECEIVER_SAME"
};

Mock
While sending a monitored query user should get error messages according to the signature ,sender and receiver given in the query.

Sample Code for NodeJS

Description


As a nodeJS developer I feel that the repo should have a nodeJS sample code to interact with the senz server using the senz query.

Mocks


Transfer image from the sender's side to the receiver's side through the senz server using the senz query.

Acceptance Criteria


Update [Required]

  • Refactoring the sample folder to provide sample code for other languages.
  • Testing the code thrice to make sure it is free from errors.
  • Updating the README.md to make it easy to run the sample code.

Definition of Done

  • Successfully sending the image from the sender to the receiver in the most secured way using nodeJS.
  • Completion of all the above acceptance criterias .
  • Approval by mentor.

Estimation


3 hours

Port Doesn't have a exact location.

  1. In the resources file, at line 17 the mongo service provides a Port to get connected but the Port 27017 doesn't have an exact location which means that the application may crash at the time of transferring queries.
  2. To fix this take a simple Port for a test case and specify its location in the root directory.

Discuss the frontend architecture and technology stack.

Problem
Haven't decided on frontend architecture, dataflow and technology stack.

Solution

  • Research
  • Evaluating the pros and cons of different technologies.
  • Discuss with my mentor.

Alternatives
None

Additional context
Writing code without thinking of its architecture will lead nowhere.

Adding UNSHARE command support for javascript client

Description

  • The js client doesn't has implementation for UNSHARE command

Problems

  • Restarting the server again and again for continuous data sending.
  • Renaming the devices to enable continuous data sending.

Update[Required]

Adding an 'UNSHARE' command at last for exchanging data again and again.

Improve the current tests and consolidate the repetitive variables and the functions into a file.

Is your feature request related to a problem? Please describe.
The current tests can improve a little bit also the repetitive variables and the data and the functions can be called from a single file. Also adding code coverage could help and using mockgoose for mock db simulation.

Describe the solution you'd like
Using standard testing methods and practices and improving the overall code quality and addition of code coverage using istanbul and mock db simulation using mockgoose.

Additional context
Would love to get the thoughts of the maintainers on this on and then proceed to work on it.

var declarations in JS client

Expected Behavior

JavaScipt client must follow modern guidelines and avoid ugly practices like var. The pitchfalls of var are now widely known . It's better to completely avoid var declaraions in any JS project, especially the ones like this

Current Behavior

The JS client currently used var declarations in many places. This might set a bad example for people writing JS clients.

Containerize the senz-web

Description
The senz-web is not containerized
Solution
Make different containers for frontend and backend and use docker-compose to interact with one another.

Dockerize the API

Problem
The backend API is not containerized

Solution
Containerizing the API using Docker.

Setting up the API endpoints.

Problem.
No setup of the nodeJS API to interact with the react app.

Solution
Setting up the nodeJS endpoints for the users,projects and devices.

Alter schema and setup additional routes

Description
Some additional routes are required for the frontend project .Some changes are also required for better data encapsulation in the schema.

Solution
Alter schema and setup more routes.

Creating the npm module.

Description
There are no proper procedures to connect to the senz switch.

Solution
Develop a npm-module to connect to the server , this will make the procedure to connect to the server uniform and can then be used by the senz-switch and senz-web.

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.