Project Intro Recap
For a project that I thought would only take me a few hours it was way more intense that I first intended it to be. If your not familiar with the project, here is a quick diagram of what I was aiming to do.
Basically, if my Webex Board is on a call turn the Blynclight from green to red. Once the call is over turn it back to green. It seemed pretty simple and straightforward.
Step 1. Acquire BlyncLight(BL) + Pi + CE Room systems
This was the easy part. Buying the pieces from Amazon that I didn't already own. In my case it was just the Blynclight
. I already had some unused Pi's and also a very well used Webex Board in my office. I purchased the wifi version of the BL. My thought was I would probably need this so I can locate the light outside my office in a highly visible place.
Can't get more visible than this. This is the working BL fully installed.
Step 2. Build Code using Python not Nodejs
This is where the real adventure begins. Not knowing that the manufacture, Enbrava, has since changed the BL's command word, vendor id and product id in the latest hardware release, nothing already existing from a Nodejs point of view was going to work. While the vendor id and product id are easily obtainable the command word is not and had to come from the manufacturer. After several email exchanges with them I resided myself to, "Nodejs is not going to work".
Embrava who make the BL only support the use of a Objective C SDK and they do not seem to be all that willing to release the details of the command word to control the light. Their last response to me was, "We understand your concerns and thats why I have told you that I will try to get the approval to share the device protocol to you." The bolding was in the email BTW. This was my queue to start looking elsewhere for answers. Could I have used their SDK? I suppose but it seemed like an extra layer of messing around that I didn't want.
Python to the Rescue
While my efforts to get somewhere with Embrava fell short I did manage to find a great Python library
. While I have never coded in Python before (outside of "hello world") I thought what the hell, I got this.
The code I had to write for the project was pretty simple. The application is monitoring the call status of my Webex Board using a websocket to communicate and posting events on call status to change the light color.
The code was the easiest part of the project besides going online to purchase the BL from Amazon. Once I got the hang of working with Lists and Dicts in Python the rest was just adding the logic for turning the light on and off. Easy. I was surprised at the lack of code I had to actually write, although this is not a complex coding project it still surprised me.
Python libraries used in the project:
- Python library for connecting to a Cisco Collaboration Endpoint using a WebSocket https://github.com/cisco-ce/pyxows . Just be aware the example in the readme has some issues and does not work without some fixing and additional code.
- Python BlyncLight library https://pypi.org/project/blynclight/ . The reference to HIDAPI could be a little better but still the library functions great and without it I wouldn't been able to get anything working. I am not sure how he got the command word figured out but credit to him for getting it done.
Step 3. Prep Pi for Python 3.7 and Load Drivers
At one stage I almost considered throwing in the towel at this step. The BL project would be residing in the pile of junk I keep in my office. I call that pile "the to do pile". Thank heavens for people posting stuff on the Internet. It really saved the project and me the embarrassment of telling my wife I paid $85 for something I can't use or figure out.
The first issue, a pip ssl error that kept saying, "pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available". This was especially annoying as everything I tried failed. I finally stumbled on the blog post below by Josh.
Second issue was reading the USB port on the Pi. It was just not working with the HIDAPI module. This was resolved with some help by a KB article on setting up the HIDAPI module with more clearly defined instructions. The README from the library on github is a little cryptic when it comes to the install instructions for Linux.
Step 4. Stand back and Marvel at My Functional BlyncLight
Even Lord Vader approves.
The project was fun despite some struggles.Two things I got out of this is firstly I really enjoyed was writing blog posts again and secondly using Python in a real project. It's been fun doing the updates as I go. While it takes time to do its a nice way to record the project. If I ever have to I can retrace my own steps. While I may never do the BL project again at least it's here if I change my mind.
I hate learning a new language or scripting and having to step through the whole "hello world" crap every time. Learning really accelerates when you do real world versus lab world. So doing a Python project that applied to real world, although limited to my office, was a lot of fun. It has me thinking about what else I can do with some more Python skills.
BlyncLight Thoughts and Conclusions
Would I buy a Embrava Wifi Blynclight to put outside every conference room in a company, no. The wifi versions battery life is less than optimal, seems to be about a day. I didn't want to have to charge the thing almost daily. I was also not impressed by the response from their support people. To only have the one SDK and not provide the command word is not what I would have expected.
The BL was what I considered expensive. Now, if you were buying hundreds of these sure it would be cheaper but the $85 I paid was way to much. So while this was fun to mess around with and there are pieces of the project to learn from, there are more than likely better lighting systems to integrate with than this. I am sure if you want some off the shelf light that works with Jabber, S4B etc. that sits on your cubicle wall this would be great but for this type of project, it's only average. I would also recommend the much cheaper Standard BlyncLight and just use a USB cable if you decide to do this project or something similar.
Hope you enjoyed the project. Let me know what you think in the comments. Comment if you did a project like this you enjoyed or not.