I have spent some time getting to know Fhem website. I can see the STM330 Temp Sensor and the STM320 Reed Contact. I set up telnet session using putty and with the command inform timer. Soon I good see the events coming through. I was thinking about a more powerful graphing feature for the Reed Contact. So last night I started to load the New charting front end:
Installation on a Raspberry Pi (instructions for "pompom")
This guide also works on a BeagleBone Black with Debian.
Hardware Requirements
- Raspi Model B
- Working Internet connection
Software Requirements
- German keyboard layout (j yes)
- Functional FHEM installation on RPi Wheezy, which was brought up to date using update (see also: Raspberry Pi )
- The front end was installed by
update third party http://svn.code.sf.net/p/fhem/code/trunk/fhem/www/frontend frontend
- Access to the means of RPi Putty is given.
- Access permissions of the folder are also given (written to / opt / fhem)
<command>
= this line is the Putty prompt input (without <>)<IP_des_RPi>
= IP address on the RPi is reachable
What is being done? We will set up the new chart frontend using SQLite3 and all required libraries on the RPi.
- We are connecting via Putty with our RPi and login us.
- To spare us the constant sudo we give first a <sudo a bash>.
- <apt-get update>
- <apt-get upgrade> and answer the demand with "j"
- <apt-get install sqlite3>
- <apt-get install libdbi-perl libdbd-sqlite3-perl>
- <apt-get install -f> (the "-" possibly overwrite here in the Putty session, under certain circumstances does the hex code of the character after copy / paste does not)
What have we done so far?
- We have re-read the packages for our RPi.
- We have brought our RPi package installation up to date.
- We have sqlite3 installed.
- We have installed the required libraries.
- We have resolved all dependencies and can add packages. </ Nowiki>
Now we are preparing our database. In Putty, we give the first one a <cd /opt/fhem>.Now all files are created in this folder - if you want the course to adapt. Then we give the putty Prompt <sqlite3 a fhem.db>.We have created our database and called fhem.db. Now our prompt shows in Putty sqlite3> to. So we are in our database. In this database, we will create another 2 TABLES - one current and one history. This you can easily take over with copy & paste.
CREATE TABLE `history` (TIMESTAMP TIMESTAMP DEVICE varchar (32), TYPE varchar (32) EVENT varchar (512), READING varchar (32), VALUE varchar (32), UNIT varchar (32));
CREATE TABLE `current` (TIMESTAMP TIMESTAMP DEVICE varchar (32), TYPE varchar (32) EVENT varchar (512), READING varchar (32), VALUE varchar (32), UNIT varchar (32));
And one for the frontend:
CREATE TABLE frontend (ID INTEGER PRIMARY KEY, TIMESTAMP DEFAULT CURRENT_TIMESTAMP TIMESTAMP, TYPE TEXT, TEXT NAME, VALUE, TEXT);
Now we can
- with
<. tables>
see if 3 entries appear (current, history, frontend) - with
<. exit>
SQLite3 we leave and go back to our Putty prompt.
Before we define in fhem DBLog, we must first create our db.conf. This is done by <nano db.conf>
.
Is filled with this configuration file
% Dbconfig = ( connection => "SQLite: dbname = / opt / fhem / fhem.db" user => "", password => "" );
Store by pressing CTRL + X and "j" and exit nano again.
In the folder / opt / fhem the files should now So in addition db.conf and are fhem.db.
If this is the case and the fhem.db has the necessary rights, we can define in fhem our DBLog. I have the simplicity of the group and each user is granted write access.
This is done by
<chmod -R g+w fhem.db> <chmod -R o+w fhem.db>
Putty in the input, since fhem has bitched that it can not write to the file ("-" possibly again override by copy / paste).
So now even our
define myDbLog dblog / opt / fhem / db.conf *:.. *
registered in fhem and from here ALL is now written into the database.
Now we can in our browser (tested with Firefox 19.0.2) to access our frontend:
des_RPi>: 8083/fhem/frontend/index.html
So it went smooth until I tried: with <. tables>
see if 3 entries appear (current, history, frontend).
I received an error that the database could not be opened. The features of this frontend are rich in features so I want it up and running today ! I found that when I translated the page some of the code contained extra letters. I placed my cursor over the translated code and could view the original and corrected my input.