13 Comments

  1. Johan Hedbrant
    25. September 2017 @ 9:34

    Dear Andreas,

    Thanks for your excellent blogs and videos, they are outstanding in inspiration and pedagogics!

    I have some IKEA Tradfri bulbs and remote controls, and want to make a “Good night” button, where I can turn off several groups by clicking only one remote. I figured I could do this with Node-red.

    Unfortunately I don’t get the same response from Node-red and tradfri_get as your YouTube #145 at 7:40. When I send an “a” I dont get anything back from tradfri (ie no array etc). If I however send an ID-number, ie 65537, I get an msgid back, but not anything readable (as arrays etc)

    Is this a simple solution to this? I want to read the state of the remote GOOD-NIGHT, and if it has changed from on to off, I’ll switch off the bulb groups?

    (I can “almost” do this with Scargill’s COAPs and a Python program that is looping code from the wrappers. It however only works for an hour or so, then it hangs due to some misreading etc. Maybe a Node-red flow is more reliable…? 🙂 )

    Kind regards

    Reply

  2. Johan Hedbrant
    25. September 2017 @ 15:48

    FOUND IT, I think! 🙂

    The Node-red module “tradfri get” gives a decent response to the debug module if feeded with a NUMBER instead of a string for the ID-number, eg for the GOOD-NIGHT remote (group). I’ll try this new track! My mistake, sorry for the inconvenience! X-)

    KR /j

    Reply

  3. Joni Räsänen
    29. October 2017 @ 13:43

    Hi, Nice video! I am wondering could this Python wrapper and CoAP also discover Trådfri remote controllers and can they paired with Trådfri hub like Philips Hue does? I can image multiple use cases for these cheap battery powered controllers with one or more buttons.

    Reply

    • admin
      11. November 2017 @ 7:07

      I never tried it but it should be possible.

      Reply

  4. Tuomas
    30. October 2017 @ 21:46

    Awesome video and blog post. As inspiration of this, I bought set of IKEA TRÅDFRI and Raspi3 and started to play around with Node-red. I got my basic flows setup and have my “nice” node-red ui dashboard setup etc…

    I got to the point to start playing around with the dimmer and color changes, now I wanted to import your flow to my node-red to see the function you wrote. But here I hit a wall, it seems that if I copy paste your flow, node-red is not allowing me to import it (leaves the greyed out). Could there be a bug in the copy paste above? I tried to do import to both Raspi and my Bluemix node-red, but it is not going in ether one of them.

    Reply

    • admin
      11. November 2017 @ 7:06

      I just tried it and it worked for me. But keep in mind that this flow uses a SQlite node which has to be installed first. I use Peter Scargills script which installs lots of additional nodes.

      Reply

  5. IoT ja kotiautomaatio – osa 1: Perusteet kasaan – Rintamamiestalon uudet asukit
    3. November 2017 @ 19:57

    Reply

  6. skullie
    27. May 2018 @ 16:45

    I get this error when getting the status..

    /opt/ikea/ikea-smartlight$ ./tradfri-status.py
    [ ] Tradfri: acquiring all Tradfri devices, please wait …
    4.01
    Traceback (most recent call last):
    File “./tradfri-status.py”, line 90, in
    main()
    File “./tradfri-status.py”, line 47, in main
    devices = tradfriStatus.tradfri_get_devices(hubip, securityid)
    File “/opt/ikea/ikea-smartlight/tradfri/tradfriStatus.py”, line 44, in tradfri_get_devices
    return json.loads(result.read().strip(‘\n’))
    File “/usr/lib/python2.7/json/__init__.py”, line 339, in loads
    return _default_decoder.decode(s)
    File “/usr/lib/python2.7/json/decoder.py”, line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File “/usr/lib/python2.7/json/decoder.py”, line 382, in raw_decode
    raise ValueError(“No JSON object could be decoded”)
    ValueError: No JSON object could be decoded

    Any clue about what might be?

    Thanks

    Reply

    • PCB
      15. January 2019 @ 19:19

      You probably either worked it out by now or gave up!
      Windoze has helpfully changed the quotes to ‘smart quotes’ , you need to change them all back after you’ve pasted the text.

      Reply

  7. Christian Tzolov
    7. June 2018 @ 22:54

    Very insightful post Andreas!

    Recently I bought couple of IKEA smart gadgets and have been toying of building an intelligent CoAP Shell (https://github.com/tzolov/coap-shell) including some basic Ikea gateway support as well (https://www.youtube.com/watch?v=zhEGFfCJwTg&feature=youtu.be)
    @Andreas will appreciate if you can share your feedback and suggestions about it.

    Cheers,
    Christian

    Reply

    • admin
      14. August 2018 @ 13:04

      I did not do anything with these lightbulbs since then. So I cannot help.

      Reply

  8. Ketil
    11. August 2018 @ 13:46

    I think the problems reported here may be due to IKEA changing their authentication procedure. You can no longer execute commands (i.e. change lighting) directly with the key from the gateway. Instead you must initiate a new user session with a generated key:

    coap-client -k $gwkey -u Client_identity coaps://$gwip/15011/9063 -m post -e ‘{ “9090” : “$username” }’

    You get a response with the new PSK, and you can now execute commands with your selected username ($username) and this key. (Note 15011, not the usual 15001 in the address).

    Reply

    • admin
      14. August 2018 @ 13:04

      Thank you for your tip!

      Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.