SolarEdge via LAN interface
Moderators: leecollings, remb0
-
- Posts: 9
- Joined: Saturday 31 August 2019 11:34
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: SolarEdge via LAN interface
To make the script work you have to install several PERL modules:
Net::Server
Role::Tiny
Try::Tiny
Device::Modbus::TCP::Client
LWP::Simple
To do this type:
$ sudo perl -MCPAN -e shell
And then
cpan[1]> install <module name>
Repeat this for all the other modules
The last one (LWP::Simple) takes some more time. Be patient.
cpan [6]> exit
The script should work now. I downloaded it and called it: SolarEdge.pl
Try:
$ perl SolarEdge.pl
A help text should be displayed.
For Domoticz you have to create several dummy devices. For more info see the script.
Net::Server
Role::Tiny
Try::Tiny
Device::Modbus::TCP::Client
LWP::Simple
To do this type:
$ sudo perl -MCPAN -e shell
And then
cpan[1]> install <module name>
Repeat this for all the other modules
The last one (LWP::Simple) takes some more time. Be patient.
cpan [6]> exit
The script should work now. I downloaded it and called it: SolarEdge.pl
Try:
$ perl SolarEdge.pl
A help text should be displayed.
For Domoticz you have to create several dummy devices. For more info see the script.
- Attachments
-
- SolarEdge.txt
- (22.9 KiB) Downloaded 334 times
-
- Posts: 16
- Joined: Saturday 30 March 2019 20:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9
- Location: Beesd, The Netherlands
- Contact:
Re: SolarEdge via LAN interface
I have tried the above instructions to install the SolarEdge via Lan but I can't get this to work. Do I also need the Sunspec-monitor from github installed?
-
- Posts: 536
- Joined: Friday 23 December 2016 16:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: Netherlands Purmerend
- Contact:
Re: SolarEdge via LAN interface
What bit is not working??
-
- Posts: 16
- Joined: Saturday 30 March 2019 20:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9
- Location: Beesd, The Netherlands
- Contact:
Re: SolarEdge via LAN interface
I have followed the steps in the post above and install the dependency's. But do I need to use the script, and how do I need to install this script (i'm noob)
Or do I use the in Domoticz under Hardware the " solaredge via Lan interface"
Or do I use the in Domoticz under Hardware the " solaredge via Lan interface"
-
- Posts: 9
- Joined: Saturday 31 August 2019 11:34
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: SolarEdge via LAN interface
You do not need to Add Hardware in Domoticz.
First you have to enable de TCPModbus interface on your SolarEdge inverter. How to do that depends on the type of SolarEdge inverter you have.
Then you need to download the script and rename it to SolarEdge.pl
Then type: perl SolarEdge.pl If correct you will see a help text, about parameters you need to connect to your inverter.
If you can connect to your inverter and get values out of it, then open the script and follow the instructions.
Then following the instructions, create the dummy devices and add their IDX numbers in the script.
Then run the script again adding the -z parameter. The dummy devices in Domoticz should now contain values.
If that is working then you can schedule the script using Crontab or from within Domoticz using Events.
If you do not understand the above instructions, then you should famliarize yourself some more with Domoticz and scripts. Searching this forum will help you a lot.
First you have to enable de TCPModbus interface on your SolarEdge inverter. How to do that depends on the type of SolarEdge inverter you have.
Then you need to download the script and rename it to SolarEdge.pl
Then type: perl SolarEdge.pl If correct you will see a help text, about parameters you need to connect to your inverter.
If you can connect to your inverter and get values out of it, then open the script and follow the instructions.
Then following the instructions, create the dummy devices and add their IDX numbers in the script.
Then run the script again adding the -z parameter. The dummy devices in Domoticz should now contain values.
If that is working then you can schedule the script using Crontab or from within Domoticz using Events.
If you do not understand the above instructions, then you should famliarize yourself some more with Domoticz and scripts. Searching this forum will help you a lot.
Last edited by Jackb on Saturday 07 March 2020 12:59, edited 2 times in total.
-
- Posts: 16
- Joined: Saturday 30 March 2019 20:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9
- Location: Beesd, The Netherlands
- Contact:
Re: SolarEdge via LAN interface
Thanks Jackb I got the connection with the Solar edge working and all values in Domoticz. Now waiting until the sun starts shining again so I get some production data in Domoticz.Jackb wrote: ↑Sunday 15 September 2019 19:06 You do not need to Add Hardware in Domoticz.
First you have to enable de TCPModbus interface on your SolarEdge inverter. How to do that depends on the type of SolarEdge inverter you have.
Then you need to download the script and rename is to SolarEdge.pl
Then type: perl SolarEdge.pl If correct you will see a help text, about parameters you need to connect to your inverter.
If you can connect to your inverter and get values out of it the open the script and follow the instructions.
Then following the instructions, create the dummy devices and add their IDX numbers in the script.
Then run the script again adding the -z parameter. The dummy devices in Domoticz should now contain values.
If that is working then you can schedule the script using Crontab or from within Domoticz using Events.
If you do not understand the above instructions, then you should famliarize yourself some more with Domoticz and scripts. Searching this forum will help you a lot.
-
- Posts: 43
- Joined: Tuesday 27 May 2014 10:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2.4xxx
- Location: Sweden
- Contact:
Re: SolarEdge via LAN interface
Thanks!!!
Just tried the script, works great.
Just tried the script, works great.
-
- Posts: 5
- Joined: Wednesday 09 October 2019 14:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Location: Woerden, Netherlands
- Contact:
Re: SolarEdge via LAN interface
Thank you all for the instructions and script!
I am an absolute beginner with modbus and perl scripts, but the system was working quickly.
Is there a reason why you should run the script with crontab? In my system the script is executed with DzEvents, using the command os.execute('perl etc etc'). The domoticz sensors update every 10 seconds.
Greetings,
Eric
I am an absolute beginner with modbus and perl scripts, but the system was working quickly.
Is there a reason why you should run the script with crontab? In my system the script is executed with DzEvents, using the command os.execute('perl etc etc'). The domoticz sensors update every 10 seconds.
Greetings,
Eric
- McMelloW
- Posts: 427
- Joined: Monday 20 November 2017 17:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V2024.1
- Location: Harderwijk, NL
- Contact:
Re: SolarEdge via LAN interface
No need at all. See my code below, it is just in my dzVents script on my timing and use it every minute.
Code: Select all
on = {
timer = { 'every minute between 15 minutes before sunrise and 15 minutes after sunset' }
},
execute = function(domoticz, device)
domoticz.utils.osExecute('perl /home/pi/Public/sunspec-mon -n -m o 192.168.999.999 > /tmp/SEoutput.txt')
Greetings McMelloW
-
- Posts: 536
- Joined: Friday 23 December 2016 16:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: Netherlands Purmerend
- Contact:
Re: SolarEdge via LAN interface
There is a reason.
if something happens on the network and the script is not able to reach the SolarEdge the script might take longer.
This longer will hold-up all scripts executed after.
It does appear in the log's like "bla bla script takes longer than expected to finish"
Result might be that the next script does miss an important status from a sensor.. !! MIGHT !!
Starting it via cron makes sure its exe'ed independent of the events being exe under domoticz.
The events are a chain of scripts exe sequentially.
Question:
Do you have a smart meter P1 ? I trigger the solar script when the new P1 values have arrived.
At that moment I run the Solar script and at the end I do a P1 + or - Solar = House power consumed.
More fun !
Hope the above makes sense to you...
Frank
if something happens on the network and the script is not able to reach the SolarEdge the script might take longer.
This longer will hold-up all scripts executed after.
It does appear in the log's like "bla bla script takes longer than expected to finish"
Result might be that the next script does miss an important status from a sensor.. !! MIGHT !!
Starting it via cron makes sure its exe'ed independent of the events being exe under domoticz.
The events are a chain of scripts exe sequentially.
Question:
Do you have a smart meter P1 ? I trigger the solar script when the new P1 values have arrived.
At that moment I run the Solar script and at the end I do a P1 + or - Solar = House power consumed.
More fun !
Hope the above makes sense to you...
Frank
-
- Posts: 9
- Joined: Saturday 31 August 2019 11:34
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: SolarEdge via LAN interface
That is exactly the reason I use crontab to run the script.freijn wrote: ↑Wednesday 09 October 2019 22:06 There is a reason.
if something happens on the network and the script is not able to reach the SolarEdge the script might take longer.
This longer will hold-up all scripts executed after.
It does appear in the log's like "bla bla script takes longer than expected to finish"
Result might be that the next script does miss an important status from a sensor.. !! MIGHT !!
Starting it via cron makes sure its exe'ed independent of the events being exe under domoticz.
The events are a chain of scripts exe sequentially.
Question:
Do you have a smart meter P1 ? I trigger the solar script when the new P1 values have arrived.
At that moment I run the Solar script and at the end I do a P1 + or - Solar = House power consumed.
More fun !
Hope the above makes sense to you...
Frank
- McMelloW
- Posts: 427
- Joined: Monday 20 November 2017 17:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V2024.1
- Location: Harderwijk, NL
- Contact:
Re: SolarEdge via LAN interface
Frank & Jackbfreijn wrote: ↑Wednesday 09 October 2019 22:06 There is a reason.
if something happens on the network and the script is not able to reach the SolarEdge the script might take longer.
This longer will hold-up all scripts executed after.
It does appear in the log's like "bla bla script takes longer than expected to finish"
Thanks for your addition.
In my system I have had only once this error message. After I change something in the script, it never appeared again.
My script is running fine so far.
Greetings McMelloW
-
- Posts: 5
- Joined: Wednesday 09 October 2019 14:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Location: Woerden, Netherlands
- Contact:
Re: SolarEdge via LAN interface
Yes I have a P1 meter connected. So I can see the delivery and my production. Thanks for the suggestion, I think I have to learn some more about scripting and DZ-events.freijn wrote: ↑Wednesday 09 October 2019 22:06 There is a reason.
if something happens on the network and the script is not able to reach the SolarEdge the script might take longer.
This longer will hold-up all scripts executed after.
It does appear in the log's like "bla bla script takes longer than expected to finish"
Result might be that the next script does miss an important status from a sensor.. !! MIGHT !!
Starting it via cron makes sure its exe'ed independent of the events being exe under domoticz.
The events are a chain of scripts exe sequentially.
Question:
Do you have a smart meter P1 ? I trigger the solar script when the new P1 values have arrived.
At that moment I run the Solar script and at the end I do a P1 + or - Solar = House power consumed.
More fun !
Hope the above makes sense to you...
Frank
There is always More to Explore!
Eric
ps, Thanks McMellow for your script.
-
- Posts: 536
- Joined: Friday 23 December 2016 16:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: Netherlands Purmerend
- Contact:
Re: SolarEdge via LAN interface
Eric,
if you are interested I can share my consume calculations script ( triggered by the P1)
if you are interested I can share my consume calculations script ( triggered by the P1)
-
- Posts: 5
- Joined: Wednesday 09 October 2019 14:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Location: Woerden, Netherlands
- Contact:
Re: SolarEdge via LAN interface
That would be nice Frank!
I feel a bit like Alice, and it would help me to explore the rabbithole.
Thanks in advance,
Eric
I feel a bit like Alice, and it would help me to explore the rabbithole.
Thanks in advance,
Eric
-
- Posts: 536
- Joined: Friday 23 December 2016 16:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: Netherlands Purmerend
- Contact:
Re: SolarEdge via LAN interface
Eric
The lua code I execute when the device update happens. In this case the P1 sensor is the trigger.
You have to create a custom power sensor 'PowerConsumption' where calculated value is shown.
P1 triggers the script. Script grabs solar values. Depending of amount of Sun we are delivering to grid or getting from grid
so : solar - P1 = consume or solar + P1 = consume.
The calculated value is then written to the aditional energy sensor.
Please mind, Script was not written with the intention to share so a bit messy....sorry
I hope it has enough comments to get you started. You need to rename the sensors to match your environment.
If nothing works, use the debug switch to understand the output and results.
Hope there is enough Sun this weekend to get you testing
Any questions, please let me know.
The lua code I execute when the device update happens. In this case the P1 sensor is the trigger.
You have to create a custom power sensor 'PowerConsumption' where calculated value is shown.
P1 triggers the script. Script grabs solar values. Depending of amount of Sun we are delivering to grid or getting from grid
so : solar - P1 = consume or solar + P1 = consume.
The calculated value is then written to the aditional energy sensor.
Please mind, Script was not written with the intention to share so a bit messy....sorry
I hope it has enough comments to get you started. You need to rename the sensors to match your environment.
If nothing works, use the debug switch to understand the output and results.
Hope there is enough Sun this weekend to get you testing
Any questions, please let me know.
Code: Select all
----------------------------------------------------------------------------------------------------------
Debug = "NO" -- Turn debugging on ("YES") or off ("NO")
----------------------------------------------------------------------------------------------------------
-- Grid Power calculation GridPower +/- Solar Power
----------------------------------------------------------------------------------------------------------
local solarflag
local var5
local var6
local powercount
local consume
local oldpowerconsume
commandArray = {}
-- The P1 sensor name
powersensor = "Power"
if (devicechanged[powersensor]) then
-- grab the latest solar values
zon_success=os.execute('perl /home/pi/sunspec-monitor-master/domosun.pl -z -m 0 -p 502 192.168.1.140 &')
if Debug=="YES" then
print( " ####Power debug device changed: "..devicechanged[powersensor])
end
commandArray['Variable:TEST']=tostring(devicechanged[powersensor])
var1,var2,var3,var4,var5,var6 = string.match(otherdevices_svalues['Power'], "(%d+%.*%d*);(%d+%.*%d*);(%d+%.*%d*);(%d+%.*%d*);(%d+%.*%d*);(%d+%.*%d*)")
if Debug=="YES" then
print( " ####Power debug var5: "..var5)
print( " ####Power debug var6: "..var6)
end
solarflag="0"
if (var5 == "0") then
-- solar is feeding the grid
powercount = tonumber(var6)
solarflag="1"
else
-- not enough solar power , so taken from grid
powercount = tonumber(var5)
end
if Debug=="YES" then
print( " ####Powercount after solarflag: "..powercount)
print( " ####solarflag: "..solarflag)
end
commandArray['Variable:GridPowerVar']= tostring (powercount)
commandArray['Variable:SolarPowerFlag']= solarflag
-- store value in variable for later use in other scpt
--commandArray['Variable:GridPowerVar']= tostring(powercount)
-- testing stuff
--commandArray['Variable:SolarPowerVar']= tostring (1100)
--solarflag =1
-- get solar power from var and make number
--commandArray['Variable:SolarPowerVar']= "12"
-- print ( "solarwaarde "..commandArray['Variable:SolarPowerVar'])
-- for i, v in pairs(otherdevices) do print(i, v) end
--solarsensor = "SolarEdge kWh"
solarsensor = "SolarEdge Power Kwh"
Solarvar1, var2 = string.match(otherdevices_svalues[solarsensor], "(%d+%.*%d*);(%d+%.*%d*)")
Sol = tostring (Solarvar1)
-- solarcount = commandArray['Variable:SolarPowerVar']
if Debug=="YES" then
print("####solarcount read from Var : "..Sol)
end
-- depending on Solar power we are running from Solar only or need grid power
if ( solarflag == "1") then
consume = Solarvar1 - powercount
else
consume = Solarvar1 + powercount
end
if Debug=="YES" then
print( " ####solarcount : "..Solarvar1)
print( " ####powercount : "..powercount)
print( " ####solarflag : "..solarflag)
print( " ####consume : "..consume)
end
-- the new sensor to show house consumption
ttidx = otherdevices_idx['PowerConsumption']
commandArray['UpdateDevice'] = ttidx..'|0|'..consume
-- Log power usage into file
--year = tonumber(os.date("%Y"));
--month = tonumber(os.date("%m"));
--day = tonumber(os.date("%d"));
--hour = tonumber(os.date("%H"));
--min = tonumber(os.date("%M"));
--powerdiff = (tonumber(uservariables['oldpowerconsume'])) - consume
-- print( " ####oldpowerconsume : "..oldpowerconsume)
--if powerdiff > 3 or powerdiff < -3 then
-- write consumer output file
-- file = io.open("consumedpower.txt", "a")
-- Opens a file named sensor.txt(stored under Domoticz folder)
-- in append mode
--write to opened file
-- file:write(os.date()..";"..consume..";"..powerdiff.."\n")
-- file:close() --closes the open file
--end
commandArray['Variable:oldpowerconsume'] = tostring(consume)
end
return commandArray
-
- Posts: 62
- Joined: Monday 28 August 2017 16:44
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: SolarEdge via LAN interface
I found sunspec_ardexa
It ia a python script and is working much faster then the pearl script
https://pypi.org/project/sunspec-ardexa/
And you dont need to install much librarys for it
Output is
It ia a python script and is working much faster then the pearl script
https://pypi.org/project/sunspec-ardexa/
And you dont need to install much librarys for it
$ sunspec_ardexa discover 192.168.102.41 1
Output is
Name: common Sunspec Id: 1 Label: Common
Manufacturer (Mn) SolarEdge
Model (Md) SE4000
Version (Vr) 0003.2221
Serial Number (SN) 73133F27
Device Address (DA) 1
Name: inverter Sunspec Id: 101 Label: Inverter (Single Phase)
Amps (A) 1.74 A
Amps PhaseA (AphA) 1.74 A
Phase Voltage AB (PPVphAB) 236.0 V
Watts (W) 383.1 W
Hz (Hz) 50.02 Hz
VA (VA) 412.5 VA
VAr (VAr) 152.88 var
PF (PF) 92.87 Pct
WattHours (WH) 9371992 Wh
DC Amps (DCA) 1.0329 A
DC Voltage (DCV) 376.5 V
DC Watts (DCW) 388.9 W
Heat Sink Temperature (TmpSnk) 41.79 C
Operating State (St) MPPT
Vendor Operating State (StVnd) 0
Vendor Event Bitfield 1 (EvtVnd1) 1
Vendor Event Bitfield 4 (EvtVnd4) 0
- McMelloW
- Posts: 427
- Joined: Monday 20 November 2017 17:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V2024.1
- Location: Harderwijk, NL
- Contact:
Re: SolarEdge via LAN interface
@micha123
Thanks for the tip. It looks great and it is much easier and faster to install then the perl script. It works OK with a TCP LAN configuration
Here is the output of my first test.
Thanks for the tip. It looks great and it is much easier and faster to install then the perl script. It works OK with a TCP LAN configuration
Here is the output of my first test.
Code: Select all
Name: common Sunspec Id: 1 Label: Common
Manufacturer (Mn) SolarEdge
Model (Md) SE3500
Version (Vr) 0003.2186
Serial Number (SN) 1234ABCDE
Device Address (DA) 1
Name: inverter Sunspec Id: 101 Label: Inverter (Single Phase)
Amps (A) 0.0 A
Amps PhaseA (AphA) 0.0 A
Phase Voltage AB (PPVphAB) 232.7 V
Watts (W) 0 W
Hz (Hz) 49.98 Hz
VA (VA) 0 VA
VAr (VAr) 0 var
PF (PF) 100.0 Pct
WattHours (WH) 7020349 Wh
DC Amps (DCA) 0 A
DC Voltage (DCV) 0.5 V
DC Watts (DCW) 0 W
Heat Sink Temperature (TmpSnk) 32.26 C
Operating State (St) Sleeping
Vendor Operating State (StVnd) 0
Vendor Event Bitfield 1 (EvtVnd1) 1
Vendor Event Bitfield 4 (EvtVnd4) 0
Greetings McMelloW
-
- Posts: 536
- Joined: Friday 23 December 2016 16:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: Netherlands Purmerend
- Contact:
Re: SolarEdge via LAN interface
Very interesting indeed. Will try to install as well and perhaps optimize the script in order to sent the sensor info to Domoticz.
Thanks!
Thanks!
Who is online
Users browsing this forum: Google [Bot] and 1 guest