Giter Club home page Giter Club logo

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

adec avatar bonan avatar dependabot[bot] avatar hardillb avatar r41d avatar

Stargazers

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

Watchers

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

tradfri2mqtt's Issues

Mood processing

Thanks for a great piece of software! I have been using the gateway for some months now controlling a pair of GU10 bulbs and a FLOALT panel. I am running Mosquitto and TRADFRI2MQTT on a raspberry pi 3. Nodered dashboard and ESP8266 microcontrollers are used to control the lights.

A few weeks ago the mood control stopped working. I do not get any error messages. The gateway recognizes the mood (e.g. EVERYDAY), but there is no visible change in color temperature or brightness. I have also tried to define my own moods in the TRÅDFRI app with the same result.

docker on rapsberry pi

Hi!

I tried to run the docker part on a raspberry pi. Sadly I did not succeed.
The version (1.5) which comes with Raspbian8 seems to be to old to work (like no mavin).
I then tried some other version 1.11.1-1 installed it but fails:

docker build -t tradfri2mqtt .

Sending build context to Docker daemon 1.787 MB
Step 1 : FROM maven:onbuild-alpine

Executing 2 build triggers...

Step 1 : ADD . /usr/src/app
---> Using cache
Step 1 : RUN mvn install
---> Running in 534aced54827
rpc error: code = 2 desc = "oci runtime error: exec format error"

Null Pointer response in discover()

This line occurs twice in the discover() method:

CoapResponse response = client.get();

The first one (for the devices) always gives me Null Pointers on my Raspberry Pi 2.
It always works on my Laptop, where I have my IDE for debugging...
Communication with the gateway from the Pi also works (tested with coap-client from libcoap).
Documentation says that get() "... blocks until the response is available".
I don't get why this error only occurs only on my Pi 2, will also test on my Pi 3 now...

how to compile/run (java)

Hi!

I noticed the snapshots are a bit older present here, how to compile or run the current code,
what are dependencies which need to be in place upfront?
Just a short info on what is required to get it to run might be handy. Thx!

retained argument?

The readme states the option "-retained", without an argument.

Running the jar with --help shows there should be one:

java -jar /root/src/TRADFRI2MQTT/target/TRADFRI2MQTT-0.0.7-SNAPSHOT.jar

usage: TRADFRI2MQTT
-broker MQTT URL
-ip The IP address of the gateway
-psk The Secret on the base of the gateway
-retained Topics are retained

and just running it with out one throws an exception:

org.apache.commons.cli.MissingArgumentException: Missing argument for option: retained
at org.apache.commons.cli.DefaultParser.checkRequiredArgs(DefaultParser.java:211)
at org.apache.commons.cli.DefaultParser.parse(DefaultParser.java:125)
at org.apache.commons.cli.DefaultParser.parse(DefaultParser.java:76)
at org.apache.commons.cli.DefaultParser.parse(DefaultParser.java:60)
at uk.me.hardill.TRADFRI2MQTT.Main.main(Main.java:512)
Exception in thread "main" java.lang.NullPointerException
at uk.me.hardill.TRADFRI2MQTT.Main.main(Main.java:518)

If there should be an argument

  • what shall it be?
  • more graceful way to die if not present
  • update doc

if it shall not be one:

  • adjust the code

thanks!

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.