I have been wanting to upload the generation data, preferably using a Raspberry Pi Zero.
I found this excellent article. Now the Pi-W is out, which supports bluetooth and Wifi on-board, it makes getting the data a cinch.
There are a couple of updates to the article:
1. It expects to download the sma-bluetooth code from Google Code. This is now defunct. Instead I ran
git clone https://github.com/sma-bluetooth/sma-bluetooth.git
to get the code.
2. It doesn't mention libxml2; when running make on sma-bluetooth it errors because of a missing dependency. I installed it with
git clone git://git.gnome.org/libxml2-dev
and then I had to edit the makefile to add the include path (which is /usr/include/libxml2)
sudo nano Makefile
editing the second line below:
smatool.o: smatool.c sma_mysql.h
gcc -I/usr/include/libxml2 -O2 -c smatool.c
You should leave the variable name intact, and add the data afterwards.
e.g.
test the config with ./sma_tool -d
3. There is an error in the code.
sma_mysql.c has the line
UNIQUE KEY 'DateTime'(`DateTime`,`Inverter`,`Serial`,`Description`) \
and the first DateTime is a single-quote.
This results in the error:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''DateTime'(`DateTime`,`Inverter`,`Serial`,`Description`)
The fix is to modify the line to:
UNIQUE KEY `DateTime`(`DateTime`,`Inverter`,`Serial`,`Description`)
This comment has been removed by the author.
ReplyDeleteI can send you my makefile if it helps?
DeleteMany thanks - I had a problem and sorted it hence deleting the comment. Makefile would be handy though thanks. Do you need an email address?
Delete