Git Product home page Git Product logo

casanet-server's Introduction

Screenshot

Let's create a smart home, without giving anyone access to our house 😊

CASANET

Open-source server to control Smart Home IoT devices in a local network.

CI CD Status Coverage Status

The latest release binaries available to download from casanet-server releases

Philosophy

This project aims to resolve a number of issues plaguing most Smart Home systems

  • Lack of common interfaces: Anyone who uses a number of smart devices (smart IR, smart sockets or anything of that kind) of different brands is familiar with the problem of having to deal with completely different applications, authentication methods, timings, operations etc. for each device.

  • Reliability & Stability: To control home appliances from the internet, the devices communicate with the manufacture's servers, some of which belong to small companies that may "come and go" or have downtime issues. Client side service issues are also notoriously difficult to diagnose and resolve.

  • Accessibility: Although that there is no good reason to disallow control of home appliances directly from the local network, most commercial home appliances allow control only via the manufacturer's servers, therefore rendering the device inoperable, (even from inside the LAN!) in case of connectivity issues.

  • Security: The biggest problem with commercial IOT is security. We definitely do not want to entrust our home to any code produced by an IOT manufacturer as they are known for making some of the most insecure and dubious systems in existence. We want to use vetted, battle-tested and privacy oriented open-source assets in order to ensure the devices do not turn rouge or outright malicious. We want the ability to isolate our devices from the outside world whilst retaining all (or most) capabilities.

As a solution to these problems, this project consolidates all the smart home appliances into one simple, clear and easy to access API.

The Casanet server can run on any computer type (x86, ARM) at home and does not required an internet connection to operate.

The Casanet server design is to manage abstract world devices and a collection of modules ("drives") for each physical device kind, to convert to/from an abstract device state to/from the physical device.

This allows to easily add support in vast devices kinds, and separately, control all of them in one dashboard, same timing/operation abilities and even open an easy to use modern API.

Each module/driver design to work only through a local network, let us disconnect the device for good from the internet.

The Mobile Application

Get it on Google Play

The dashboard Android application assets (APK/AAB) also available here.

The Web Dashboard

✨✨✨ Live Demo Dashboard ✨✨✨

Screenshot

The Mobile Dashboard

app1-dashboard app2-dashboard app3-dashboard

For more details and information about the web & mobile interface see dashboard-app repository.

The Web Lightweight Dashboard

The (very) lightweight dashboard (only about 20kb of total assets) for old phones or very slow networks.

For the lightweight interface navigate to [server-ip/host]/light-app/index.html.

Screenshot

For more details and information about the lightweight interface see lightweight-dashboard repository.

Running Casanet server on a local computer

To make it easy to use there are ready-to-use binaries here just download the binary file (depend on your OS) and the casanet.json configuration file and run the executable file.

It's recommended to read the configuration section here.

In order to set up Linux from scratch see Linux deployment tutorial for a Linux based devices (for raspberry pi etc.)

Project parts + technologies

  • Casanet server:
    • Purpose: Control the IoT devices in a local home network.
    • Technologies: Node.js (using TypeScript + TSOA).
  • Dashboard:
    • Purpose: Hybrid dashboard for web & mobile to control the IoT devices (using Casanet server API).
    • Technologies: react v17 (with mui v5) and cordova.
  • Remote server:
    • Purpose: Forward API requests from the wide internet to the local Casanet servers.
    • Technologies: Node.js (using TypeScript + TSOA + PostgreSQL).
  • Remote dashboard:
    • Purpose: Management dashboard for the remote server admin (using remote server API)
    • Technologies: Vue.js (using vue material).
  • RF commands repository:
    • Purpose: Light-weight server to keep and serve RF commands (such as: IR, 433 MHz etc.) for appliances.
    • Technologies: Python 3.10.5 (using Flask + Mongodb).
  • API (for local and remote server):

Dashboard languages support

The UI is designed to support multi-Language using i18.

