Code: Select all
##!/bin/bash
sunspec_ardexa discover 192.168.0.18 1 > /var/tmp/sunspec.log 2>/var/tmp/sunspec-err.log
Moderator: leecollings
Code: Select all
##!/bin/bash
sunspec_ardexa discover 192.168.0.18 1 > /var/tmp/sunspec.log 2>/var/tmp/sunspec-err.log
I'm always interested in a nice scriptfreijn wrote: ↑Thursday 27 February 2020 19:39 Many thanks guys !!!
I have update the inital post with your suggestions.
Besides the crontab..
I fire the script on the update event of my P1. In that same script I collect my Solar and then substract of add the values in order
to calculate the house power consumption.
If you are interested I can share my messy lua script.....
Bart,
Hello Frank,freijn wrote: ↑Thursday 27 February 2020 19:39 Many thanks guys !!!
I have update the inital post with your suggestions.
Besides the crontab..
I fire the script on the update event of my P1. In that same script I collect my Solar and then substract of add the values in order
to calculate the house power consumption.
If you are interested I can share my messy lua script.....
Code: Select all
----------------------------------------------------------------------------------------------------------
-- Script parameters
----------------------------------------------------------------------------------------------------------
Debug = "NO" -- Turn debugging on ("YES") or off ("NO")
----------------------------------------------------------------------------------------------------------
-- Grid Power calculation GridPower - Solar Power and store in Sensor
----------------------------------------------------------------------------------------------------------
local solarflag
local var5
local var6
local powercount
local consume
local oldpowerconsume
commandArray = {}
powersensor = "Power"
if (devicechanged[powersensor]) then
if Debug=="YES" then
print( " ####Power debug device changed: "..devicechanged[powersensor])
end
#zon_success=os.execute("sudo /usr/bin/perl /home/pi/sunspec-monitor-master/domosun.pl -z -m 0 -p 502 192.168.1.140 &")
zon_success=os.execute("sudo /usr/local/bin/sunspec_ardexa discover 192.168.1.140 1 > /dev/null 2>&1 &")
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
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
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
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
ttidx = otherdevices_idx['PowerConsumption']
commandArray['UpdateDevice'] = ttidx..'|0|'..consume
end
return commandArray
Hi Jos,
Jos, have you played with the json create sensor already ?
Code: Select all
zon_success=os.execute("sudo /usr/local/bin/sunspec_ardexa discover 192.168.1.140 1 > /dev/null 2>&1 &")
And what about this? :
but would this get closer to calculate values you think?"3 traps raket"
Users browsing this forum: No registered users and 1 guest