Sma-bluetooth: Unterschied zwischen den Versionen
Aus Synology Wiki
imported>Janus Keine Bearbeitungszusammenfassung |
imported>Janus Keine Bearbeitungszusammenfassung |
||
Zeile 28: | Zeile 28: | ||
* Erstellen der Datenbank Strukturen mittels smatool | * Erstellen der Datenbank Strukturen mittels smatool | ||
/opt/bin/smatool --INSTALL | |||
* Script für benutzung von smatool im cron. | |||
Bitte beachten, dass das Passwort, der User und der Datenbank Name eingesetzt werden müssen, damit der MySQL Hack funktioniert. | |||
#!/opt/bin/bash | |||
# | |||
# Startup script to use with cron to download sma data to the database with smatool | |||
# | |||
# crontab example entry to run every 5 minutes: | |||
# 1,11,21,31,41,51 * * * * root /opt/etc/smatool/sma-cron.sh | |||
# | |||
SMAHOME=/opt/etc/smatool | |||
SMATOOL=/opt/bin/smatool | |||
SMACFG=/opt/etc/smatool/smatool.conf | |||
#DEBUG=-v | |||
#DEBUG=-d | |||
LD_LIBRARY_PATH=/opt/lib:/opt/lib/mysql | |||
export LD_LIBRARY_PATH | |||
# | |||
# Main | |||
cd ${SMAHOME} | |||
touch logfile.log | |||
${SMATOOL} -c ${SMACFG} ${DEBUG} $@ | tee -a logfile.log | |||
cat << EOF | /opt/bin/mysql --password=<your mysql password> -u <your smatool mysql user> <your mysql smatool database> | tee -a logfile.log | |||
select * from DayData where CurrentPower>6000; | |||
delete from DayData where CurrentPower>6000; | |||
select * from DayData WHERE DateTime LIKE "1970-%%-%% %%:%%:%%"; | |||
delete from DayData WHERE DateTime LIKE "1970-%%-%% %%:%%:%%"; | |||
EOF | |||
# End |
Version vom 10. Juni 2012, 16:15 Uhr
Es geht hier um das Tool sma-bluetooth zum Einsatz auf einer Synology NAS
Bisher getestet:
DS1010+
- Vorraussetzungen für den Einsatz von SMA Bluetooth schaffen:
Bluetooth muss funktionieren. Die Installation ist hier: Bluetooth_Treiber beschrieben.
- Sourcecode für sma-bluetooth besorgen:
- Original Source
hg pull https://code.google.com/p/sma-bluetooth/
- Modifizierte Source
hg pull https://code.google.com/p/janus44444-sma-bluetooth/
- Compilieren des Sourcecodes:
make strip smatool
- Erstellen der smatool Datenbank
<TODO> Die Datenbank muss mittels mysql Befehlen erstellt werden und mit einem Passwort versehen werden.
- Kopieren der Binaries und erstellen der Config Dateien
<TODO>
mkdir /opt/etc/smatool cp smatool /opt/bin
- Erstellen der Datenbank Strukturen mittels smatool
/opt/bin/smatool --INSTALL
- Script für benutzung von smatool im cron.
Bitte beachten, dass das Passwort, der User und der Datenbank Name eingesetzt werden müssen, damit der MySQL Hack funktioniert.
#!/opt/bin/bash # # Startup script to use with cron to download sma data to the database with smatool # # crontab example entry to run every 5 minutes: # 1,11,21,31,41,51 * * * * root /opt/etc/smatool/sma-cron.sh # SMAHOME=/opt/etc/smatool SMATOOL=/opt/bin/smatool SMACFG=/opt/etc/smatool/smatool.conf #DEBUG=-v #DEBUG=-d LD_LIBRARY_PATH=/opt/lib:/opt/lib/mysql export LD_LIBRARY_PATH # # Main cd ${SMAHOME} touch logfile.log ${SMATOOL} -c ${SMACFG} ${DEBUG} $@ | tee -a logfile.log cat << EOF | /opt/bin/mysql --password=<your mysql password> -u <your smatool mysql user> <your mysql smatool database> | tee -a logfile.log select * from DayData where CurrentPower>6000; delete from DayData where CurrentPower>6000; select * from DayData WHERE DateTime LIKE "1970-%%-%% %%:%%:%%"; delete from DayData WHERE DateTime LIKE "1970-%%-%% %%:%%:%%"; EOF # End