If you want to test this code…
Connect to the command line of the emonPI (use Putty from Windows box),
Run these commands to install and temporarily stop original emonhub. Install a USB bluetooth device into the emonPI first!!
rpi-rw
sudo aptitude install bluez python-bluetooth
sudo service bluetooth start
sudo service bluetooth status
sudo hciconfig hci0 up
hcitool scan
mkdir /home/pi/data/sma_emonhub
cd /home/pi/data/sma_emonhub
git clone https://github.com/stuartpittaway/emonhub.git
Use emonCMS to edit the emonHub configuration file. Add the following under the “interfacers” tag, editing the inverteraddress as needed (see the hcitool scan command above for the address)
[[SMASolar]]
Type = EmonHubSMASolarInterfacer
[[[init_settings]]]
inverteraddress= 00:80:25:1D:AC:53
inverterpincode = 0000
timeinverval = 5
nodeid = 29
[[[runtimesettings]]]
pubchannels = ToEmonCMS,
Run the new version of emonhub.
cd /home/pi/data/sma_emonhub/emonhub/src
sudo service emonhub stop
python emonhub.py --config-file /home/pi/data/emonhub.conf
If the installation worked, you should see new messages on the screen
2017-03-12 13:57:24,873 INFO MainThread EmonHub emonHub 'emon-pi' variant v1.2
2017-03-12 13:57:24,874 INFO MainThread Opening hub...
2017-03-12 13:57:24,875 INFO MainThread Creating EmonHubSMASolarInterfacer 'SMASolar'
2017-03-12 13:57:24,877 INFO MainThread Log into the SMA solar inverter 00:80:25:1D:AC:53
2017-03-12 13:57:24,877 INFO MainThread Opening bluetooth address 00:80:25:1D:AC:53
2017-03-12 13:57:28,083 INFO MainThread Connected to SMA inverter named [SN: 2120051742] with serial number [2120051742] using NodeId=29 and name=SN2120051742
2017-03-12 13:57:28,084 INFO MainThread Reading from SMASolar every 5 seconds
2017-03-12 13:57:37,238 INFO SMASolar Publishing: emon/SN2120051742/Ph1Power 205.0
2017-03-12 13:57:37,240 INFO SMASolar Publishing: emon/SN2120051742/Ph2Power 0.0
2017-03-12 13:57:37,242 INFO SMASolar Publishing: emon/SN2120051742/Ph3Power 0.0
2017-03-12 13:57:37,244 INFO SMASolar Publishing: emon/SN2120051742/Ph1ACVolt 244.66
2017-03-12 13:57:37,246 INFO SMASolar Publishing: emon/SN2120051742/Ph2ACVolt 0.0
2017-03-12 13:57:37,247 INFO SMASolar Publishing: emon/SN2120051742/Ph3ACVolt 0.0
2017-03-12 13:57:37,249 INFO SMASolar Publishing: emon/SN2120051742/Ph1ACCurrent 0.84
2017-03-12 13:57:37,251 INFO SMASolar Publishing: emon/SN2120051742/Ph2ACCurrent 0.0
2017-03-12 13:57:37,253 INFO SMASolar Publishing: emon/SN2120051742/Ph3ACCurrent 0.0
2017-03-12 13:57:37,254 INFO SMASolar Publishing: emon/SN2120051742/ACGridFreq 50.12
2017-03-12 13:57:37,256 INFO SMASolar Publishing: emon/SN2120051742/DCPower1 288.0
2017-03-12 13:57:37,258 INFO SMASolar Publishing: emon/SN2120051742/TotalYield 17321055.0
2017-03-12 13:57:37,259 INFO SMASolar Publishing: emon/SN2120051742/DayYield 5212.0
2017-03-12 13:57:37,261 INFO SMASolar Publishing: emon/SN2120051742/OperatingTime 22632.23
2017-03-12 13:57:37,263 INFO SMASolar Publishing: emon/SN2120051742/FeedInTime 21475.24