Current supported Languages:

  • English
  • Hebrew

Any support for other languages will be welcome.

Accessing casanet server from the internet

The server needs to run on local home network. So, how does one access it via the local home network? How does one get access to the casanet local server from the internet?

Method 1: Port forwarding

Make sure that the IP address of your home is public and redirect ports in-home router to the computer that is running the casanet server.

(DDNS is recommended for easy access to the home IP address).

Method 2: Using casa remote server

The casa remote server is built for this, casanet-remote run on cloud service and used to redirect API requests to the local server.

Supported IoT devices / protocols

  • Orvibo (aka wiwo)

    • S20 (socket). link
  • Broadlink

    • SP2, SP3, SP4 (socket). link
    • RM3 mini 3 / RM4 mini (As AC). link
    • RM Pro / RM4 Pro (As AC / RF toggle / RF curtain). link
  • Yeelight

    • Light with temperature and brightness properties. link and others.
    • Light with RGBW properties. link and others.
  • Tuya (aka smart life)

    • Switch (3 or less gangs). link link and others.
    • Curtain switch. link and others.
  • Mi (aka xiaomi)

    • Philips LED Ceiling Lamp. link
    • Robot Vacuum. link
  • Tasmota (Rest API)

  • Mock (for testing purpose)

    • Toggle demo.
    • Switch demo
    • Air-conditioning demo.
    • Light demo.
    • Temperature light demo.
    • Color light demo.
    • Roller demo.
    • Temperature Sensor.
  • #MQTT module MQTT drivers documentation.

    • Supported types:
      • Toggle.
      • Switch.
      • Air-conditioning.
      • Light
      • Temperature light.
      • Color light.
      • Roller.
    • Supported drivers:
      • Tasmota (MQTT API)

        • Switch (tested with this and this)
        • Color Bulb (tested with this)
      • Shelly (MQTT API)

        • Button1 - (tested with this)
        • Switch 1PM - (tested with this)
        • Duo - RGBW - (tested with this)
        • Temperature Sensor AddOn - (tested with this)

Connecting devices

How to connect a device to the local network and how to add it to be managed by the casa-net server?

see here the brands modules documentation.

Adding other devices support

Yes, it is possible and it's welcomed! see modules documentation.

API

The full specs of API are documented in SwaggerHub.

To try it out against the demo mock server go to casanet-mock-server docs

For a running Casanet server use Swagger UI to make API calls in the [local server IP]/docs URL.

The casanet server tested on

  • Windows - 10/7
  • Linux - Ubuntu
  • Raspberry PI - Raspbian
  • Orange PI - Armbian (Debian-based)

Contributing

Feel free to open an issue with a bug report or feature to develop for the next version.

For any suggestions or help feel free to contact.

Privacy Statement

This project doesn't include any type of data collection and tracking, all data is stored only in the machine where the server runs inside.

Keep the machine safe and secure to keep your data in your hands only.

Using this server is own your own risk, and could contain sensitive data such as your users' email, name, devices key, etc.

Please secure your network, server machine, and your data :)

By using this project you agree to the privacy policy please read it carefully.

License

This application is an open-source code, under the GNU license.

Credits

Shared with ❤️ by kastnet.

casanet-server's People

Contributors

haimkastner avatar israelli 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  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

casanet-server's Issues

Finish light's properties edit.

In the dashboard UI, some of the components not finished yet:

  • 'colorLight' brightness property.
  • 'light' properties.
  • 'temperatureLight' properties'

Create a very light minions dashboard

Used to allow control with week internet connection such as 3G cellular communication or weeks devices.

Implement it without any library or dependency only pure html+css+js.

Version updates mechanism

For the beginning of implementation:
- get current version (last git tag + current local repo HEAD hash).
- update to last version (git pull from origin/master + npm install).

In the build-time generate a versionInfo.json file, based on the git release tag.
To update the system in production, call to update to the latest version by API and the local server will fetch the last version.

See documentation to configuring it.

