Last night, 8/4/14, a box arrived from Element 14, it contained the following items:
- Raspberry Pi B+ (no microSD card)
- EnOcean Pi
- FTM210U Rocker Switch
- STM332U Temperature Sensor/Monitor
- STM320U Magnetic Contact Switch
Needless to say I was excited to get to doing something real rather than just conjuring up visions in my head while working on parts order lists and continuing researching the project. I now have the first pieces of hardware to work with and it must be working NOW. Unfortunately, now was more like several hours of wrestling around with things, but in the end it worked out OK.
I had already installed openHAB (1.5.0) on my Raspberry Pi B so I just dropped the EnOcean Pi onto that to begin with. I had to track down some issues with the serial port, but you can either use rpi-serial-console scripts as described by fvan in his blog entry "ForgetMeNot - Week 1: EnOceanPi and Sensors" or just remove all references of /dev/ttyAMA0 from the /boot/cmdline.txt file
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
Also comment out the reference to getty using /dev/ttyAMA0 in /etc/inittab as well, it's at the bottom.
#Spawn a getty on Raspberry Pi serial line #T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
Once I had cleared out all references to /dev/ttyAMA0 from those two locations I restarted the system. If you've already cleaned up the /boot/cmdline.txt file and restarted then made changed to /etc/inittab, you can just run 'sudo init q' to reload the inittab without rebooting. I ran 'ps ax|grep getty' to make sure that no getty terminals were running with that port. The first screenshot shows it running.
This next screenshot shows that it is not running any longer
Next I needed to find out the ID for the sensors. The push-button switch had it's ID marked on the back, but the temperature sensor and magnetic contact switch sensor did not. I originally set up openHAB but it doesn't tell you about communications from unregistered devices. I realized I needed to go back and install FHEM to do this, but the site was down for a couple of hours. It finally came back though and I installed FHEM following the instructions written by malakai "How to setup a home automation server with EnOcean Pi" to get the IDs for the 2 other sensors.
Once FHEM is running, to to http://<pi_ip_address>:8083/fhem and you should see a screen like this, notice the section called TCM, that shows that the EnOcean Pi TCM310_0 has been detected, if you don't see this, double check that you edited the /etc/cmdline.txt and /etc/inittab properly and then rebooted the system.
Once some information is received from the EnOcean devices, the left side menu will change and provide you with an EnOceon option, click on that and you should get a result like this, the IDs are highlighted in green.
I took all of those ID numbers and put them into a spreadsheet. Once your devices communicate a couple of times, the ???s will fill in with valid information from the sensor. With that done I went ahead and disable Fhem, by default it's set to auto-start and I don't want it competing for the serial port with openHAB.
pi@raspberrypi ~/ $ sudo rm /etc/init.d/fhem
I'll step back a bit here, because as I had already mentioned, I had installed openHAB on a Raspberry Pi B already before the sensors and the B+ arrived and had been exploring it a bit. To start fresh I grabbed the 64 gig SD card out of the GoPro and wrote the Raspbian image to it.
Installing openHAB 1.5.0 is pretty straightforward, I downloaded and installed the openHAB 1.5 packages from the openhab.org site and installed the according to the directions available on the openHAB site.
I didn't copy over all of the addons into the addons directory though, I only copied the ones I needed for the demo and to make the EnOcean Pi and sensors integrate with openHAB.
Once I did that I went to the ~/openhab/configurations directory and copied openhab_default.cfg to openhab.cfg and edited openhab.cfg. I found the line with "#enocean:serialport=" and changed it to "enocean:serialport=/dev/ttyAMA0" then saved the file.
Like some others I edited my start.sh to add the "-Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0" flag to the java start line, this basically allows Java to access the symbolically linked serial port. Once back at the command promped I typed 'chmod +x start.sh' to make it executable and ran it with ./start.sh .
A lot of stuff shoots by in the log as openHAB is starting up and as it's running, but I wanted to see this in particular as it means the EnOcean binding loaded
12:35:28.353 INFO o.o.b.e.i.bus.EnoceanBinding[:290] - Connecting to Enocean [serialPort='/dev/ttyAMA0' ].
Doing anything with the sensors right now won't generate a result, you need to define them in the items file (Ex: demo.items) for openHAB. You can open up another terminal and go to the ~/openhab/configurations/items folder and edit the demo.items file. There is a documentation section on openHAB's github about configuring EnOcean sensors and switches called EnOcean-Binding which will guide you through the details and how to set the sensors up for different purposes.
One thing to note is that while you can edit the *.items files and openHAB says that it has re-read it, the changes won't always necessarily work. If you make a change on EnOcean devices you may be better of restarting openHAB each time.
Once all of your devices are in the demo.items file and working, then you need to edit the sitemap to make your switches and sensors visible and interactive on the website. I did get to that point, but I have run out of time for today and will cover my particular layout more in depth when it's more developed.
Now that I have things working I'm going to start digging into the hardware and trying to figure out it's full capabilities. The temperature module is also supposed to also work as a setpoint and an occupancy sensor if the EEP is set correctly, but I haven't started working on accessing those features yet or know for sure if I can even modify the EEP with the tools I have available.