Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
akreienbring committed Jan 12, 2025
0 parents commit 88a5287
Show file tree
Hide file tree
Showing 541 changed files with 30,128 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
server/src/db/broker.db
server/node_modules/
server/.vscode

client/node_modules/
client/.vscode
client/dist/
91 changes: 91 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Shelly Central

![license](https://img.shields.io/badge/License-GNU%20GPL-blue)

Shelly Dashboard / Monitor for 1. / 2. / 3. generation devices

## Overview

Shelly Central is a client (React) / server (nodejs) application to monitor and control your Shelly devices. The server collects all relevant information about your devices by using RPC calls and websocket connections. The client is a webapplication that makes monitoring and controlling your Shellies easy. <br/>
Shelly Central is cloudless. That means it makes you (sort of) independent from the Shelly Cloud Control Center.

The server must run in your local network and acts like a broker between your Shellies and the client application. The communication with the client is strictly websocket based.

## Features
Shelly Central supports English, Spanish and German.

- **Dashboard**<br/>
Informs you about connected Shellies, current and timelined consumption, running scripts, cloud connection.
- **Shellies**<br/>
Get insides about KVS values, script status, Logs and websocket messages. Control your switches. Get notified when a script error occures.
- **User**<br/>
Manage additional users that are able to log in to the appplication.
- **Blog**<br/>
A simple interface to write internal articles or notes to be displayed on the landing page.

## Why use it?

Managing many Shellies in a network is a challenge. The original Shelly Control app is a good choice. But it is cloudbased. Hence you need an internet connection to control your devices. Shelly Central is needs only Wifi and your local network. It is Open Source and transparent. Your welcome to participate and enhance the features.

## How to install

- **Prerequisites**<br/>
Install nodejs. Normally it includes the NPM packet manager. I tested the system with nodejs 20.x.
- **Server (Client included)** <br/>
Download the server release and unzip it in a directory of your choice. E.g. _/sb_ (Shelly Broker). Normally you run the server on a dedicated always-on-system. Like a NAS, a Rasberry or any other OS that can run nodejs. Navigate to that directory and type _npm install_. It might take a while untill all modules are downloaded. In the meantime you could

**Configure your Shellies**<br/>
Add the IP addresses and custom names of your Shellies to the file _/sb/config/devices.json_. An example is included. <br/>
It is also strongly recommended to change the default values of user, password and secret in _/sb/config/default.json_.

**Configure the display of KVS values**
In the file _/sb/config/kvsdisplays.json_ you can map KVS values to display names for convinience. An example is included.

**Start the server**<br/>

- Linux: _npm start_
- Windows: _node shellybroker.js_

Thats it! Navigate your browser to [YOURSERVERIP]://3031 and log in with *[email protected]* and password _undlos_

- **Client**<br/>
The server release includes the current client version. But if the client version gets updated, you might want to install the newer version.<br/>
Download the client release and unpack the content into the _/sb/public_ folder.

## How to particpate and join the project

This project needs your help! There are so many Shelly devices and up to now only one developer :-) There is a simple and a developer stylish way to support.

**The simple way**<br/>
Add images to the project. The project works with 1. / 2. and 3. generation Shelly devices. But it lacks images of all the available devices as I personally don't own all of them. The best way (as far as I know) to get your hands on a high quality image of a device is to log in at [Shelly Control](https://control.shelly.cloud) and download the image of a device that is not yet included in the _sc/public/assets/images/devices_ folder. Mind the name of the file as it must fit the modelname.

**The Developer way**<br/>
Fork the whole Github project and start making pullrequests! Your welcome! As with the images I'm sure other devices (I don't own) have special switches, RPC commands, JSON formats etc... Let's enhance this software to support more devices for the sake of all Shelly users!

