Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Antczak committed May 7, 2019
1 parent 7663cf3 commit d146615
Show file tree
Hide file tree
Showing 41 changed files with 2,467 additions and 88 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
.env.development.local
.env.test.local
.env.production.local
/.venv
/playground
upload-firmware.sh

npm-debug.log*
yarn-debug.log*
Expand Down
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM node:10.15.3-stretch-slim
MAINTAINER Piotr Antczak <antczak.piotr@gmail.com>


ADD public /tasmocompiler/public/
ADD src /tasmocompiler/src/
ADD server /tasmocompiler/server/
ADD package.json yarn.lock /tasmocompiler/
RUN apt-get update && apt-get install -y python python-pip git && \
pip install --no-cache-dir -U platformio && \
cd /tmp && \
git clone https://github.com/arendst/Sonoff-Tasmota.git && \
cd /tasmocompiler && \
yarn install && \
yarn global add nodemon && \
yarn build && \
yarn cache clean && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

WORKDIR /tasmocompiler
ENTRYPOINT ["nodemon", "server/server.js"]
13 changes: 13 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
platformio = "*"
esptool = "*"

[requires]
python_version = "2.7"
119 changes: 119 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

101 changes: 51 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,69 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
#### What it is?
TasmotaCompiler is a simple web GUI which allows you to compile fantastic [Tasmota](https://github.com/arendst/Sonoff-Tasmota) firmware with your own settings:
- You can select which features/sensors of Tasmota firmware you want to use
- Credentials for your IOT WiFi network, so even after unexpected problems with the device (complete lost of configuration), credentials for your network will still be there, but mainly you don't have to connect to AP, served by Tasmota to configure your Home WiFi
- You can select Tasmota version you want to compile. You can select `development` bleading edge version, or ie. previous stable release `6.4.1` or `6.2.1` if this is the one you like
- You can also select with what Core version you want to compile your custom firmware: 2.3.0, 2.4.2 or maybe 2.5.0
- Hardware version (Sonoffs, Wemos, NodeMCU).
- Language version
- You can also provide custom `#defines` if you want to build even more suitable firmaware for your needs

## Available Scripts
#### Why?
Well, there are two reasons. First is that I want to build my first application written in NodeJS/React. The second one is based on the observation that everytime I prepare a new device I have to start atom with platformio installed, configure all `#defines` (well, I have template which I copy) and prepare `platformio.ini`, create a branch from version I like to use, etc..

In the project directory, you can run:
That's why I decided to prepare a solution which is easier to use (just a few clicks) and does not require knowledge how to install dev environment to build custom firmware.

### `npm start`

Runs the app in the development mode.<br>
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
#### How it works?
The easiest way is to look at the screenshots (the whole process is five steps only). After compilation you will be able to download three files:
1. Your new `firmware.bin` file, which can be uploaded to your device via Tasmota WebGUI, espotool, ESPEasy flasher or any other tool you used to use to flash your device
2. `platformio.ini` file, to check what options for platformio were used to compile the custom firmware file
3. `user_config_override.h` file to check what features are included/excluded from resulting firmware

The page will reload if you make edits.<br>
You will also see any lint errors in the console.
You have to upload only the first `firmware.bin` file to your device. How to do that is perfeclty described on [Tasmota wiki](https://github.com/arendst/Sonoff-Tasmota/wiki/Flashing).

### `npm test`
![Step01](./docs/images/step01.png)
![Step02](./docs/images/step02.png)
![Step03](./docs/images/step03.png)
![Step04](./docs/images/step04.png)
![Step05](./docs/images/step05.png)
![Compile01](./docs/images/compile01.png)

Launches the test runner in the interactive watch mode.<br>
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
#### How to start using TasmoCompiler?
##### Easy way
Start TasmoCompiler in docker:

### `npm run build`
`docker pull benzino77/tasmocompiler`
`docker run --rm --name tasmocompiler -p 3000:3000 benzino77/tasmocompiler`

Builds the app for production to the `build` folder.<br>
It correctly bundles React in production mode and optimizes the build for the best performance.
Then point your browser to http://localhost:3000

The build is minified and the filenames include the hashes.<br>
Your app is ready to be deployed!
If you want to see debug messages on docker console you can run a container with env variable:

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
`docker run --rm --name tasmocompiler -p 3000:3000 -e DEBUG=server,git,compile benzino77/tasmocompiler`

### `npm run eject`
- `server` to see http server messages
- `git` to see git operation messages
- `compile` to see messages during compilation

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
You can also specify different port on which TasmoCompiler will be available on the host:

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
`docker run --rm --name tasmocompiler -p 8080:3000 benzino77/tasmocompiler`

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
Then point your browser to http://localhost:8080

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
##### Less easy way
1. Install `NodeJS` and `Python 2.7.x`
2. Install [`yarn`](https://yarnpkg.com/en/docs/install)
3. Install [`platformio`](https://docs.platformio.org/en/latest/installation.html)
4. Clone/download the repository from github and change directory to the cloned repo
5. run `yarn install`
6. run `yarn build`
7. run `node server/server.js`
8. point your browser to http://localhost:3000

## Learn More
#### Disclaimer
Everything you do, you do on your own responsibility. I do not take any responsibility for damages or problems, that may arise as a result of using this solution or its products.

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting

### Analyzing the Bundle Size

This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

### Making a Progressive Web App

This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

### Advanced Configuration

This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration

### Deployment

This section has moved here: https://facebook.github.io/create-react-app/docs/deployment

### `npm run build` fails to minify

This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
##### Credits
Thanks to [The Arends](https://github.com/arendst) and the entire Tasmota Dev Team for fantastic work!
Binary file added docs/images/compile01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/step01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/step02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/step03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/step04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/step05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 25 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,30 @@
"name": "tasmocompiler",
"version": "0.1.0",
"private": true,
"proxy": "http://localhost:3001/",
"dependencies": {
"@material-ui/core": "^3.9.3",
"body-parser": "^1.18.3",
"debug": "^4.1.1",
"express": "^4.16.4",
"fs-extra": "^7.0.1",
"ini": "^1.3.5",
"lodash": "^4.17.11",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-scripts": "2.1.8"
"react-scripts": "2.1.8",
"shelljs": "^0.8.3",
"simple-git": "^1.110.0",
"socket.io": "^2.2.0",
"socket.io-client": "^2.2.0",
"typeface-roboto": "^0.0.54"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"startdev": "concurrently --kill-others \"PORT=3001 DEBUG=\"server,git,compile\" nodemon server/server.js\" \"yarn start\""
},
"eslintConfig": {
"extends": "react-app"
Expand All @@ -21,5 +35,13 @@
"not dead",
"not ie <= 11",
"not op_mini all"
]
],
"devDependencies": {
"concurrently": "^4.1.0",
"eslint": "5.12.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-import": "2.14.0",
"eslint-plugin-jsx-a11y": "6.1.2",
"eslint-plugin-react": "7.12.4"
}
}
4 changes: 3 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />
<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no" />

<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
Expand All @@ -22,7 +24,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>Tasmota Compiler</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
18 changes: 18 additions & 0 deletions server/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
env: {
es6: true,
node: true,
browser: true,
mocha: true,
},
extends: 'airbnb',
root: true,
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
rules: {
'no-console': 'off',
'no-unused-vars': ['error', { 'vars': 'all', 'args': 'none', 'ignoreRestSiblings': false }]
},
};
Loading

0 comments on commit d146615

Please sign in to comment.