Git Product home page Git Product logo

node-red-telldus-to-mqtt-bridge's Introduction

Node-RED-Telldus-to-MQTT-bridge

Summary

The code in this report will retrieve sensor and device data from Telldus Live, and then output that same data in a structured way to MQTT topics of your choice. Devices are typically various kinds of actuators, for example radio controlled mains switches.

Other applications can then subscribe to the MQTT topics, and provide for example visualizations of the sensor data, send alerts when certain conditions occur, or store the data in some kind of database.

Please note that the code in this repo is intended to go inside a Node-RED function - it is not a Node-RED module in itself.

More related information, ideas and code can be found at www.ptarmiganlabs.com.

alt text

Requirements

  1. Node-RED. As of this writing, I am myself using Node-RED 0.11.1 and Node.js 0.12.7
  2. MQTT node.js module (https://www.npmjs.com/package/mqtt)
  3. Telldus-Live module (https://github.com/TheThingSystem/node-telldus-live)
  4. An MQTT broker to which messages can be posted. Mosquitto works well, for example.
  5. Credentials to log into Telldus Live

Conceptual overview

The code first sets up a connection to the Telldus Live APIs, and to the MQTT broker.

Once that is in place, all information about all devices is downloaded and sent to the MQTT topics defined in the code. These topics can be modified at will (at least as long as a valid MQTT topic structure is used).

When processing of devices is done, the same process is started again for sensors - downloading all sensor data and attributed, for all sensors tracked by Telldus Live.

Why get the data from Telldus Live, rather than directly from your Tellstick?

Good question. For some years I have done exactly that: Using a Tellstick Duo to listen on all device and sensor radio traffic, then having a small python script extract and store the data I was interested in.

It worked, but not very well. When new devices (radio controlled mains switches, typically) were introduced, the python script had to be updated. Also, that script and the Tellstick had to be installed/running on an always-on computer that was in a physical location with good radio reception from all devices and sensors. Not easy.

The current setup is much better:

  • A centrally located Tellstick Net in the house. Out of the box it is connected to Telldus backend services, and from there takes instructions for both sending commands to devices, as well as reading incoming (over radio) sensor data, which is then forwarded back to Telldus Live. The Tellstick Net only requires power and a network connection, which means it can easily be hidden away in a closet in the center of the house.
  • Telldus Live then becomes the master storage for all Tellstick related information. Telldus does offer storage of historical sensor data, but that can quite easily be handled on your own given the suggested setup. Just subscribe to the MQTT topic of interest, store any new data into a database and you are (more or less) done.
  • Using Telldus' service for on/off scheduling of lamps etc.
  • The Node.js code in the tellduslive-to-mqtt-bridge.js file only reads data from Telldus Live, but it can be extended/modified to also turn devices on/off, thus providing a second way of controlling devces (if you don't trust Telldus' scheduler...). Also quite possible to use Node-RED and MQTT to control Tellstick devices.
  • Given Node-RED's phenomenal palette of objects, having all the Telldus data in Node-RED opens up for all sorts of weird and wonderful ideas. Things like sending a tweet when the temperature drops below freezing, firing off an SMS when someone enters your house, sending an email to activate a certain lightning scenario in your home, .... The possibilities are endless.

References

  1. A lot of the Telldus related code is inspired by the test/sample code over at TheThingSystem's Node.js module for Telldus Live.
  2. Blog post: Using Node-RED for publishing Telldus Live data to MQTT.

node-red-telldus-to-mqtt-bridge's People

Contributors

mountaindude avatar

Watchers

James Cloos avatar Arvind Anbazhagan 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.