SMA Solar Inverter Plugin

A SMA Solar Inverter Plugin to try out.

This plugin was inspired by crepuscule’s work and SBFspot:

http://forum.micasaverde.com/index.php?topic=23657.0


Ver 0.51

It reports:

[ul][li]Power[/li]
[li]kWh to-day[/li]
[li]kWh all time[/li]
[li]Inverter temperature[/li][/ul]

The plugin can also report to PVOutput.org

Read the attached PDF for install instructions and further details on usage. Bug reports welcome but may not be acted upon. Likewise given that the protocol is not very well understood, I have no plans to expand this plugin.

Ver 0.52
Resolved an issue whereby the ip address was sometimes not found automatically: The plugin does a Multicast at plugin start up to identify the ip address. If this succeeds, the device’s attribute: ‘ip’ (see Advanced Tab) will automatically be populated with that address. However, if the Multicast fails, the user now has the option to manually enter the ip address into the attribute entry box using the User Interface. If the address is manually entered, then the usual Luup engine and browser restarts will be required.

Existing users just need to replace the ‘L_SMA_inverter1.lua’ file.

Ver 0.53

[ul][li]Minor fixes and additions[/li][/ul]

This code is on GitHub here:

You can install the plugin from the ‘Alternate App Store’, which works together with ‘ALTUI’:
http://forum.micasaverde.com/index.php/topic,38102.0.html
Delete any existing ‘SMAinverter’ device before installing from the ‘Alternate App Store’.

Note that ‘ALTUI’ is highly recommended to all users.

Cool! Never knew if anyone actually had use for it, except the one reply :slight_smile:
I will try it out, and let you know.

BTW: why the five minute limit, I poll it every 10seconds or so and have not seen any downside to it.

PVOutput.org won’t take any data quicker than five minutes. Also I saw no need to have “too much” data. My Vera hardly keeps up with all the other stuff it’s doing.

Hi!

I cant get this to work :frowning: I create the new device and it shows up, but it does not read any values. It also shows an error: SMA inverter[206] : Lua Engine Failed to Load

I have a SMA sunnyboy 6. It works fine with SBFspot on windows. My password is not the default 0000 but even when i change my password in your lua file to my password before uploading, it does not work.
Any advise appreciated :slight_smile:

Thanks!
Oliver

Hi,

I’ve also been trying to get this to work, but no luck so far.

I’m using a Sunnyboy 5.0 inverter it’s a newer model, and SBFspot can retrieve data from the inverter. Error log lis below.

06 08/20/16 10:50:16.894 Device_Variable::m_szValue_set device: 440 service: urn:a-lurker-com:serviceId:SMA_inverter1 variable: PluginEnabled was: 1 now: 1 #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:1 <0x31701680> 09 08/20/16 10:51:55.670 JobHandler_LuaUPnP::Run device 440 SMA inverter room 0 type urn:schemas-a-lurker-com:device:SMA_inverter:1 cat 0:-1 id parent 0/0xe39210 upnp: 0 plugin:0 pnp:0 mac: ip: <0x2b4d5000> 06 08/20/16 10:52:32.389 Device_Variable::m_szValue_set device: 440 service: urn:a-lurker-com:serviceId:SMA_inverter1 variable: PVOutputApiKey was: now: #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:1 <0x2be26680> 06 08/20/16 10:52:32.390 Device_Variable::m_szValue_set device: 440 service: urn:a-lurker-com:serviceId:SMA_inverter1 variable: PVOutputSystemID was: now: #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:1 <0x2be26680> 50 08/20/16 10:53:42.332 luup_log:440: SMA_inverter debug: Inverter not found: timeout <0x2edff680> 50 08/20/16 10:53:42.379 luup_log:440: SMA_inverter debug: AppSerial: 906847401 <0x2edff680> 09 08/20/16 11:06:47.605 JobHandler_LuaUPnP::Run device 440 SMA inverter room 0 type urn:schemas-a-lurker-com:device:SMA_inverter:1 cat 0:-1 id parent 0/0xf1a340 upnp: 0 plugin:0 pnp:0 mac: ip:192.168.0.150 <0x2b550000> 06 08/20/16 11:08:07.940 Device_Variable::m_szValue_set device: 440 service: urn:a-lurker-com:serviceId:SMA_inverter1 variable: PVOutputApiKey was: now: #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:1 <0x2bea0680> 06 08/20/16 11:08:07.941 Device_Variable::m_szValue_set device: 440 service: urn:a-lurker-com:serviceId:SMA_inverter1 variable: PVOutputSystemID was: now: #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:1 <0x2bea0680> 09 08/20/16 11:08:32.034 JobHandler_LuaUPnP::Run device 440 SMA inverter room 0 type urn:schemas-a-lurker-com:device:SMA_inverter:1 cat 0:-1 id parent 0/0x99a340 upnp: 0 plugin:0 pnp:0 mac: ip:192.168.0.150 <0x2b709000> 06 08/20/16 11:09:08.877 Device_Variable::m_szValue_set device: 440 service: urn:a-lurker-com:serviceId:SMA_inverter1 variable: PVOutputApiKey was: now: #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:1 <0x2c05a680> 06 08/20/16 11:09:08.878 Device_Variable::m_szValue_set device: 440 service: urn:a-lurker-com:serviceId:SMA_inverter1 variable: PVOutputSystemID was: now: #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:1 <0x2c05a680> 50 08/20/16 11:10:18.384 luup_log:440: SMA_inverter debug: Inverter not found: timeout <0x2f033680> 50 08/20/16 11:10:18.431 luup_log:440: SMA_inverter debug: AppSerial: 959623458 <0x2f033680>

