Coder Social home page Coder Social logo

honglihu1986 / tradfri2mqtt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hardillb/tradfri2mqtt

0.0 0.0 0.0 46 KB

MQTT Bridge for IKEA TRÅDFRI Light Gateway

Home Page: https://www.hardill.me.uk/wordpress/2017/04/06/fist-pass-tradfri-mqtt-bridge/

License: Apache License 2.0

Java 99.49% Dockerfile 0.51%

tradfri2mqtt's Introduction

Invocation

java -jar TRADFRI2MQTT-X.X.X-SNAPSHOT.jar -ip {gateway IP} -psk {gateway secret} -broker {MQTT broker URL} [-retained]

The optional -retained configures the MQTT topics as retained.

e.g.

java -jar TRADFRI2MQTT-X.X.X-SNAPSHOT.jar -ip 192.168.1.XXX -psk xxxxxxxxxxxxxxxx -broker tcp://localhost

Publishes state messages on topics like this:

  • TRÅDFRI/bulb/Living Room Light/state/on
  • TRÅDFRI/bulb/Living Room Light/state/dim
  • TRÅDFRI/bulb/Living Room Light/state/temperature
  • TRÅDFRI/room/Living Room/state/on
  • TRÅDFRI/room/Living Room/state/dim

Subscribes to control messages on topics like this:

  • TRÅDFRI/bulb/Living Room Light/control/on
  • TRÅDFRI/bulb/Living Room Light/control/dim
  • TRÅDFRI/bulb/Living Room Light/control/temperature
  • TRÅDFRI/room/Living Room/control/on
  • TRÅDFRI/room/Living Room/control/dim
  • TRÅDFRI/room/Living Room/control/mood

publish 0/1 to the on topic to turn the light off/on respectively

publish 0-254 to the dim topic to change the brightness

publish "cold" / "normal" / "warm" to the temperature topic to change temperatures. This only works on individual bulbs.

publish the name of a mood (case-sensitive) to the mood topic of a room to adapt that mood. IKEA predefined moods are internally uppercase-only for some reason: "EVERYDAY" / "FOCUS" / "RELAX". Your self-defined moods have to be spelled like in the Trådfri App. At the moment, only control is implemented and state is not.

MQTT broker example

An easy-to-use MQTT broker is mosquitto.

After installation run it locally with mosquitto.

Then submit commands like this: mosquitto_pub -t "TRÅDFRI/bulb/LivingRoomBulb1/control/temperature" -m warm or subscribe like this: mosquitto_sub -t "TRÅDFRI/room/LivingRoom/state/on"

Installation on Docker

Optionally, TRADFRI2MQTT can be installed and run within a Docker image using the following instructions:

  1. Clone this GIT repository.
  2. Build the tradfri2mqtt docker image like so: docker build -t tradfri2mqtt .
  3. Run tradfri2mqtt within a docker container: docker run -rm tradfri2mqtt -ip [gateway ip] -psk [gateway secret] -broker [mqtt broker url]

tradfri2mqtt's People

Contributors

hardillb avatar r41d avatar bonan avatar adec avatar dependabot[bot] 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.