## The Log feature ##
As of now the log outputs of a Shelly can not directly be associated with the script that produces them :-(
So to get this working you need to preceed every output with the name of the Script. E.g. "logPrefix: [SCRIPTNAME]" where [SCRIPTNAME] equals the name of an existing script!

## When to restart the server ##
The server must be restartet when
- You add / change a device in _/sb/config/devices.json_
- You add / delete a script on a device
- you add / delete a KVS key<br/>

because for performance reasons this information is only retrieved once.

## Screenshots ##
![Dashboard](screens/Dashboard.png)

![Script_KVS](screens/Shellies_Script_KVS.png)

![Settings](screens/Shellies_Settings.png)

![Logs](screens/Shellies_Logs.png)

![Websocket](screens/Shellies_WS.png)

![Users](screens/Users.png)

## Thanks! ##
to the [Minimal Dashbard](https://minimal-kit-react.vercel.app/) project: Without it things would have been much harder!
22 changes: 22 additions & 0 deletions client/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// .eslintignore
build/*
dist/*
public/*
**/out/*
**/node_modules/*

**/.next/*
next.config.js

vite.config.js
vite.config.ts

src/reportWebVitals.js
src/service-worker.js
src/serviceWorkerRegistration.js
src/setupTests.js

src/reportWebVitals.ts
src/service-worker.ts
src/serviceWorkerRegistration.ts
src/setupTests.ts
152 changes: 152 additions & 0 deletions client/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
{
"root": true,
"env": {
"browser": true,
"es2021": true,
"es6": true
},
"plugins": ["only-warn", "perfectionist", "unused-imports", "prettier"],
"extends": ["airbnb", "airbnb/hooks", "prettier"],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"settings": {
"react": {
"version": "detect"
},
"import/resolver": {
"alias": {
"map": [["src", "./src"]],
"extensions": [".js", ".jsx", ".json"]
}
}
},
"rules": {
"no-alert": 0,
"camelcase": 0,
"no-console": 0,
"no-param-reassign": 0,
"naming-convention": 0,
"default-param-last": 0,
"no-underscore-dangle": 0,
"no-use-before-define": 0,
"no-restricted-exports": 0,
"react/no-children-prop": 0,
"react/forbid-prop-types": 0,
"react/react-in-jsx-scope": 0,
"jsx-a11y/anchor-is-valid": 0,
"react/no-array-index-key": 0,
"no-promise-executor-return": 0,
"react/require-default-props": 0,
"react/jsx-filename-extension": 0,
"react/jsx-props-no-spreading": 0,
"import/prefer-default-export": 0,
"import/no-extraneous-dependencies": 0,
"react/function-component-definition": 0,
"jsx-a11y/control-has-associated-label": 0,
"react/jsx-no-useless-fragment": [
1,
{
"allowExpressions": true
}
],
"prefer-destructuring": [
1,
{
"object": true,
"array": false
}
],
"react/no-unstable-nested-components": [
1,
{
"allowAsProps": true
}
],
"no-unused-vars": [
1,
{
"args": "none"
}
],
"react/jsx-no-duplicate-props": [
1,
{
"ignoreCase": false
}
],
// unused-imports
// https://www.npmjs.com/package/eslint-plugin-unused-imports
"unused-imports/no-unused-imports": 1,
"unused-imports/no-unused-vars": [
0,
{
"vars": "all",
"varsIgnorePattern": "^_",
"args": "after-used",
"argsIgnorePattern": "^_"
}
],
// perfectionist
// https://eslint-plugin-perfectionist.azat.io/
"perfectionist/sort-named-imports": [
1,
{
"order": "asc",
"type": "line-length"
}
],
"perfectionist/sort-named-exports": [
1,
{
"order": "asc",
"type": "line-length"
}
],
"perfectionist/sort-exports": [
1,
{
"order": "asc",
"type": "line-length"
}
],
"perfectionist/sort-imports": [
1,
{
"order": "asc",
"type": "line-length",
"newlines-between": "always",
"groups": [
["builtin", "external"],
"custom-mui",
"custom-routes",
"custom-hooks",
"custom-utils",
"internal",
"custom-components",
"custom-sections",
"custom-types",
["parent", "sibling", "index"],
"object",
"unknown"
],
"custom-groups": {
"value": {
"custom-mui": "@mui/**",
"custom-routes": "src/routes/**",
"custom-hooks": "src/hooks/**",
"custom-utils": "src/utils/**",
"custom-components": "src/components/**",
"custom-sections": "src/sections/**",
"custom-types": "src/types/**"
}
},
"internal-pattern": ["src/**"]
}
]
}
}
36 changes: 36 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules
.pnp
.pnp.js

# testing
coverage

# production
.next
.swc
_static
out
dist
build

# environment variables
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# misc
.DS_Store
.vercel
.netlify
.unimportedrc.json
tsconfig.tsbuildinfo
.vscode

npm-debug.log*
yarn-debug.log*
yarn-error.log*
9 changes: 9 additions & 0 deletions client/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
build/*
dist/*
public/*
**/out/*
**/.next/*
**/node_modules/*

package-lock.json
yarn.lock
6 changes: 6 additions & 0 deletions client/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"printWidth": 100,
"singleQuote": true,
"trailingComma": "es5",
"tabWidth": 2
}
5 changes: 5 additions & 0 deletions client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### v1.0.0

###### 12.01.2025

- Initial Release.
Loading

0 comments on commit 88a5287

Please sign in to comment.