Saturday, May 09, 2015

More on Wink Hub and open source home automation software

I own two Wink hubs.  One, using their cloud service, the other I kept offline for rooting and testing.  The night Quirky pushed the bad firmware, my online hub got it.  At the time I had no idea what happened.  I spent hours trying to get it functioning again.

The next day the announcement about the bricked firmware came out.  Once the instructions were posted on how to fix the hub yourself I followed them.  Apparently it worked.  The hub flashed and then stopped on blue.  After that I could get the hub online for short periods (blue light) and then it would go back to flashing purple.  I spent a good while addressing this, but I never was able to get it working reliably.

I pulled out the other hub, went through the whole thing again, apparently updated to the fixed firmware, and then had exact same problem.  It would connect to the home network for a while and then eventually go back to flashing purple.

So I've given up on Wink hub.

I went out and got a Hue bridge and some bulbs.  Since I already had GE Link light bulbs I needed something that would work with them.  So these days I have a mix of Hue bulbs and GE Link lights all controlled by the Hue bridge.

Home Assistant works with the Hue bridge.  I am still using Home-Assistant as my home automation software.  It meets all of my needs.  The developer and members of the group are continuing to add functionality to the software.  More device support, added features, etc.

I also spent plenty of time testing various other open source offerings.  Nothing has yet to best Home-Assistant.

Although there is not a downloadable application for Home Assistant, it does work with mobile devices and renders nicely.

Home Assistant source code on GitHub

Friday, May 08, 2015

Ubuntu - new setup of nginx, mysql, and php5 - permission denied when trying to view info.php

I followed the very helpful guide here:
https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-12-04


I actually did the setup on Ubuntu 15.04 and they worked.  There is one part where you have to change the codename used.


The last step is to create a info.php file that displays all of the php5 information.
When attempting to view this file I would get error 404.  I googled and started trying to find the issue.  The log stated the file was not found.  Since this is new to me I wanted to make sure the correct location was being used for my files and that the permissions were set correctly.


I checked the permissions on the files in the html directory and they were correct.
So I created a test html file in the
/usr/share/nginx/html
directory.  A simple hello.html.  I tested and the page displayed.


So it appeared that my info.php file was both in the correct location and permissions were correct.


Next I checked what accounts the nginx server process was using, and the php5-fpm process.  I found that the server worker process was running as user nginx and the php5-fpm worker process was running as www-data.  It was my intention that both be running as www-data.


I check to see if nginx was a member of www-data:
$ id nginx
-output: uid=121(nginx) gid=133(nginx) groups=133(nginx)
No, nginx is not a member of www-data.


To resovle this issue I need to give the nginx account access to the php5-fpm.  To do this I needed to add the user nginx to the www-data group (www-data is the user and is a member of the group www-data).


To do this I ran usermod -a -G <groupname> username
$ sudo usermod -a -G www-data nginx


Next, confirm the user is in the group:
$ id nginx
-output: uid=121(nginx) gid=133(nginx) groups=133(nginx),33(www-data)


As another way to confirm one can run:
$ awk -F':' '/www-data/{print $4}' /etc/group
nginx
www-data


Now nginx is a member of www-data.  Next I restarted nginx server and php5-fpm
$ sudo service nginx restart
$ sudo service php5-fpm restart


This time browsing to http://localhost/info.php displayed my php info properly.


I hope this possibly helps someone.

Friday, April 24, 2015

Have you tried Sublime Text for script editing?

I recently stumbled upon Sublime Text.  I was working on a new build of Linux and Googled for a good script editor.  Sublime Text came up.  I gave it a try.  First the none beta version, version 2.  After a bit I tried the new version 3 beta.

I REALLY like this program.  I have been using the free Komodo Edit and while it is great, and I still use it too (they just released version 9 with some nice features), I mostly use Sublime Text.

Aside from having many built-in features that one wants in a coding platform, Sublime also has a Package Manager (Control) which can easily be installed.  Once added, the Package Control opens up so much more versatility, expandability, and support it is emmensly valuable.