I think my problem lies with the multicast ip discovery. As you can see, the log reports “Inverter not found: timeout” I even tried entering the IP address of my inverter but I have the same error reported.

Anyone have any suggestions?

Thanks!

@bigwhopper - need the log file info to make any diagnosis. The log file can be viewed using the ALTUI or infoviewer plugins.

@momanz - yes looks like the multicast ip discovery is failing. Either the discovery can’t actually discover the inverter or SMA have changed how this works (unlikely). Could be a routing problem. Changing the ip address in the device’s advanced tab won’t do anything as the plugin is not programmed to take any note of it. You can try inserting a code HACK after line 506 in the Lua file - change:

result, message = udp:receivefrom()

to:

result, message = udp:receivefrom() result = 'your_inverter_ip_address' -- HACK

At some stage I should change how this works; so you can enter the ip address manually.

Thanks a-lurker for the quick reply.

It didn’t quite work, until I changed the ipAddress variable to = result.

here’s what I did on the off chance that it can help others

if (result ~= nil) then udp:settimeout(5) result, message = udp:receivefrom() result = "192.168.0.150" --HACK --smaLogBytePackages('Broadcast result', result) if (result == nil) then debug("Inverter not found: "..message) else debug("Inverter IP address: "..message) ipAddress = result --message end end

Cheers,

momanz

@Momanz,

the changes you made work for me too, thanks!

I believe the Multicast has changed. I have tried several applications that need multicast and none of them works. If i can add the IP directly in the same software, it works.
I bet the manufacturer changed or removed Multicast.

Thanks again!

Updated plugin to allow manual ip address entry if needed. See first post.

I realize this is an old post, so I won’t be surprised if I get no reply. I am having a solar system installed that will have 2 SunnyBoy 5 inverters. Will this plugin handle two inverters or how would that be accomplished? Might be able to simply pull the output from the net meter I guess…

First, I’m not sure what models of SMA inverters the plugin will work with. It needs the inverters to be connected via a LAN, not by bluetooth. You should be able to have two copies of the plugin running, each using a different IP address. I haven’t tried that though.

Will be interested in how things work out.

The inverters connect to the LAN by either ethernet or wireless. I wasn’t sure if this was actually still an active plugin or not, but it didn’t hurt to investigate it. I guess I’ll stay in touch and we’ll see what happens…

I can’t get this plugin to install. I’m trying to do it from the alt-app store but it keeps throwing an error. Is there a Vera version of it or just AltUI?

Seems that GitHub changes their arrangements of late , which affects the app store. I still haven’t got it working here on a Vera 3.

http://forum.micasaverde.com/index.php/topic,38102.msg352452.html#msg352452

You can install the plugin manually by downloading the files directly from GitHub and doing a manual install - refer forum as needed. If you have two inverters, I suspect you will need to enter the ip addresses manually to keep them separate.

I downloaded the files and have them installed. Don’t have a live inverter as of now, hoping by Thursday. Is the plugin supposed to prompt me for it or do I have to add it manually somewhere? I noticed in ALTUI, there is a place for it. Not the case in Vera itself that I can see. Also, is there a way to clean up the device display? All the information runs together. I’m playing with it, but I know little about how the D files work. The LUA is a bit clearer, but I’m not playing with that (yet). Also, is there an energy monitor plugin other than ERGY (which I understand has issues)???

I noticed in ALTUI, there is a place for it. Not the case in Vera itself that I can see.
Not sure what the place for it is but at the very bottom of the 1st post there is a PDF file with useful info.
Also, is there a way to clean up the device display? All the information runs together. I'm playing with it, but I know little about how the D files work.
I only use AltUi - the layout of info is specified in the D_SMA_inverter1.json - it's a nightmare to set up due to the lack of clear documentation. Note that the "Device Simulator" in UI7-->Apps-->Develop Apps-->Device Simulator (based on JSON). I've never used it and I've never seen a json file that passes it either, so not much help.

Also, is there an energy monitor plugin other than ERGY (which I understand has issues) Not sure what you are after here but it gets difficult to keep track of all the device that use power. In my case I have one device that reads total power consumption in the meter cabinet.

ERGY appears to be what Vera uses to populate the energy card on the dashboard. Don’t really need it, just wondered if there was another way to use it. I’m going to have to read both inverters and add the data together to get totals. Not difficult once I get the data in. Will be scraping it from Vera for use in an HTML dashboard for the house as well. Have the PDF and looked through it a few times. Will scour it again. Flying blind at the moment without an inverter in the mix, but learning. Thanks for your continued assistance. :slight_smile:

A_Lurker, any chance of getting this set up fairly quick for adding manual addresses? I have two inverters and it’s only reading one of them. Need to be able to enter the addresses manually. Multicast did find the inverter though… :slight_smile:

Ok, multicast did pick up the second inverter after a reboot of the inverter. Not sure how it will react if an inverter goes offline. Don’t get some of the information the plugin offers but I may try to learn how the plugin works and offer fixes…