Okay... After a few hours of digging, trial-n-error, and frustration, I sorta' have some things working w/ my Nest Thermostat. Still some work ahead, but here's what I've done to get this far:
As stated earlier, I started w/ this article (but jumped around stuff like Samba; not a big fan of it or M$ Windows, and I don't need it since I'm running everything at home on Linux, Mac, or iOS): http://www.makeuseof.com/tag/getting-started-openhab-home-automation-raspberry-pi/
Also the Phillips Hue example didn't do much for me, so jumped at that point to OpenHAB's wiki on Nest Bindings: https://github.com/openhab/openhab/wiki/Nest-Binding
Steps:
(Steps 2 & 3 take about 20 minutes by themselves.)
- Fresh install of Rasbpian "Jessie" full version (includes Java stuff needed; OpenHAB is built on Java.)
- Ensure RPi's firmware up-to-date:
rpi-update - Ensure running latest software:
sudo apt-get update -y
sudo apt-get upgrade -y - Install OpenHAB runtime. (Not real keen on this since diverges from original project, but shortest path to proof of concept and all that; perhaps I'll rebuild from scratch once I get things working.)
wget -qO - 'https://bintray.com/user/downloadSubjectPublicKey?username=openhab' | sudo apt-key add -
apt-key add -
echo "deb http://dl.bintray.com/openhab/apt-repo stable main" | sudo tee /etc/apt/sources.list.d/openhab.list
sudo apt-get update
sudo apt-get install openhab-runtime
sudo update-rc.d openhab defaults - Correct ownership of files:
sudo chown -hR openhab:openhab /etc/openhab
sudo chown -hR openhab:openhab /usr/share/openhab - Start tracking log file in new terminal window:
tail -f /var/log/openhab/openhab.log - Confirm OpenHAB is running and webpage is ready to work (just missing the guts, so expect error listing.)
URL: http://raspberry.local:8080 - Download the demo site form OpenHAB.org, unzip, move files to where belong, correct ownership:
sudo cp -r configurations/ /etc/openhab
sudo cp -r addons/ /usr/share/openhab
sudo chown -hR openhab:openhab /etc/openhab
sudo chown -hR openhab:openhab /usr/share/openhab - Confirm it works:
URL: http://raspberry.local:8080/openhab.app?sitemap=demo - Now install Nest Binding Add-on (actually first downloaded latest stable from OpenHAB w/o thinking, then went back and grabbed from apt-get source added earlier in instructions):
sudo apt-get install openhab-addon-binding-nest
sudo chown -hR openhab:openhab /usr/share/openhab/addons - Copy openhab_default.cfg to openhab.cfg.
cd /etc/openhab/
sudo cp openhab_default.cfg openhab.cfg - Using the Nest-Binding directions, Convince Google to let you tinker w/ your own device:
- Register as a developer.
- Register your "product".
- Gather your nest:client_id and nest:client_secret codes.
- Use the Authorization URL to get your pin_code.
- Edit open.cfg: uncomment out the three lines of code for the data you just gathered under the Nest section, and add said data to those lines.
- Using Vim (sudo apt-get install vim -y) , copy code samples of nest.items and nest.sitemap from https://github.com/openhab/openhab/wiki/Nest-Binding and paste into new files w/ these names in their respective directories. Since I do not own the Smoke+CO alarm, left this extra code out. Also did the trick they used in copying existing icons to newly named representations for Nest controls.
- Change names of thermostat and references to item to match what was registered already w/ Nest account. In other words, their demo uses "Dining Room" and "dining_room*"; if your thermostat is name, "Yo Mama", then either edit manually or use something like this:
sed -i '/Dining Room/c\Yo Mama' /etc/openhab/items/nest.items
sed -i '/dining_room/c\yo_mama' /etc/openhab/items/nest.items
sed -i '/dining_room/c\yo_mama' /etc/openhab/sitemaps/nest.sitemap
(I would still recommend cat/less your files out to double-check yourself when done.) - Test and tweak...
NOTES:
- The log files will catch regular errors about "rrd4j" and and some other stuff related to the demo files installed. Once comfortable w/ demo stuff, best to get it off RPi (or at least out of the directories driving OpenHAB.)
- When rebooting, will need to start OpenHAB via CLI cmd: sudo systemctl start openhab; will fix this to autostart once get the bugs worked out.
- Webpage requires manual refresh to see changes you've made by clicking buttons. From what I understand, the smartphone apps are more auto-refresh responsive.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.