In addition to the features, customizations, and add-ons, I particularly enjoy the massive selection of themes for the coding environment.  I have become a fan of alternate color schemes which help me identify different elements of code more quickly.  There is almost an infinite amount of pre-made themes free to download.  Additionally, one can create your own themes.

Sublime Text offers a fully functional trial version that does not expire.  It will prompt occasionally about using an unregistered version, but this trial is enough to get you hooked and want to buy a license.  Even better, the licensing is per user.  So once you buy a license, you are permitted to install Sublime Text on all of your computers.  Even work computers.  As long as it is you using it.

At the time of my purchase it was $70 USD.  It is worth it.

I'm sorry Komodo.  I still love you.  But Sublime has become my new coding best friend.

Here are some links to get an idea of what Sublime looks like:
And have a look at this! - Package Control

Thursday, April 23, 2015

Taking existing HD image and applying to SSD - test your alignment

To fully gain the performance benefits offered by switching to an SSD, the clusters need to be properly aligned with the physical sectors on the SSD.  If not, the performance gain from the SSD will be dramatically impacted and can also contribute to increased wear of the SSD.

First, a clean install of Windows 7 or newer onto an SSD is already setup to do proper alignment. This is not an issue.

The issue can occur when an image is captured from a mechanical (traditional) hard drive and then applied to a Solid State drive.  This could result in mis-alignment of the beginning of th clusters and physical sectors.

If you have taken an image of your computer and then applied it to a new SSD, and would like to know if you are properly aligned, perform these steps.

1) Open a command prompt (cmd) - Start>All Programs>Accessories>Command Prompt
2) Type in this command: wmic partition get Name, StartingOffset and hit <Enter> key
This will return something like this:
Disk #0, Partition #0 1048576
Disk #0, Partition #1 524288000

Now open calculator (Start>All Programs>Accessories>Calculator)

Now divide the value return by the command by 4,096.  If the result is an integer (no decimal value), then your partitions are properly aligned.

So in the example above division produced these results:
256
128000

That indicates proper alignment.  Had the results been something like 254.415 then alignment is offset.

If alignment is offset there are ways to correct the issue. You may want to take a look at these free tools:
http://www.partitionwizard.com/
http://www.disk-partition.com/download-home.html

For the record, a SSD partition can be created with command line parameters to set alignment.
Diskpart
List disk
Select disk n (where n is the number that was given for your SSD in List disk)
Clean
Create partition primary align=1024
Format fs=ntfs quick
Active (assuming you want to install an OS)
Exit

The above commands are not a fix for a improperly aligned disk post imaging, this is a command to create the partition with proper alignment.

If these issue affect your or you are interested I suggest doing some googling and more reading.

Sunday, April 19, 2015

Wink bricked by update (~4/18/2015) - how to use your GE Link Bulbs with something else (link a Hue Bridge)

Update:
In case you have a bricked Wink hub I received an email from Wink and it is possible to repair your hub without having to send it in, provided you have the means necessary to follow these instructions.

I wanted to post this for anyone who might not have gotten the email:

We’re writing again to apologize for the current situation.  As previously mentioned, we suffered an outage this weekend that caused your Wink Hub to fall offline.  This outage was preventable and we are deeply sorry. It pains us to have inconvenienced you as much as we know we have.

While last night’s report was grim, we are now offering two solutions to users who are affected by this outage:

Send Us Your Wink Hub -  We’ll supply a box and roundtrip shipping.   A box will be at your door early this week, and you’ll have your hubs back (with all of the settings preserved) very quickly.    If you’re not into technical stuff- this is probably the easiest route for you.   To send us your hub click here.

Fix it Yourself -  If you are comfortable making some quick changes to your home’s router settings, we can likely get you back up and running in 10 minutes.While this fix requires one to have some degree of technical skill, we’re happy to offer it to all who want to try.  We can even walk you through it over the phone if you give us a ring at 844-WINK-APP . 

You can view instructions on how to repair your Wink Hub yourself via this link recovery.wink.com  These instructions now apply even if you previously deleted your hub.

