Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SMA Solar emonhub interface #26

Closed
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ More generally: Emonhub consists of a series of interfacers that can read/subscr
- Victron Products e.g BMV 700 battery monitor (added by @jlark)
- ModBus e.g. FRONIUS Solar inverter (added by @cjthuys)
- Graphite timeseries DB (added by @hmm01i)
- SMASolar (added by @stuartpittaway)

***

Expand Down Expand Up @@ -49,45 +50,44 @@ Mosquitto: (see http://mosquitto.org/2013/01/mosquitto-debian-repository)
Depending on which version of Debian you're using:

sudo wget http://repo.mosquitto.org/debian/mosquitto-wheezy.list

or:

sudo wget http://repo.mosquitto.org/debian/mosquitto-jessie.list

Update apt information:

sudo apt-get update

sudo apt-get install -y mosquitto python-pip python-serial python-configobj
sudo pip install paho-mqtt
sudo pip install pydispatcher


It is recommended to turn off mosquitto persistence

sudo nano /etc/mosquitto/mosquitto.conf

Set

persistence false

Install the emon-pi variant of emonhub:

git clone https://github.com/openenergymonitor/emonhub.git && emonhub/install
sudo service emonhub start

The emonhub configuration guide can be found here:

[emonhub.conf configuration](https://github.com/openenergymonitor/emonhub/blob/emon-pi/configuration.md)

To view the emonhub log via terminal on the emonpi or emonbase:

tail -f /var/log/emonhub.log


### EmonHub Emoncms config module

If you're using Emoncms on the same Raspberry Pi as emonhub, you may find the emoncms config module useful which provides in-browser access to `emonhub.conf` and `emonhub.log`:

https://github.com/emoncms/config

68 changes: 68 additions & 0 deletions conf/interfacer_examples/smasolar/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#SMA Solar Bluetooth Interface#

This is an interface between SMA Solar inverters (http://www.sma-uk.com/) and emonCMS.

emonHub is used to communicate over bluetooth to the solar inverter and retrieve various generation values, which are posted into emonCMS.

Currently tested on SMA models:

* SB3000
* SB3000HF


##Installation##

Note that you will need to have a bluetooth USB device installed - recommend a class 1 device with a longer range if your inverter is more than 10 metres away.

On emonPI, you will need to install the bluetooth software library, using the commands

```
rpi-rw
sudo aptitude install bluez python-bluetooth

sudo service bluetooth start
sudo service bluetooth status
sudo hciconfig hci0 up
```
###Finding inverter bluetooth address###

Run the command "hcitool scan", which should list the bluetooth devices/addresses it can see.
```
Scanning ...
00:80:25:1D:AC:53 SMA001d SN: 2120051742 SN2120051742
```

##Sample config for emonhub.conf ##

Sample configuration for SMA Solar interface, add these settings under the [interfacers] tag.
```
[[SMASolar]]
Type = EmonHubSMASolarInterfacer
[[[init_settings]]]
inverteraddress= 00:80:25:1D:AC:53
inverterpincode = 0000
timeinverval = 5
nodeid = 29
readdcvalues = 1
[[[runtimesettings]]]
pubchannels = ToEmonCMS,
```

##Settings##

###inverteraddress###
Specify the bluetooth address of the solar inverter for instance 00:80:25:1D:AC:53

###inverterpincode###
Security PIN code, normally defaults to "0000" unless you have changed it.

###timeinverval###
Time in seconds between samples, defaults to 10 seconds

###nodeid###
Starting node id number to assign to inputs into emonCMS, defaults to 29 for the first inverter, 30 for second, 31 for third etc.

Note, you do *NOT* have to manually enter the nodes into the "[nodes]" section of the config file.

###readdcvalues###
Some inverters don't support reading of DC values, configure this to zero to skip requesting this information
17 changes: 17 additions & 0 deletions conf/interfacer_examples/smasolar/smasolar.emonhub.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#######################################################################
####################### emonhub.conf #########################
#######################################################################

[interfacers]

### This interfacer manages connections for EmonHubSMASolarInterfacer
[[SMASolar]]
Type = EmonHubSMASolarInterfacer
[[[init_settings]]]
inverteraddress= 00:80:25:1D:AC:53
inverterpincode = 0000
timeinverval = 5
nodeid = 29
readdcvalues = 1
[[[runtimesettings]]]
pubchannels = ToEmonCMS,
24 changes: 19 additions & 5 deletions src/emonhub.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
except ImportError:
pymodbus_found = False

try:
import bluetooth
bluetooth_found = True
except ImportError:
bluetooth_found = False


import emonhub_setup as ehs
import interfacers.emonhub_interfacer as ehi
import emonhub_coder as ehc
Expand All @@ -36,10 +43,13 @@
import interfacers.EmonHubSmilicsInterfacer
import interfacers.EmonHubVEDirectInterfacer
import interfacers.EmonHubGraphiteInterfacer
if pymodbus_found:
import interfacers.EmonModbusTcpInterfacer
import interfacers.EmonFroniusModbusTcpInterfacer

if bluetooth:
import interfacers.EmonHubSMASolarInterfacer

if pymodbus_found:
import interfacers.EmonModbusTcpInterfacer
import interfacers.EmonFroniusModbusTcpInterfacer

ehi.EmonHubSerialInterfacer = interfacers.EmonHubSerialInterfacer.EmonHubSerialInterfacer
ehi.EmonHubJeeInterfacer = interfacers.EmonHubJeeInterfacer.EmonHubJeeInterfacer
Expand All @@ -51,9 +61,13 @@
ehi.EmonHubSmilicsInterfacer = interfacers.EmonHubSmilicsInterfacer.EmonHubSmilicsInterfacer
ehi.EmonHubVEDirectInterfacer = interfacers.EmonHubVEDirectInterfacer.EmonHubVEDirectInterfacer
ehi.EmonHubGraphiteInterfacer = interfacers.EmonHubGraphiteInterfacer.EmonHubGraphiteInterfacer

if bluetooth:
ehi.EmonHubSMASolarInterfacer = interfacers.EmonHubSMASolarInterfacer.EmonHubSMASolarInterfacer

if pymodbus_found:
ehi.EmonModbusTcpInterfacer = interfacers.EmonModbusTcpInterfacer.EmonModbusTcpInterfacer
ehi.EmonFroniusModbusTcpInterfacer = interfacers.EmonFroniusModbusTcpInterfacer.EmonFroniusModbusTcpInterfacer
ehi.EmonModbusTcpInterfacer = interfacers.EmonModbusTcpInterfacer.EmonModbusTcpInterfacer
ehi.EmonFroniusModbusTcpInterfacer = interfacers.EmonFroniusModbusTcpInterfacer.EmonFroniusModbusTcpInterfacer

"""class EmonHub

Expand Down
Loading