diff --git a/BUILD.md b/BUILD.md new file mode 100644 index 0000000..d9ea080 --- /dev/null +++ b/BUILD.md @@ -0,0 +1,28 @@ +# 👷 Building EcoDash + +Here's how to build EcoDash in both binaries and as a Docker container. This is not necessary for most cases - we provide both pre-built binaries and containers for Linux ARM and x86_64 - however in devices with unsupported architectures it's necessary. + +You're encouraged to first check the installation instructions to see if a pre-built container or binary is already available. +If you really have to build it yourself, we recommend you Docker over binaries. + +## Binaries + +### Linux + +1. Download the Go Compiler from https://go.dev/dl/ or from your repository's package manager (it's usually called `go` or `golang`) +2. Download the Git SCM from https://git-scm.com/download/linux or from your package manager (it's always called `git`) +3. Clone the repository by running `git clone https://gitea.massivebox.net/ecodash/ecodash.git ` inside a command prompt +4. Switch to the project directory with `cd ecodash` +5. Download the dependencies with `go get ecodash` +6. Build with `go build`. This will generate an executable, `ecodash`, in the same directory. + +### Windows + +1. Install the latest release of the Go Compiler for Windows from https://go.dev/dl/ +2. Install the Git SCM from https://git-scm.com/download/win. The "Standalone installer" is recommended. All the default settings will work fine. +3. Clone the repository by running `git clone https://gitea.massivebox.net/ecodash/ecodash.git ` inside a command prompt +4. Switch to the project directory with `cd ecodash` +5. Download the dependencies with `go get ecodash` +6. Build with `go build`. This will generate an executable, `ecodash.exe`, in the same directory. + +## Docker \ No newline at end of file diff --git a/README.md b/README.md index 4126891..8d758a3 100644 --- a/README.md +++ b/README.md @@ -1,95 +1,21 @@ # 🌿 EcoDash -[![status-badge](https://woodpecker.massivebox.net/api/badges/massivebox/ecodash/status.svg)](https://woodpecker.massivebox.net/massivebox/ecodash) +[![status-badge](https://woodpecker.massivebox.net/api/badges/ecodash/ecodash/status.svg)](https://woodpecker.massivebox.net/ecodash/ecodash) [![Visit our website](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMTA4I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BmaWxsPSIjNTU1Ii8+PHJlY3QgeD0iNTMiIHdpZHRoPSI3MSIgaGVpZ2h0PSIyMCIgZmlsbD0iI2RmYjMxNyIvPjxyZWN0IHdpZHRoPSIxMjQiIGhlaWdodD0iMjAiIGZpbGw9InVybCgjcykiLz48L2c+PGcgZmlsbD0iI2ZmZiIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZm9udC1mYW1pbHk9IlZlcmRhbmEsR2VuZXZhLERlamFWdSBTYW5zLHNhbnMtc2VyaWYiIHRleHQtcmVuZGVyaW5nPSJnZW9tZXRyaWNQcmVjaXNpb24iIGZvbnQtc2l6ZT0iMTEwIj48dGV4dCBhcmlhLWhpZGRlbj0idHJ1ZSIgeD0iMjc1IiB5PSIxNTAiIGZpbGw9IiMwMTAxMDEiIGZpbGwtb3BhY2l0eT0iLjMiIHRyYW5zZm9ybT0ic2NhbGUoLjEpIiB0ZXh0TGVuZ3RoPSI0MzAiPnN1cHBvcnQ8L3RleHQ+PHRleHQgeD0iMjc1IiB5PSIxNDAiIHRyYW5zZm9ybT0ic2NhbGUoLjEpIiBmaWxsPSIjZmZmIiB0ZXh0TGVuZ3RoPSI0MzAiPnN1cHBvcnQ8L3RleHQ+PHRleHQgYXJpYS1oaWRkZW49InRydWUiIHg9Ijg3NSIgeT0iMTUwIiBmaWxsPSIjMDEwMTAxIiBmaWxsLW9wYWNpdHk9Ii4zIiB0cmFuc2Zvcm09InNjYWxlKC4xKSIgdGV4dExlbmd0aD0iNjEwIj50aGUgcHJvamVjdDwvdGV4dD48dGV4dCB4PSI4NzUiIHk9IjE0MCIgdHJhbnNmb3JtPSJzY2FsZSguMSkiIGZpbGw9IiNmZmYiIHRleHRMZW5ndGg9IjYxMCI+dGhlIHByb2plY3Q8L3RleHQ+PC9nPjwvc3ZnPg==)](https://ecodash.xyz/contribute) EcoDash is a simple way to show your users how much your server consumes. It's intended as a medium of transparency, that gives your users an idea about the consumption of your machine. It's not meant to be 100% accurate. -You can see it in action here: https://ecodash.massivebox.net +You can see it in action here: https://demo.ecodash.xyz -## Requirements +## Get started -- A working HomeAssistant installation -- An energy consumption sensor, such as a [smart plug](https://www.aliexpress.com/item/1005003188500978.html), to which your server is plugged in and connected. -- CO2 Signal added as integration into HomeAssistant +Check out the documentation in our [website](https://ecodash.xyz) to get started with EcoDash. -## Installation - -#### Using Docker run: - -``` -docker run -v /absolute_path_to/config.json:/app/config.json -v /absolute_path_to/database.db:/app/database.db --name ecodash -p 8080:80 gitea.massivebox.net/massivebox/ecodash -``` - -This will open the container on port 8080. Replace "8080" in the command with whatever number you want to open that specific port. - -#### Using Docker Compose: - -Create a file `docker-compose.yml` with the following content: - -``` -version: '3' -services: - ecodash: - container_name: ecodash - image: gitea.massivebox.net/massivebox/ecodash - ports: - - '8080:80' - volumes: - - ./config.json:/app/config.json - - ./database.db:/app/database.db - restart: always -``` - -Run the container with - -``` -docker compose up -d -``` - -This will open the container on port 8080. Replace "8080" in the file with whatever number you want to open that specific port. - -#### Using the binary - -Grab a binary from the Releases page and run it. You can use the `PORT` environment variable to override the default port (80). - -## Set up - -As soon as you navigate to the container's exposed port, you will see the admin dashboard, there you will have to fill all fields to get EcoDash running. - -- **HomeAssistant's base URL**: the base URL which you use to access HomeAssistant on your server. It should be something like `http://INTERNAL_IP_ADDRESS:8123/` or `https://homeassistant.youdomain.com/`. -- **HomeAssistant's API Key:** Get it by going into your HomeAssistant profile settings (at `http://HOMEASSISTANT-BASE-URL/profile`) -> Create Long Lived Access Token (at the very bottom of the page) -> Insert a name -> Copy the string it gives you -- **Installation Date**: Select the date of the first day in which your server's consumption was logged in its entirety. Users won't be able to see consumption data before this date. -- **Polled Smart Energy Summation entity ID:** After your plug is added in HomeAssistant, get it in Overview -> look for an entity called like "[Name of your plug] Polledsmartenergysummation" -> Settings -> Copy the Entity ID. Check that the unit of measurement in the "Info" tab is kWh. -- **CO2 signal Grid fossil fuel percentage entity ID**: Get it in Settings -> Devices and Integrations -> Add Integration -> CO2 Signal -> Get your token from the website -> CO2 signal Grid fossil fuel percentage -> Settings -> Copy the Entity ID. Check that the unit of measurement in the "Info" tab is %. -- **Admin username and password** don't need to be the credentials to HomeAssistant! They are the credentials to log into the admin panel. - -If you've just added your energy meter into HomeAssistant, note that it will take eight days for EcoDash to show meaningful data. - -## Support - -If something isn't working, you can find some help here: - -- [Matrix support room](https://matrix.to/#/#support:massivebox.net) -- [Issues page](./issues) -- [Contact me](https://massivebox.net/contact.html) - -## The road ahead - -EcoDash is currently released as a minimum viable product, still far from completion. Here's a non-extensive, unordered list of the changes I want to make. - -- Adding support for energy returns (like solar panels) -- Supporting hot reload, removing the need to restart EcoDash each time the settings are changed -- Improving clarity for when data is missing -- Making FossilFuel Percentage optional and adding other sources -- Supporting energy consumption readings from internal sensors -- Adding some way to change header/footer links directly from the admin panel -- Eventually being completely HomeAssistant-independent -- Adding Woodpecker CI -- Organizing branches and releases better -- Moving documentation to a wiki and expanding it -- Extensively documenting the theming capabilities of EcoDash -- Publishing some alternative themes +- [📖 Introduction](https://ecodash.xyz/docs) +- [🛣 Roadmap](https://ecodash.xyz/docs/roadmap) +- [⬇️ Install](https://ecodash.xyz/docs/install) +- [⚙️ Setup](https://ecodash.xyz/docs/setup) +- [🆘 Support](https://ecodash.xyz/docs/support) ## License diff --git a/config.go b/config.go index 2d01781..d63fcd4 100644 --- a/config.go +++ b/config.go @@ -86,8 +86,8 @@ func loadConfig() (config Config, err error, isFirstRun bool) { Label: "Admin", Destination: "/admin", }, Link{ - Label: "Docs", - Destination: "https://gitea.massivebox.net/massivebox/ecodash", + Label: "EcoDash", + Destination: "https://ecodash.xyz", NewTab: true, Primary: true, }) diff --git a/templates/default/admin.html b/templates/default/admin.html index e1bfa1e..9d6034a 100644 --- a/templates/default/admin.html +++ b/templates/default/admin.html @@ -1,5 +1,8 @@

Admin Panel

-

Here you can edit all the configurations for EcoDash.

+

+ Here you can edit all the configurations for EcoDash.
+ Documentation +

{{if .Warning}}
diff --git a/templates/default/base.html b/templates/default/base.html index 3f65937..b14cb7e 100644 --- a/templates/default/base.html +++ b/templates/default/base.html @@ -29,7 +29,7 @@ {{range .Defaults.FooterLinks}} {{.Label}} | {{end}} - Disclaimer | EcoDash + Disclaimer | EcoDash