We are happy to accommodate whichever route you prefer and apologize for creating extra work for you.  Please note that this outage was caused by a security measure put in place to protect you.  Although your home is offline and your hub is inactive - your home and your information remain safe.

The Wink Team
Above is an update, here is the original post...

I think I am done with Wink hub.  It is an extraordinary ordeal to get a simple API access token. Something that could be spit out on a web form just by authenticating with your account takes 7+ weeks from Quirky, if they get back at all.  And that includes occasional check-in emails with them asking 'what is the status of my request'.  I am not disparaging Wink\Quirky staff.  There is just clearly some sort of ignorance to customer support.  For me, without a token, the device is nearly useless for my purposes.

Interestingly one night I had to chat with them for support due to an issue with my hub and I brought up the API request and 7 weeks going by and what the status was.  I was told that an update would be made to my request, and to expect a response in 2 to 7 weeks.  :(

To their credit, the next day I got an email with my API information.  Very much appreciated that they got on it after so long.

So yesterday was the day I was up until 3AM trying to figure out why my hub would not connect. Then today I find out about the firmware update that was pushed and bricked many Wink hubs.

The Wink hub is nice in the variety of radios on board, and potential for supported devices.  And the cost.  But on the downside, cloud only access, extreme difficulty getting an API key (why so hard?  I happen to know it can be down instantly with user login and pass... but that is another story).  What started out as a pretty solid (as in, online all the time) device, took a turn for the worse with firmware 0.77.0.  By this point, I started having a lot of inconsistent, and frustrating issues.  Lights turning on - on their own.  Light groups turning on, leaving one off.  Or turning off, leaving one on.  Devices needing to be re-added.  Slow reaction times.

Other than the brick update, none of the above is really a deal killer for a $50 hub.  But what is confusing is the reluctance to turn this into something great with a reasonable pace.

1) An open source project called Home Assistant, which was the only home automation project I was aware of that you could get a token immediately, was my saving grace.  Otherwise, I would have been real frustrated with the wait for them to issue me API access. But by going to the Home Assistant site, you could put your Wink user and pass in, and immediately get back a token that would allow integration into Home Assistant home automation project.  This tells me that there was really no reason to wait 7 weeks for API access, and just by chance finally get it.  It was a simple as a web form.

2) With potential support for so many protocols and devices, why keep it so limited?  Why not take a more agressive approach and open things up.  That would spur sales, community development, growth, and a more ROI product.

3) Considering the amount of competition in the market, I never have been able to understand why the Wink hub was rolled out, locked down, and eventually (unfortunately, blundered into uselessness).  I'm done.  Had a different, more open, more inviting approach been taken, the Wink hub could have been a tremendously popular device.  But no...

