Git Product home page Git Product logo

dirigera-web's Introduction

Dirigera web

Dirigera web is a web-based interface for controlling smart home devices connected to the IKEA Dirigera gateway. The app is designed to be run on a home server (such as a Raspberry Pi) on the same network as the gateway. It provides a user-friendly interface for controlling your smart home devices, and can be accessed from any device with a web browser.

Screenshots ๐Ÿ“ธ
Screenshot of quick controls page
Screenshot of room page

Check out the latest storybook build to see the UI here.

Are you looking for the old Tradfri web ui? Switch to the tradfri branch.

Environment Variables

The app uses environment variables to configure its behavior. You can set these variables in a .env file located in the project directory:

  • GATEWAY_IP (optional) - The IP address of the Dirigera gateway. If not specified, the app will attempt to discover the gateway automatically.
  • ACCESS_TOKEN - Your access token for the Dirigera gateway. You can obtain this token using the dirigera CLI tool by running npx dirigera authenticate and following the instructions.
  • JWT_SECRET - A secret key used to sign JSON web tokens (JWTs) for user authentication.
  • JWT_EXPIRY (optional) - The expiration time for JWTs. Defaults to "1 day".
  • PASSWORD - The password for the web interface.
  • PORT (optional) - The port on which the app will listen for incoming connections. Defaults to 4000.

Your .env file should look something like this:

GATEWAY_IP=192.168.1.2
ACCESS_TOKEN=your-gateway-access-token
JWT_SECRET=your-random-secret-key
JWT_EXPIRY=7 days
PASSWORD=your-password
PORT=4000

Replace the values with your own.

Running with Docker

To run the app with Docker, you can use the following command:

docker run \
  -p 4000:4000 \
  --env-file .env \
  --name dirigera-web \
  --restart unless-stopped \
  --detach \
  ghcr.io/lpgera/dirigera-web

This command tells Docker to run the app in a container, with port 4000 on the container mapped to port 4000 on the host system. It also specifies the .env file containing the required environment variables.

Running with Docker Compose

To run the app with Docker Compose, create a docker-compose.yml file with the following contents:

version: "3"

services:
  dirigera-web:
    image: ghcr.io/lpgera/dirigera-web
    container_name: dirigera-web
    env_file: .env
    ports:
      - "4000:4000"
    restart: unless-stopped

Then run the following command:

docker-compose up -d

This command tells Docker Compose to run the app in a container, with port 4000 on the container mapped to port 4000 on the host system. It also specifies the .env file containing the required environment variables.

Running with Node.js natively

git clone [email protected]:lpgera/dirigera-web.git

Then navigate to the cloned directory and install dependencies:

cd dirigera-web
npm install

Then build the project:

npm run build

Finally, start the server:

npm start

Contributions

The app was created mainly to serve my own needs, but I'm happy to accept contributions. If you have a device which is not supported, feel free to open a pull request. If you have any questions, please open an issue.

License

This project is licensed under the terms of the MIT license. See the LICENSE file for details.

dirigera-web's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar lpgera avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dirigera-web's Issues

Cannot start container

Hi! I'm trying to run the container through Portainer stacks, this is my configuration

version: "3"

services:
  dirigera-web:
    image: ghcr.io/lpgera/dirigera-web
    container_name: DirigeraWeb
    env_file: stack.env
    ports:
      - "4000:4000"
    #restart: unless-stopped

(stack.env is what Portainer calls the .env for a stack)

This is how the .env is populated
image

When I run it, I cannot access it at port 4000 because it's just crashing, this is the log output I get

start
npm run start -w backend
start
node -r dotenv/config dist/index.js dotenv_config_path=../.env
node:internal/modules/cjs/loader:1152
throw err;
^
Error: Cannot find module '/usr/src/app/backend/dist/index.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1149:15)
at Module._load (node:internal/modules/cjs/loader:990:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:142:12)
at node:internal/main/run_main_module:28:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v21.6.0
npm ERR! Lifecycle script start failed with error:
npm ERR! Error: command failed
npm ERR! in workspace: backend
npm ERR! at location: /usr/src/app/backend

Is there anything I'm doing wrong? Thanks!

Does not work when Starkvind Air Purifier is present

Title says it all. I have a Starkvind Air Purifier in my Tradfri Setup and this leads to an error because the enum does not know it (accessorytype is 10 for the air purifier). I already tried updating node-tradfri-client and adding it to the code of tradfri-web-ui, but it seems to be not that easy as I now have another error.

Version number

It would be nice and useful to have the version number somewhere on the homepage.
Thanks
Aldo

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.