Giter Club home page Giter Club logo

ikea-smartlight's Introduction

ikea-smartlight

python framework for controlling the Ikea smart lights (tradfri)

requirements

at this moment there is no coap libs with dTLS, the ikea smart lights are using dTLS with coap for security. the only option is to build a new libcoap with dTLS included. libcoap requires cunit, a2x, doxygen and dot you need to install these requirements first.

sudo apt-get install automake libtool
git clone --depth 1 --recursive -b dtls https://github.com/home-assistant/libcoap.git
cd libcoap
./autogen.sh
./configure --disable-documentation --disable-shared --without-debug CFLAGS="-D COAP_DEBUG_FD=stderr"
make
sudo make install

the framework also requires tqdm for showing progressbars, you could strip it from the sourcecode or install the module for python: pip install pip --upgrade && pip install tqdm.

libcoap usage

# getting tradfri information
./coap-client -m get -u "Client_identity" -k "<key>" "coaps://<hup>:5684/15001"
# getting tradfri lightbulb status
./coap-client -m get -u "Client_identity" -k "<key>" "coaps://<hup>:5684/15001/65537"

# turn on tradfri lightbulb
./coap-client -m put -u "Client_identity" -k "<key>" -e '{ "3311" : [{ "5850" : 1 ]} }' "coaps://<hup>:5684/15001/65537"
# turn off tradfri lightbulb
./coap-client -m put -u "Client_identity" -k "<key>" -e '{ "3311" : [{ "5850" : 0 ]} }' "coaps://<hup>:5684/15001/65537"

output

./tradfri-status.py
[ ] tradfri: requireing all tradfri devices, please wait ...
tradfri lightbulbs: 100%|█████████████████████████████████████████████████████████| 8/8 [00:00<00:00, 10.93 lightbulb/s]
tradfri groups: 100%|█████████████████████████████████████████████████████████████████| 4/4 [00:00<00:00, 10.50 group/s]
[+] tradfri: device information gathered
===========================================================

bulbid 65537, name: TRADFRI bulb E27, bightness: 1, state: off
bulbid 65538, name: TRADFRI bulb E27, bightness: 1, state: off
bulbid 65539, name: TRADFRI bulb E27, bightness: 1, state: off
bulbid 65540, name: TRADFRI bulb E27, bightness: 1, state: off
bulbid 65542, name: TRADFRI bulb E27, bightness: 1, state: off
bulbid 65541, name: TRADFRI bulb E27, bightness: 1, state: off
bulbid 65544, name: TRADFRI bulb E27, bightness: 254, state: off


groupid: 137274, name: hal beneden, state: off
groupid: 183216, name: slaapkamer, state: off
groupid: 140387, name: woonkamer, state: off
groupid: 186970, name: hal boven, state: off

todo

  • add support for new color lightbulbs
  • add change state (power on/off lightbulb)
  • add dimmer value (dimm lightbulb)
  • add change state group (power on/off groups)
  • add dimmer value group (dimm group)
  • add color temperature lightbulb (switch to cold, normal or warm)

licensing and credits

ikea-smartlight is licensed under the GPLv3:

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

For the full license, see the LICENSE file.

ikea-smartlight's People

Contributors

hvanderlaan avatar jon-taylor avatar deriksso avatar sandyjmacdonald avatar rempferg avatar

Watchers

James Cloos avatar  avatar

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.