The real purpose of the post is a tip on how to re-associate items, like GE Link light bulbs with another device if they were not removed from the Wink hub (because you couldn't!).

First, the GE Link bulbs use Zigbee.  The Hue bridge supports Zigbee, and these bulbs.  The way to reset these bulbs for pairing is as follows:
Power on the bulb for about 5 seconds.  Turn off for about 3 seconds.  Repeat this 5 times.  On the fifth time you may see the bulb fade after power on, and at this point it should be cleared for easy pairing with another device like the Hue bridge.

Also, the bulbs have a serial number.  It may be possible to do manual additions using the serial number.

I just wanted to pass along if you try to use a bulb with another hub, and it does not pair right away, don't worry, the bulb can be cleared and paired.

BTW, the GE Link bulbs are easy to setup with the Hue bridge.  Compare to a Hue bulb, they do not dim as much, but they do work fine, and can be grouped into scenes.


Tuesday, March 31, 2015

Mac OS X record of installed software (including operating system install)

The file /Library/Receipts/InstallHistory.plist contains a full record of installations, some details about the installation, and date of install.

I stumbled across this today and thought it could come in handy with regard to certain situations.  I just wanted to note it in case anyone else didn't know about this file (like myself).

One potential use I see is finding out what the initial operating system version was for the Mac.

Thursday, February 26, 2015

What is going on recently with the Quirky Wink hub (rooting, API, home automation, home-assistant)

Many have purchased the Wink hub, which is sold at Home Depot as a controller  for home automation devices.  The nice part about the Wink hub is the low cost and number of radios (supported protocols).  Those two items combined makes a very appealing device to use when getting started with home automation.

But there are some drawbacks.  Firstly, the Wink hub operates through a cloud based service.  This means you can access Wink at home, or away from home, which is nice.  But for those of us who want to take full advantage of the hub, the locking down of the API and cloud requirement are really handicapping the device.

If the hub you purchase is running older firmware, it can be rooted.  Once rooted, the doors are open for getting creative with the hub, adding functionality, integrating into customized HA software, etc.  But this too can be a challenge.  First, the hub has to have a certain version of firmware or earlier else the sql injection vulnerability (allowing one to get root) is patched.  In addition, even if you do gain root, updating the firmware requires much effort to maintain root through the update.

Quirky is only giving API access to those who submit requests via email and so far it is known that they may take a long time to respond with the required information, or they may not respond at all.  This difficulty is preventing those developing HA software from being able to incorporate the Wink hub.  Which means, there are less cool things you can do with the hub due to the software limitations.

I wish that Quirky would change direction with regards to the Wink hub.  Instead of trying to prevent root access, embrace it.  With its low cost, and easy availability (Home Depot), and wide range of support devices, the Wink hub is in a position to be a big seller.  There is already a community developing for the rooted hub and new and exciting features are being added.  If Quirky opened up the hub for root, I think it could turn into a hugely popular device, with a large community of talented people developing for it.  It could be become the most popular hub on the market.

If you are like me and want to find some software that will let you create more advanced scenarios for controlling home automation, fortunately, there is at least one offering for non-rooted Wink hubs.

Home Assistant:

https://home-assistant.io/getting-started/
https://github.com/balloob/home-assistant

This is still being developed, but it is far enough along to allow one to integrate their Wink hub and many different HA devices are already supported.  In addition, it lends itself to adding custom components, and end user expansion/development.  Home Assistant is open source and free.  I recently set it up and one of the really cool things is you do not have to hope that Quirky will send you the required access tokens to use the API as Home Assistant has a page that lets you put in your Wink user and pass and will generate a token for you.  So you can get started right away.  Setup is pretty simple, especially if you are familiar with Linux and Python.  Even if not, there are clear instructions and a helpful forum to help you get started.

As of this moment. this is the only non-Wink software I am aware of that will let one use the Wink hub (without having to root).

Speaking of software, there is a commercial product called CastleOS that looks promising.  There is still much to be done with CastleOS's development, but one of the really cool features is builtin support for voice recognition using Kinect for PCs.  I have found that the xbox 360 Kinects (with A/C adapters) can be purchased very affordably from places like GameStop ($25) and are easy to setup with CastleOS and work very nicely.

Unfortunately, at this point in time, CastleOS does not provide much documentation, and only supports a limited range of products.  The Wink hub is not supported.  The do offer a 30 day free demo of the software and the purchase price is $199.  Although I am finding the free software Home Assistant to be more valuable to me ATM, CastleOS may be something for you to check out if you want at more turn-key product that is Windows based, and supports Kinects for voice.

Here are some links on rooting the Wink hub and some links to items that can be used with a rooted Wink hub:

Rooting

https://winkhubroot.wordpress.com/2014/08/16/rooting-the-quirky-wink-hub/
http://arahuman.blogspot.com/2014/11/how-to-root-your-wink-hub-step-by-step.html
http://www.dinnovative.com/?p=348

Discussion and links to other software like Blink

http://forum.xda-developers.com/general/off-topic/wink-hub-root-t2969205
https://github.com/nashira/blink
http://www.rootwink.com

Finally, I recommend having a look at Home Assistant if you would like to use or become involved with a burgeoning application that offers Wink hub support, customization, and growing support for HA devices through an open model, plus existing cool features with more to come.

New beginner's guide to PowerShell on my GitHub page

 I created a beginner's guide to PowerShell here: https://github.com/aamjohns/Powershell_Guide/blob/main/README.md I hope it helps someo...