Enphase

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.
Post Reply
User avatar
groetg
Posts: 142
Joined: Tuesday 06 January 2015 21:41
Target OS: Raspberry Pi
Domoticz version: V2.4025
Location: Heerhugowaard, Holland
Contact:

Enphase

Post by groetg » Saturday 26 September 2015 17:19

Is it possible to let Domoticz read Enphase solar data (just like Solar Edge?), or do I need to use
Master: RPI Model 2B
Sub 1: RPI Model 2B
RFX transmitter/receiver 433 Mhz
13 KAKU units (3 window sensors, 1 door sensor, 7 light switches, 1 dusk sensor, 1 motion sensor)
4 IP cam
Meteostick
OTGW
P1 cable
Davis Vantage Pro weatherstation (incl. solar/UV)

User avatar
gizmocuz
Posts: 8677
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

Re: Enphase

Post by gizmocuz » Sunday 27 September 2015 8:50

I think this could get you started:

https://github.com/gouldner/ST-Projects ... ten.groovy
Quality outlives Quantity!

KoenVanduffel
Posts: 8
Joined: Saturday 14 February 2015 15:50
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Enphase

Post by KoenVanduffel » Sunday 27 September 2015 12:02

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"


User avatar
groetg
Posts: 142
Joined: Tuesday 06 January 2015 21:41
Target OS: Raspberry Pi
Domoticz version: V2.4025
Location: Heerhugowaard, Holland
Contact:

Re: Enphase

Post by groetg » Tuesday 16 February 2016 20:39

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
Master: RPI Model 2B
Sub 1: RPI Model 2B
RFX transmitter/receiver 433 Mhz
13 KAKU units (3 window sensors, 1 door sensor, 7 light switches, 1 dusk sensor, 1 motion sensor)
4 IP cam
Meteostick
OTGW
P1 cable
Davis Vantage Pro weatherstation (incl. solar/UV)

KoenVanduffel
Posts: 8
Joined: Saturday 14 February 2015 15:50
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Enphase

Post by KoenVanduffel » Wednesday 17 February 2016 21:11

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

Machielw
Posts: 15
Joined: Saturday 23 January 2016 12:32
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Enphase

Post by Machielw » Saturday 22 October 2016 10:40

not working anymore?

this is working well:

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

Jumper3126
Posts: 64
Joined: Thursday 31 December 2015 16:26
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Enphase

Post by Jumper3126 » Saturday 15 September 2018 12:56

Used the script of Koen van Duffel to read out the production of each panel

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

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests