SMA Solar PV Inverters - monitoring over bluetooth

Hi.

I’ve updated my SMA inverter monitoring code to work with the latest versions of emonCMS.

It runs on the PI and posts values into emonCMS over HTTP/HTTPS every few seconds. All that is needed is a USB bluetooth adapter on the PI - I’ve not tested the PI3 with built in bluetooth however I believe OEM disables this on the build.

Please reply to this thread if you are interested in such an interface, and I’ll have a go at integrating it into the emonCMS web interface to make setup easy.

Thanks, Stu.

2 Likes

Hi Stu
That sounds fantastic! Id love to have a go, does it work for two inverters?

Regards
Dave

Not yet, but should be simple enough to do!

1 Like

Dave - I think to monitor two inverters you would need to bluetooth usb devices on the PI - is this something you could do?

Class 1 devices are best as these have 100m range.

Hi Stu
I believe the two inverters communicate with each other as I can connect to the one inverter using the sunny program and view both inverters, I know when setting them up I set them up with the same Bluetooth ID.
But yeh I can whack a Bluetooth module in the Pi.

Regards
Dave

Okay, I remember seeing somebody else mention that. The inverters form their own bluetooth mesh and you can then remotely manage them through a single connection - designed for large scale solar farms I suspect.

I’ve no idea if the code will run, but I’ll sort out some instructions on what to do.

Yes please!

I’m interested in this too, for 2x Sunny Boys :+1:

Hello, I’ve finally got this working properly.

I don’t have two inverters, so I can’t test it against that at the moment, but happy to assist with debugging.

I’ve written a brand new module for emonhub - GitHub - stuartpittaway/emonhub: Python service linking and decoding input to MQTT & Emoncms

I’m waiting to see if the emon master branch will be updated with my changes. Install documentation is located here… emonhub/conf/interfacer_examples/smasolar at emon-pi · stuartpittaway/emonhub · GitHub

Once running, the code will push into emonCMS (defaults to node 29) the values from the inverter every 5-10 seconds. It also sets the “node name” in emonCMS to be the same as the SMA inverters name (defaults to serial number).

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

Not quite getting there with my SMA inverter (installed 2011).

‘hcitool scan’ looks good:
00:80:25:19:58:0C SMA004d SN: 2001781110 SN2001781110

and hciconfig says hci0 is UP RUNNING.

Errors every 5 sec when running the new emonhub:

2017-03-12 15:27:38,703 INFO SMASolar Log into the SMA solar inverter 00:80:25:1D:AC:53
2017-03-12 15:27:38,704 INFO SMASolar Opening bluetooth address 00:80:25:1D:AC:53
2017-03-12 15:27:43,884 ERROR SMASolar (112, ‘Host is down’)
2017-03-12 15:27:43,885 ERROR SMASolar Bluetooth error while connecting to 00:80:25:1D:AC:53
2017-03-12 15:27:44,797 INFO SMASolar Log into the SMA solar inverter 00:80:25:1D:AC:53

Maybe the inverter is too old for this code? Works with its own Sunny Beam (which was turned off for this test).

Oops, somehow the SMA address changed while I was following those steps!

Now getting further …

2017-03-12 15:40:28,588 INFO MainThread Creating EmonHubSMASolarInterfacer ‘SMASolar’
2017-03-12 15:40:30,013 INFO MainThread Reading from SMASolar every 5 seconds
2017-03-12 15:40:30,015 DEBUG MainThread Setting SMASolar pubchannels: [‘ToEmonCMS’]
2017-03-12 15:40:34,857 ERROR SMASolar list index out of range
2017-03-12 15:40:40,708 INFO SMASolar Log into the SMA solar inverter 00:80:25:19:58:0C
2017-03-12 15:40:40,709 INFO SMASolar Opening bluetooth address 00:80:25:19:58:0C
2017-03-12 15:40:41,564 INFO SMASolar Connected to SMA inverter named [SN: 2001781110] with serial number [2001781110] using NodeId=29 and name=SN2001781110
2017-03-12 15:40:41,772 ERROR SMASolar list index out of range

And no new node seen in Emoncms → Inputs.

It’s trying to connect to a different Bluetooth address. Did you change the
emonhub configuration

Great, tell me more about the inverter, model etc.

Have you changed the pin code from 0000?

Debugging time!

Stuart, sorry for delay.

It’s a Sunny Boy SB 3000, made in October 2010. PIN hasn’t been changed (to confirm, I checked that the System Password setting on the Sunny Beam display is 0000).

Thanks Steve. I’m using a SB3000HF - from about 2011.

From the logs you have shown, it appears the code is correctly logging into the inverter, but erroring when reading the values from the inverter.

I’ve just updated the github code with some additonal logging code - can you try this version.

Please make sure you set the emonhub logging level to DEBUG - its at the top of the config file.

As an update, the latest version of the code will only output values to emonCMS that your inverter supports.

Please test and feedback!

Hi @stuart, this sounds great!

However, I don’t have a SMA inverter to hand to test.

I’ve just taken a look at your PR, however you seem to have closed it?

Hi @glyn.hudson

I closed the PR as there were some faults in the code which have now been fixed. I could do with some other people on this forum post to try it out before we attempt a PR merge.

@christian @Lykke @Dave any chance you can try the code out?

Hi Stuart
Yes, I’ll give it a try at the weekend as I’m away on a course in Bristol this week.
Did you have a problem with the code when the default pin was chaged?

Regards
Dave