Page 1 of 1

Enphase

Posted: Saturday 26 September 2015 17:19
by groetg
Is it possible to let Domoticz read Enphase solar data (just like Solar Edge?), or do I need to use

Re: Enphase

Posted: Sunday 27 September 2015 8:50
by gizmocuz
I think this could get you started:

https://github.com/gouldner/ST-Projects ... ten.groovy

Re: Enphase

Posted: Sunday 27 September 2015 12:02
by KoenVanduffel
Hi,

The above solution takes it from the Enphase servers.
I wrote a bash script to get the day values off my Enphase gateway. The second half of the script also calculates the actual total power consumption and daily total. (I made a quick update turning variables into English and a few cosmetic things. hope i didn't make an error, a quick test worked fine)

Code: Select all

#!/bin/bash
# bash script to read current and actual day power from Enphase gateway
# second part caluclates the actual total power consumption and day consumption for the whole house
# V1.3 27/09/2015
# By Koen Vanduffel

# variables
solar_idx="57"
electricitydaily_idx="58"
enphase_IP="192.168.1.143"

# Read Enphase status page and store as of Currently
DATA=`wget -q -O - $enphase_IP/production | awk '/Currently/{print $0}'`

# Extract current and currentunits, power and powerunits reported
CURRENT=`echo $DATA | awk '/Currently/{print $3}'`
CURRENTUNIT=`echo $DATA | awk '/Currently/{print substr ($4, 1, 1)}'`
kWh=`echo $DATA | awk '/Currently/{print $6}'`
kWhUNIT=`echo $DATA | awk '/Currently/{print substr ($7, 1, 1)}'`

echo $CURRENT
echo $CURRENTUNIT
echo $kWh
echo $kWhUNIT

# convert to Watt and Wh if needed
if [ "$CURRENTUNIT" == "k" ]; then
CURRENT=`awk "BEGIN {print $CURRENT * 1000}"`
fi
if [ "$kWhUNIT" == "k" ]; then
kWh=`awk "BEGIN {print $kWh * 1000}"`
fi

echo $CURRENT
echo $kWh

# Execute curl command to post current and power to Domoticz
curl -i -H "Accept: application/json" "http://localhost:8080/json.htm?type=command&param=udevice&idx=$solar_idx&nvalue=0&svalue=$CURRENT;$kWh"

# part 2:
# now calculate the total power consumed

# get actual consumption from P1 meter reading in Domoticz and return data
# there might be an easier way than to awk is from the json output
DATA=`wget -q -O - '192.168.1.9:8080/json.htm?type=devices&rid=12' | awk '/CounterDelivToday/{print $3}'`
CURRENTRETURNTODAY=`echo $DATA | awk -F, '{gsub(/"/,"",$1); print $1}'`
DATA=`wget -q -O - '192.168.1.9:8080/json.htm?type=devices&rid=12' | awk '/CounterToday/{print $3}'`
CURRENTUSAGETODAY=`echo $DATA | awk -F,  '{gsub(/"/,"",$1); print $1}'`
echo $CURRENTUSAGETODAY
echo $CURRENTRETURNTODAY
TOTALCONSUMPTION=$(python -c "print $CURRENTUSAGETODAY*1000-$CURRENTRETURNTODAY*1000+$kWh")
echo $TOTALCONSUMPTION
# when 5 min around midnight post a zero otherwise Domoticz gets confused with not restarting at zero at 0:00 hours
# probably an imporvement is possible by continuing to calculate the total power long term
time=`date +%k%M` ;
if [ $time -gt 2355 ] || [ 6 -gt $time ]
then
TOTALCONSUMPTION=0
fi
echo $time
echo $TOTALCONSUMPTION

# now do the same for current
DATA=`wget -q -O - '192.168.1.9:8080/json.htm?type=devices&rid=12' | awk '/Usage/{print $3}'`
CURRENTUSAGE=`echo $DATA | awk '{print substr ($1, 2, 4)}'`
CURRENTRETURN=`echo $DATA | awk '{print substr ($2, 2, 4)}'`
echo $CURRENTUSAGE
echo $CURRENTRETURN
TOTALCURRENT=$(python -c "print $CURRENTUSAGE-$CURRENTRETURN+$CURRENT")
echo $TOTALCURRENT

# Execute curl command to post total electricity consumption today
curl -i -H "Accept: application/json" "http://localhost:8080/json.htm?type=command&param=udevice&idx=$electricitydaily_idx&nvalue=0&svalue=$TOTALCURRENT;$TOTALCONSUMPTION"


Re: Enphase

Posted: Tuesday 16 February 2016 19:39
by groetg
Sorry for the late reply, but how do I get these Enphase data in Domoticz?

There is a API program, maybe it could be implemented in Domoticz just like solaregdge support?

https://developer.enphase.com/docs/quickstart.html

Re: Enphase

Posted: Wednesday 17 February 2016 20:11
by KoenVanduffel
I basically do the same as in this wiki page: https://www.domoticz.com/wiki/Monitor_memory_usage

make the virtual sensors in Domoticz and note their idx

Make the basch script using your idx numbers for the variables and the local ip address of your enphase gateway and make the script executable.
setup cron to execute the script every 5 min

that should be it.

My script does not take the data from the enphase servers but direct from the local gateway

Re: Enphase

Posted: Saturday 22 October 2016 10:40
by Machielw
not working anymore?

this is working well:

http://www.domoticz.com/forum/viewtopic ... ase#p99980

Re: Enphase

Posted: Saturday 15 September 2018 12:56
by Jumper3126
Used the script of Koen van Duffel to read out the production of each panel

see http://www.domoticz.com/forum/viewtopic ... 62#p191562

Re: Enphase

Posted: Tuesday 02 April 2019 20:09
by smaus
There is a possibillity to add a Enphase hardware item in Dotmoticz, what remote address and port number do i fill in?
enphase1.jpg
enphase1.jpg (156.58 KiB) Viewed 3121 times

Re: Enphase

Posted: Tuesday 02 April 2019 20:40
by Dlanor
smaus wrote:There is a possibillity to add a Enphase hardware item in Dotmoticz, what remote address and port number do i fill in?
enphase1.jpg
Mine is connected to my local lan.

Image

Re: Enphase

Posted: Wednesday 03 April 2019 16:14
by smaus
oke but i dont see any enphase, but in my log is standing EnphaseAPI: Invalid data received!