Code Monkey home page Code Monkey logo

tradfri-flux's Introduction

trådfri-flux

Make your IKEA Trådfri bulbs change temperature like f.lux.  

ikea trådfri bulbs, dimmer, gateway, and an iphone running the trådfri app on wooden blocks

Installation

  1. Obtain the security key (on the bottom of the gateway) and IP address of your Trådfri gateway (use your router's control panel).
  2. Obtain your longitude and latitude (used for sunrise/sunset times). NASA has a tool for this.
  3. Clone tradfri-flux git clone https://github.com/overwatchcorp/tradfri-flux.git
  4. Install npm dependencies cd tradfri-flux && npm install
  5. Run node bin/setup.js --host 127.0.0.1 --key a1b2c3d4e5f6g7h8i9j0 --lat 12.345 --long 3.141 to prepare the .env file, where hostname is the IP address of the gateway, and key is the security key found on the bottom of the gateway.
    • If you have a negative longitude or latitude, enclose the value in quotes and add a space before the negative sign so it doesn't interpret it as another argument: --long " -122.670"
  6. Run npm start to start trådfri-flux

Running on a Raspberry Pi

If you have a Raspberry Pi, setting up trådfri-flux is a cinch and can run on startup.

  1. Perform the installation
  2. In tradfri-flux's directory, run sudo cp .env /.env to copy the .env var to your root folder
  3. If tradfri-flux is located in /home/pi/tradfri-flux, run echo 'node /home/pi/tradfri-flux/index.js &' >> /etc/rc.local to add trådfri-flux to startup.
  4. Reboot your pi with sudo reboot

tradfri-flux's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

wizek

tradfri-flux's Issues

Failed at the [email protected]

Hi,

I was just trying to install all required packages on my Raspberry Pi 1 (Model B revision 1.2) but ran into the follow problem:

pi@raspberrypi:~/tradfri-flux $ npm install

> [email protected] install /home/pi/tradfri-flux/node_modules/node-tradfri-client/node_modules/node-dtls-client
> node install/postinstall.js

node-dtls-client: testing NodeJS version
  Version < 10, installing node-aead-crypto...
npm WARN deprecated [email protected]: 'github' has been renamed to '@octokit/rest' (https://git.io/vNB11)

> [email protected] install /home/pi/tradfri-flux/node_modules/node-tradfri-client/node_modules/node-dtls-client/node_modules/node-aead-crypto
> node lib/install.js

running rpi1 installation script

> [email protected] install:rpi1 /home/pi/tradfri-flux/node_modules/node-tradfri-client/node_modules/node-dtls-client/node_modules/node-aead-crypto
> node-pre-gyp install --build-from-source

node-pre-gyp WARN Using request for node-pre-gyp https download 
gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: getaddrinfo EAI_AGAIN nodejs.org:443
gyp ERR! stack     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26)
gyp ERR! System Linux 4.14.71+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--build-from-source" "--module=/home/pi/tradfri-flux/node_modules/node-tradfri-client/node_modules/node-dtls-client/node_modules/node-aead-crypto/build/Release/node-v57-linux-arm/node_aead_crypto.node" "--module_name=node_aead_crypto" "--module_path=/home/pi/tradfri-flux/node_modules/node-tradfri-client/node_modules/node-dtls-client/node_modules/node-aead-crypto/build/Release/node-v57-linux-arm" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v57"
gyp ERR! cwd /home/pi/tradfri-flux/node_modules/node-tradfri-client/node_modules/node-dtls-client/node_modules/node-aead-crypto
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --build-from-source --module=/home/pi/tradfri-flux/node_modules/node-tradfri-client/node_modules/node-dtls-client/node_modules/node-aead-crypto/build/Release/node-v57-linux-arm/node_aead_crypto.node --module_name=node_aead_crypto --module_path=/home/pi/tradfri-flux/node_modules/node-tradfri-client/node_modules/node-dtls-client/node_modules/node-aead-crypto/build/Release/node-v57-linux-arm --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v57' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/pi/tradfri-flux/node_modules/node-tradfri-client/node_modules/node-dtls-client/node_modules/node-aead-crypto/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:915:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Linux 4.14.71+
node-pre-gyp ERR! command "/usr/local/bin/node" "/home/pi/tradfri-flux/node_modules/node-tradfri-client/node_modules/node-dtls-client/node_modules/node-aead-crypto/node_modules/.bin/node-pre-gyp" "install" "--build-from-source"
node-pre-gyp ERR! cwd /home/pi/tradfri-flux/node_modules/node-tradfri-client/node_modules/node-dtls-client/node_modules/node-aead-crypto
node-pre-gyp ERR! node -v v8.12.0
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --build-from-source --module=/home/pi/tradfri-flux/node_modules/node-tradfri-client/node_modules/node-dtls-client/node_modules/node-aead-crypto/build/Release/node-v57-linux-arm/node_aead_crypto.node --module_name=node_aead_crypto --module_path=/home/pi/tradfri-flux/node_modules/node-tradfri-client/node_modules/node-dtls-client/node_modules/node-aead-crypto/build/Release/node-v57-linux-arm --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v57' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install:rpi1: `node-pre-gyp install --build-from-source`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install:rpi1 script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2018-10-28T20_59_33_395Z-debug.log
child_process.js:645
    throw err;
    ^

Error: Command failed: npm run install:rpi1
    at checkExecSyncError (child_process.js:602:13)
    at execSync (child_process.js:642:13)
    at Object.<anonymous> (/home/pi/tradfri-flux/node_modules/node-tradfri-client/node_modules/node-dtls-client/node_modules/node-aead-crypto/lib/install.js:22:1)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node lib/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2018-10-28T20_59_41_215Z-debug.log
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node install/postinstall.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2018-10-28T21_00_12_219Z-debug.log

Any idea how to fix it?

Thanks for all your work!

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.