Listing all Telldus Live devices in Node-RED

Tellstick Net and DuoContinuing from the previous post about publishing data from Telldus Live to MQTT, here is small piece of related Node-RED code. It outputs a list of all (wirelessly controlled) 220V/mains switches I have linked to Telldus Live, using a Tellstick Net.

The background of the code was simply that I wanted a convenient way of getting a complete list of all devices (switches, dimmers, door bells, …) known to my Telldus Live account. When testing different devices, moving them around, renaming them etc, it is very easy to loose track of which device does what, and what their respective IDs are. This little function solves that quite nicely.

Using the device is easy:

  • Make sure the node.js wrapper for the Telldus Live API is installed and accessible to Node-RED
  • Configure the Telldus Live user credentials in the function node
  • Attach some kind of input node as a trigger (an injector node works well)
Reading device names and IDs from Telldus Live

The node will create one output message for each device in Telldus Live, as shown above. The same information is also written to the console log (easy to disable if it’s too spammy).

Code is found in the tellduslive-list-all-devices.js file over at GitHub.

7 Replies to “Listing all Telldus Live devices in Node-RED”

  1. Trying to run this but get “TypeError: Cannot read property ‘TelldusAPI’ of undefined” … I’ve run npm install, but am not sure what else needs to be done to make it accessible to node-red.

    Thanks

    1. Hi Nick,

      I need a bit more context to understand what’s going on. Any chance you could paste in a bit more of the error message, such as what lines the error occur at, in what file etc?

      1. Hi, thanks. In node-red I have put in the basic example to list all devices. So, it looks like it’s failing when trying to create the object.

        cloud = new context.global.telldusLive.TelldusAPI({ publicKey : publicKey
        , privateKey : privateKey });

        From what I can see, the npm successfully installed.

        └─┬ telldus-live@0.2.1
        ├── oauth@0.9.14
        └── underscore@1.5.1

        However I’m not sure how to make “accessible to node-red” as per your instructions.

        Thanks

  2. Figured out that one must add the module to the functionGlobalContext object in settings.js (thethingbox.js for Thingbox): … ,telldusLive: require(‘telldus-live’) …

    /Cheers

    1. Aha, figured it. I copied and pasted and had some odd speech marks. Corrected those and it works. Fantastic. Been trying for ages to get this going. So, now have lots of things to play with now!

      Thanks!

      1. Hi Nick,
        Good to see you made the MQTT publish from Telldus Live. I’m in the beginning of the same project and asking if you if it’s possible for you to write down each step in Node-Red?

        Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *