Category Archives: PHP

Wi-Fi Thermostats are Awesome

There comes a time when a man is unsupervised for 2 weeks, and random household projects take place. Gutter cleaning, hedge trimming, pump re-piping, mysterious projects involving an angle grinder, and on top of all this, the start of what will become numerous home automation experiments.

Anyway, I made the purchase of a Wi-Fi thermostat. It is a Filtrete 3M-50, and it rocks. The same thermostat is also labeled as a Radio Thermostat CT50 and other models. I found mine as an open box model on eBay, figuring some poor guy bought it and couldn’t figure out the wiring. Judging by the few missing wire labels but otherwise perfect condition, I figured right.

Hardware installation was surprisingly easy. Thermostat wiring is somewhat standardized, although my Trane unit threw a curveball at me as far as the “C” wire, which happens to be the most important wire to get a modern thermostat working. On a Trane, it turns out this wire is labeled “B”, and it took some research to figure this out (even Nest’s website couldn’t determine my setup). Anyway, I put the 6 or so wires in their place, fired it up, and it has worked ever since.

The Wi-Fi setup is slightly weird, and maybe it doesn’t look as sexy as a Nest, but it works well, doesn’t need a battery, has a touchscreen, a scheduler, and an app to adjust temperature and scheduling settings. But the thing that sold me on it… get this, it has a well-documented JSON-based REST API. *drools uncontrollably*

Why did I buy this passé, beige, how-you-say… uninspired box when I could have bought a Nest? I guess this would be why…

1) Nest had no open API. The only info I could find was reverse-engineered. It looked nice though.
2) Nest requires the cloud. As far as I could tell, you can’t address it on your network directly.
3) I wasn’t sold on the automatic scheduling. It has to see you for that to work, and my thermostat is in a room with no real traffic.
4) Their website suggested it was incompatible with my wiring. This turned out to be untrue.
5) There are a lot of scary Amazon reviews out there. Either you love it, or it destroys your life (and freezes your pipes). Not much in-between.
6) It uses a lithium ion battery. I don’t know about you, but I don’t want to replace the batteries on a thermostat every 3 years.
7) There was apparently a (forced) software update bug that bricked a lot of people’s thermostats in the middle of winter.
8) I don’t care what the hardware interface looks like… if it’s doing its job I shouldn’t have to look at it or touch it.

I’m not a Nest Labs hater or anything though. I like their Nest Protect product, even though it has a few problems of its own, and I may end up purchasing one or two of them. Heck, does anyone else make a Wi-Fi smoke detector?

So, I managed to write an extremely basic class in PHP that allows me to get and set the temperature, and I’ll be releasing it on GitHub soon as part of a big project I’m working on. A project which is getting closer and closer to release. 🙂

Fantasy Healthcare

I have an announcement to make: I placed 3rd in the Robert Wood Johnson foundation’s Games to Generate Data Challenge. I have been secretly working on this project for most of the year, and now that it’s over, I can talk about what I’ve been building.

Fantasy Healthcare is a game that allows friends (in the Wisconsin area for this version) to create their own healthcare provider dream team and pit it against other friends and players online. The provider data and provider names are 100% real, but the doctor/department names have been changed to protect the innocent. The idea is that players will better familiarize themselves with providers in the area, while also learning which providers perform best in certain areas.

The interesting part of all this is how it all got started. At my public sector job, I joined up with a group that was looking to enter the Games to Generate Data Challenge as a team, but alas, government red tape (and lawyers) prevented this from happening. However, since I was a contractor, I was able to take an idea of my own into the challenge and see how far it would get. It ended up being a good enough idea to place in the Top 5, so from there I developed the game on my own.

Fantasy Healthcare is written in HTML5, Canvas, CSS3, Javascript, jQuery, jQuery Mobile, PHP, and MySQL. The back end stuff runs on a Linux server. The Canvas stuff is also cross-compiled to native iOS and Android platforms for the efficiency and fast performance you expect from a game. I did it all myself, so considering I competed with some large teams and some big industry players, I guess I did pretty well for 3rd place.

So besides winning some nice prizes, I also got a trip to Boston to attend Games for Health, and a trip to the Health 2.0 Conference in San Jose to see the winner announcements. First off, Ben Sawyer’s Games for Health project in Boston was a wonderful experience, and I wish I were able to go again. There are really some amazing interactive ideas out there ready to transform the industry. As far as Health 2.0, I also had a great time hanging out in the Valley, drinking local brews and eating some In-N-Out Burger. The 1st and 2nd Place winners were totally deserving of their prizes, each having some fun-looking and interesting games, and I sincerely wish them all the best with their endeavors.

While I was in San Jose I got caught up in the government shutdown, but that’s a story for another time.

The Robert Wood Johnson Foundation and Health 2.0 are doing some wonderful things right now to provoke and promote bleeding edge ideas in the healthcare industry, so be sure to visit their challenge site.

What’s next for Fantasy Healthcare? I’d like to publish the apps and expand it to more cities. This will take some time I don’t have at the moment, though. In the meantime, it is available here for anyone to play with.

Presenting my latest project, SoulTrade

As you might have guessed, I’ve been working on another app these past few weeks. This represents only 2 weeks of work, so overall I’m okay with how it turned out. Without further ado, I present:
SoulTrade (soultra.de)
(available for iOS and Android!)

What is SoulTrade? It’s a market for buying and selling souls, basically. Yeah I know, it’s a pretty stupid idea, but I mostly just wanted to flex my design and development muscles with some of my free time. I really didn’t care what the website did, as long as I got to use PHP/MySQL/jQuery/Javascript/HTML5/CSS3. So ironically, this project really has no soul, heh.

Technical details: SoulTrade was written by me in 2-3 weeks with a PHP/MySQL back end using my own framework. The front end was designed by me in Photoshop and Dreamweaver, and of course utilizes HTML5/CSS3/Javascript/jQuery. The website is running on a LAMP stack, while the mobile version is using jQuery Mobile and Phonegap.

Enjoy.

…mwahahaha….

Everybody’s Talkin’ ’bout the New Sound

Not too long ago I had the displeasure of using Smarty in a PHP project for a major client. You’re probably wondering what the heck anyone would be using Smarty for in 2012… well, lots of turnkey systems (shopping carts, CMS, etc.) built from 2007-2010 use all sorts of templating engines, but Smarty, at the time, was definitely the most popular. These days, I guess PHP developers have wised up to what I had been saying for years, since you don’t really see these things being used anymore. Old-school templating engines had many obvious problems that nobody really thought of, while they were busy worshipping the concept of model-view separation. Don’t get me wrong, there’s nothing inherently wrong with this line of thinking, but… why did this seem to always necessitate the creation of an entirely new programming language? Did the Smarty people forget that PHP itself is already an amazing text processing language, and doesn’t really need an additional templating language written on top of it? To be fair, there are some nice templating engines out these days that use PHP itself as a templating engine, but honestly with good development practices, you can adequately MVC your way through a project without the need for a templating engine. If it scares your designers, then hire new ones. So anyway, the team got together and we basically all said, “is it just me, or is Smarty, well, stupid?” Unfortunately, we were stuck with it, so it didn’t matter that the development team loathed it.

I believe that templating system fiasco of yesteryear serves to prove an important point: the web development fads of today may or may not be the practice of tomorrow. It’s incredibly important that you don’t unnecessarily tie up thousands or millions into a project because it “has to be done in Node.js-SproutCore-Backbone-ExtJS-Coffeescript-SASS-HAML-960gs-Bootstrap-NoSQL”, or whatever bleeding edge technology stack of the week. It might be the hipster CTO thing to do, but keep in mind: some of these technologies may be keepers, but half of these technologies will be long forgotten in 3 years, and one or two of these will make your new programmers laugh, then hard-time you until you pay them to rewrite it in something more sensible. There’s a reason Java, .NET, and PHP continue to thrive, while stuff like Python and Rails seem to have peaked last year could be going the way of Perl and Tcl/Tk. They’re proven scalable, they have support of millions of developers, they have robust libraries already written basically everything, and they are used by the largest sites on the web. They may all be sugarless, downright ugly languages, but heck if they don’t get the job done everytime. I’m not saying all new technology is bad, obviously. Lots of amazing stuff has been popping up lately, but it doesn’t mean I’m going to rush out and use some unproven technology on a Fortune 500 company’s project, though I might experiment in certain places. There’s doing the cool thing, and there’s doing the smart thing. And yeah, I know it’s scary to use the “old way” on new websites sometimes, but I’ve certainly seen my share of situations where the old way was apparently done that way for a reason. Hopefully this doesn’t make me sound like a cranky old person afraid of change, because that’s not at all what I’m trying to convey, heh.