Allow re-send current status

Allow to send 'setStatus' request with current status.

Used when a physical device didn't respond to the last 'setStatus' request, and although in the server the status has been updated, in the real world nothing was changed.
The solution is to send the 'setStatus' request again.

required frontend implementation only

Integration with `rf-commands-repo` project.

Integration with rf-commands-repo project.
to let the user fetch RF commands by selecting brand+model, instead of recording each command.

In server:

  • Add rf-commands-repo URL to the configuration file.
  • Open API to get models.
  • Open API to select a brand + model.
  • Logic to get supported devices from rf-commands-repo API.
  • Logic to fetch commands from rf-commands-repo API.

In frontend:

  • Add fetch device command option to the air-conditioning minion's menu.
  • Implement dialogs to select the correct commands set to fetch.

General:

  • Update docs.

Separate the scan request

Because the scanning is taking a lot of time, separate the request to a scanning request and a getting scan status requests.
Also, fix a bug, and make sure that only one scan running in the server at a time.

Tasmota module

Currently only simple switch (based on SONOFF basic + SONOFF t1, 1 gange).

Using HTTP API.

Implement IFTTT integration to project.

  • Create API to enable/disable IFTTT integration and hold/edit IFTTT webhooks API key.
  • Trigger IFTTT when minion status changed.
  • Listen to IFTTT trigger and turn on/off minion accord it.

docs grammar.

Fix docs (*.md files) grammar.
And in general, help it to be readble ;)

Add mechanism for adding user to renmote forwarding.

Add to local2remote protocol:

  1. add a user to remote forwarding request.
  2. remote should send MFA to user email.
  3. the remote should send a 'sent message'
  4. the local should send the user code to remote.
  5. the remote should send the results.

remove user:

  1. local server should send 'remove user' message

Use 'bcryptjs' insead of 'bcrypt'

To use the natively only code. without using c++ binaries.
Even that c++ binaries work faster in runtime, its require build process and c++ compiler on the machine.

Send IR commands twice

Because some of air-conditionings models, some times, missing the sent IR commands.
And sending command twice is easier way to solved it.

Security issues.

  • hash by 'bcrypt'.
  • salt the hash.
  • allow deactivating all sessions per user. (896fd3e)
  • hide device key/token from clients. (691ad74)
  • limit login requests to 10 / 15 minutes per IP. (f4259b3)
  • Add security.txt

Fill IFTTT trigger with data/info.

[ ] Fill value1 field with minion display name.
[ ] Fill value2 field with minion type.
[ ] Fill value3 field with current detailed minion status.
[ ] update docs.

Allow RF commands generation.

Instead of buying a remote RF control, and record commands from it to control RF switch, generate random commands and pair them to RF switch options.

SSE behind the PWA Service Worker

From some unknown reason for me, the SSE events stopped working after a few seconds, so the dashboard not updating with the server updates (in the incognito mode, its works properly)

Allow pass physical address via env var.

The physical address (MAC address) used as a unique key (default username etc.) to each server instance.
So allowing pass it by env variable can help with server configuration.

Prepare repository to the new project struct.

Prepare repository to the new project struct.

  • Remove the remote folder, since its migrate to remote-server.
  • Change dashboard project to allow serve it from static files server such as Netlify, for the remote server users. but keep the option to serve it by the local server by default.

Mqtt support

Hello :)

I have a question you plained add mqtt support ?

Add 'roller' minion type to system.

Add roller minion type support in system.

Type properties:
Inherit from switch, and add direction property with up or down as values.
For example:

{
  status: 'on',
  direction: 'up'
}
  • Add it to minions API interfaces.
  • Add roller minion to mock module.
  • Implement spacial roller buttons in dashboard.

Calibrate minion status

Allow defining minion calibrate activation, to make sure that minion status in the casanet is the same as the real physical device status.

How to do it?

Each X minutes send a 'set status' message with the current status, in case of the physical device status changes without updating back the casanet server.

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.