enphase envoy with (HTTP) interface

Moderator: leecollings

bldewit
Posts: 59
Joined: Tuesday 09 May 2017 23:31
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: NL
Contact:

Re: enphase envoy with (HTTP) interface

Post by bldewit »

Hi, I added the hardware and checked that i have access to the production.json page, all ok. In my log i keep getting the No Session_id error:
----
Zonnepanelen platdak: Invalid data received! (no session_id)
----
Also tried a reboot after allowing Basic-auth, no effect.

What could be wrong?

Verstuurd vanaf mijn SM-T590 met Tapatalk

-‐----------------------------------------------------------
Running on rPi 3b (main) and rPi 2b (somfy), both RFLink
IthoRemote, Xiaomi Gateway, KAKU
TurboX
Posts: 40
Joined: Wednesday 07 September 2022 9:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: enphase envoy with (HTTP) interface

Post by TurboX »

Hello,

In the past, I have speak about watt production refresh interval issue (software D7).
I have set 60sec of interval request into the domoticz pluging, in the log all is ok (refresh value every 60sec).
The power consumption is well refresh every 60sec but not the power production (more 5-15min). The individual inverter is worst (min 15min).
In parallele I use Home Assistant which is connected to the same enphase gateway, the consumption and production are well refreshed every 60sec approx.
The graph below show the production from HA (lines) et Domoticz (dash).
2023-06-14 08_34_15-Window.png
2023-06-14 08_34_15-Window.png (27.14 KiB) Viewed 21632 times
If i read https:/:IP/production.json, the watt production change very often. It seems that Domoticz doesn't read the correct variable or another .json. No?

Others things:
Why not reporting another values (like inline, voltage, ..) into Domoticz?
Moreover, I would prefer to have an additional device with only the watt of each individual inverter because it generates graphs ot the maximum power each days along a year (permit to detect an issue of production).
User avatar
FireWizard
Posts: 1766
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: enphase envoy with (HTTP) interface

Post by FireWizard »

Hello @TurboX,

There has been a long discussion and I did several tests withe the Enphase Envoy_S.
Please read: https://github.com/domoticz/domoticz/issues/5377
In the past, I have speak about watt production refresh interval issue (software D7).
I have set 60sec of interval request into the domoticz pluging, in the log all is ok (refresh value every 60sec).
60 seconds is fine.
The power consumption is well refresh every 60sec
Obviously, you have the metered version of the Envoy. This data is available.
but not the power production (more 5-15min)
Enphase says the following:
Your IQ Envoy polls your microinverters every 5 minutes and uploads those intervals to Enlighten every 15 minutes, give or take, depending on its WiFi connection speed and stability
So there is no need to poll the Envoy-S faster than every 5 minutes
If i read https:/:IP/production.json, the watt production change very often. It seems that Domoticz doesn't read the correct variable or another .json. No?
Domoticz uses that URL.
Why not reporting another values (like inline, voltage, ..) into Domoticz?
What is "inline"? . What is the URL for "voltage"? I have never seen it.
Moreover, I would prefer to have an additional device with only the watt of each individual inverter because it generates graphs ot the maximum power each days along a year (permit to detect an issue of production).
One device, containing the data of each individual inverter? This is not clear to me.

If you can collect that data, you can easily create it yourself, either a script or Node-RED.

Regards
TurboX
Posts: 40
Joined: Wednesday 07 September 2022 9:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: enphase envoy with (HTTP) interface

Post by TurboX »

Hello @FireWizard and thank for your answer.

I have read the discussion of your link. I still don't understand why I can't have the production every 60sec. The gateway produce the data and 60sec is fine to avoid too many request and then reboot. If the plugin read the production.json every 60sec, I don't understand why the domoticz value of the power production (watt) is updated only every 10/15min.

My production.json is the following:

Code: Select all

	
production	
0	
type	"inverters"
activeCount	3
readingTime	1686766425
wNow	133
whLifetime	514857
1	
type	"eim"
activeCount	1
measurementType	"production"
readingTime	1686766878
wNow	114.652
whLifetime	497523.002
varhLeadLifetime	2.012
varhLagLifetime	255499.637
vahLifetime	641277.6
rmsCurrent	0.641
rmsVoltage	232.009
reactPwr	49.412
apprntPwr	148.472
pwrFactor	0.71
whToday	3000.002
whLastSevenDays	24187.002
vahToday	3451.6
varhLeadToday	0.012
varhLagToday	1030.637
consumption	
0	
type	"eim"
activeCount	1
measurementType	"total-consumption"
readingTime	1686766878
wNow	195.001
whLifetime	3634871.996
varhLeadLifetime	1074997.624
varhLagLifetime	416938.662
vahLifetime	4146976.574
rmsCurrent	1.779
rmsVoltage	232.015
reactPwr	-200.16
apprntPwr	412.696
pwrFactor	0.47
whToday	4841.996
whLastSevenDays	56647.996
vahToday	5493.574
varhLeadToday	2763.624
varhLagToday	1079.662
1	
type	"eim"
activeCount	1
measurementType	"net-consumption"
readingTime	1686766878
wNow	80.349
whLifetime	3140830.161
varhLeadLifetime	1074995.612
varhLagLifetime	161439.025
vahLifetime	4146976.574
rmsCurrent	1.137
rmsVoltage	232.022
reactPwr	-150.748
apprntPwr	263.209
pwrFactor	0.33
whToday	0
whLastSevenDays	0
vahToday	0
varhLeadToday	0
varhLagToday	0
storage	
0	
type	"acb"
activeCount	0
readingTime	0
wNow	0
whNow	0
state	"idle"
Under "production" wNow is the value which is not updated into domoticz (and Home Assistant yes).
Regarding the Voltage, I mean the rmsVoltage and by "Inline" to check if the system respond (detect system down or reboot).

About the additionals domoticz devices, I mean to associate a power device to each energy inverter. This is what I use from HA to send via MQTT autodiscovery which generates 2 device into domoticz : Energy and power (and automatiquely related, the same power is display on both domoticz device). One example:
inverter power.png
inverter power.png (240.13 KiB) Viewed 21618 times
Type:Usage,electric

I don't know how to collect that data, the use of token is completely out of my capabilities (and perhaps I am not alone, why not add these power devices "just" by an option of the plugin?).
TurboX
Posts: 40
Joined: Wednesday 07 September 2022 9:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: enphase envoy with (HTTP) interface

Post by TurboX »

Hello,

I am not coder but I read this on the source code on Github (line 578):

Code: Select all

	Json::Value reading = root["production"][0];

	int musage = reading["wNow"].asInt();
I guess it read wNow into production/0 (inverter type) and not production/1 (eim type). Right?

If yes, my issue is here because under production/0 the wNow production is not real time refreshed while under production/1 the wNow is in real time.

Is it possible for me to change the domoticz code (where is located the .cpp file), juste for a test? I have a docker version just for testing, it would be perfect if I can change this value.
User avatar
gizmocuz
Posts: 2394
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: enphase envoy with (HTTP) interface

Post by gizmocuz »

I have no production/1

Code: Select all

{
  "production": [
    {
      "type": "inverters",
      "activeCount": 13,
      "readingTime": 1687252655,
      "wNow": 2817,
      "whLifetime": 860793
    }
  ],
  "storage": [
    {
      "type": "acb",
      "activeCount": 0,
      "readingTime": 0,
      "wNow": 0,
      "whNow": 0,
      "state": "idle"
    }
  ]
}
Sure you are able to tweak the source / compile and test

https://www.domoticz.com/wiki/Build_Dom ... rom_source
Quality outlives Quantity!
User avatar
gizmocuz
Posts: 2394
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: enphase envoy with (HTTP) interface

Post by gizmocuz »

Talking about the wiki, not that hard to get the token

https://www.domoticz.com/wiki/Enphase
Quality outlives Quantity!
TurboX
Posts: 40
Joined: Wednesday 07 September 2022 9:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: enphase envoy with (HTTP) interface

Post by TurboX »

Hello Gizmocuz,

Your production.json file is very light compare to mine. The plugin is based on your file?
I have read your link to compile by myself but this is too complicated for me (and require another raspberry).
User avatar
gizmocuz
Posts: 2394
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: enphase envoy with (HTTP) interface

Post by gizmocuz »

You can compile on any system (debian/ubuntu or windows)

Can you post your production.json here?
Quality outlives Quantity!
TurboX
Posts: 40
Joined: Wednesday 07 September 2022 9:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: enphase envoy with (HTTP) interface

Post by TurboX »

Hello,

My production.json:

Code: Select all

{
  "production":[
    {
      "type":"inverters",
      "activeCount":3,
      "readingTime":1687238955,
      "wNow":23,
      "whLifetime":531878
    },
    {
      "type":"eim",
      "activeCount":1,
      "measurementType":"production",
      "readingTime":1687239239,
      "wNow":28.008,
      "whLifetime":514118.081,
      "varhLeadLifetime":2.012,
      "varhLagLifetime":262155.23,
      "vahLifetime":661558.741,
      "rmsCurrent":0.284,
      "rmsVoltage":233.224,
      "reactPwr":52.541,
      "apprntPwr":66.08,
      "pwrFactor":0.45,
      "whToday":3.081,
      "whLastSevenDays":23159.081,
      "vahToday":324.741,
      "varhLeadToday":0.012,
      "varhLagToday":392.23,
      "lines":[
        {
          "wNow":28.008,
          "whLifetime":514118.081,
          "varhLeadLifetime":2.012,
          "varhLagLifetime":262155.23,
          "vahLifetime":661558.741,
          "rmsCurrent":0.284,
          "rmsVoltage":233.224,
          "reactPwr":52.541,
          "apprntPwr":66.08,
          "pwrFactor":0.45,
          "whToday":3.081,
          "whLastSevenDays":23159.081,
          "vahToday":324.741,
          "varhLeadToday":0.012,
          "varhLagToday":392.23
          }
        ]
      }
    ],
  "consumption":[
    {
      "type":"eim",
      "activeCount":1,
      "measurementType":"total-consumption",
      "readingTime":1687239239,
      "wNow":234.095,
      "whLifetime":3677800.427,
      "varhLeadLifetime":1092887.378,
      "varhLagLifetime":425695.606,
      "vahLifetime":4194992.577,
      "rmsCurrent":1.714,
      "rmsVoltage":233.33,"reactPwr":-205.665,
      "apprntPwr":399.928,
      "pwrFactor":0.59,
      "whToday":1487.427,
      "whLastSevenDays":52403.427,
      "vahToday":2499.577,
      "varhLeadToday":1252.378,
      "varhLagToday":394.606,
      "lines":[
        {
          "wNow":234.095,
          "whLifetime":3677800.427,
          "varhLeadLifetime":1092887.378,
          "varhLagLifetime":425695.606,
          "vahLifetime":4194992.577,
          "rmsCurrent":1.714,
          "rmsVoltage":233.33,
          "reactPwr":-205.665,
          "apprntPwr":399.928,
          "pwrFactor":0.59,
          "whToday":1487.427,
          "whLastSevenDays":52403.427,
          "vahToday":2499.577,
          "varhLeadToday":1252.378,
          "varhLagToday":394.606
          }
        ]
      },
      {
        "type":"eim",
        "activeCount":1,
        "measurementType":"net-consumption",
        "readingTime":1687239239,
        "wNow":206.087,
        "whLifetime":3167301.465,
        "varhLeadLifetime":1092885.365,
        "varhLagLifetime":163540.377,
        "vahLifetime":4194992.577,
        "rmsCurrent":1.43,
        "rmsVoltage":233.435,"reactPwr":-153.124,
        "apprntPwr":332.636,
        "pwrFactor":0.61,
        "whToday":0,
        "whLastSevenDays":0,
        "vahToday":0,
        "varhLeadToday":0,
        "varhLagToday":0,
        "lines":[
        {
          "wNow":206.087,
          "whLifetime":3167301.465,
          "varhLeadLifetime":1092885.365,
          "varhLagLifetime":163540.377,
          "vahLifetime":4194992.577,
          "rmsCurrent":1.43,
          "rmsVoltage":233.435,
          "reactPwr":-153.124,
          "apprntPwr":332.636,
          "pwrFactor":0.61,
          "whToday":0,
          "whLastSevenDays":0,
          "vahToday":0,
          "varhLeadToday":0,
          "varhLagToday":0
          }
        ]
      }
    ],
    "storage":[
      {
        "type":"acb",
        "activeCount":0,
        "readingTime":0,
        "wNow":0,
        "whNow":0,
        "state":"idle"
        }
      ]
    }
  
User avatar
FireWizard
Posts: 1766
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: enphase envoy with (HTTP) interface

Post by FireWizard »

Hello @TurboX and @gizmocuz.

The difference in production.json is caused by the fact that @gizmocuz has a Enphase Envoy S and @TurboX has a Enphse Envoy S metered.
This last version gives you also information about the consumed energy, taken from the grid

I have exactly the same as @gizmocuz. I do not need a metered version, as I get that data from my P1 Smartmeter

Regards
TurboX
Posts: 40
Joined: Wednesday 07 September 2022 9:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: enphase envoy with (HTTP) interface

Post by TurboX »

Hello @FireWizard,

Yes, you are right, I have the metered version.
I was thinking that only the Envoy S metered was able to measure production/consumption and report it.
User avatar
gizmocuz
Posts: 2394
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: enphase envoy with (HTTP) interface

Post by gizmocuz »

I am more than happy to check if it's a metered version.
But, I noticed that the value for 'whLifetime' is also different... how is this possible?

production[0] = "whLifetime":531878
production[1] = "whLifetime":514118.081

So it is quite a lot lower....

Do we pick the one from production[0] ? or if there is a production[1] we use this one?
Quality outlives Quantity!
User avatar
FireWizard
Posts: 1766
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: enphase envoy with (HTTP) interface

Post by FireWizard »

Hello @gizmocuz,

You asked:
Do we pick the one from production[0] ? or if there is a production[1] we use this one?
The data, indicated by "eim" is the data from the CT (Current Transformer) devices. It depends on how they are connected.
https://enphase.com/en-ph/download/ct-b ... ices-en-au

If I read the data from @TurboX, I guess that @TurboX has 3 Enphase inverters installed in a Single Phase system.
@TurboX: Can you confirm?

You can either connect a CT in the "Production" circuits or in the "Consumption" circuits or both.
Data is given as a total and in an array of object line for all 3 phases, L1, L2 and L3.

I do not know where the characters eim stands for. Someone?

Inverters is clear and as far as I understand "acb" stands for AC Battery. (Although AC batteries technically do not exist)

Consumption is presented as both "total-consumption" and "net-consumption".
I do not know the difference between those two. Is it a matter of connections or configuration?
But perhaps @turboX can answer.

It is quite easy to check, whether you have an Envoy-S or an Envoy-S metered, by looking to the Envoy and see if you have CT's installed.
If so, then http://IP-address/production.json will give you the details.
If you have the following:

Code: Select all

production	
0	
type	"inverters"
activeCount	22
readingTime	1687876481
wNow	2884
whLifetime	8985367
storage	
0	
type	"acb"
activeCount	0
readingTime	0
wNow	0
whNow	0
state	"idle"
Then you have the standard version, what I expect.

Regards
TurboX
Posts: 40
Joined: Wednesday 07 September 2022 9:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: enphase envoy with (HTTP) interface

Post by TurboX »

Yes I confirm, I have 3 Enphase micro inverter (IQ7A) with 2 Current Transformer on total production and the other on the net consumption (from Enedis, my energy provider). My total consumption is the whole of energy consumed by the house (produced and imported).

@gizmocuz I don't know why there is a difference between production[0] = "whLifetime":531878 and production[1] = "whLifetime":514118.081 but Home Assitant send to domoticz the production[1] value to Domoticz and I have Domoticz-Linky plugin (official data from my energy provider) and I match perfectly. Perhaps production[0] is an estimation from micro-inverter and production[1] is more real?

In parallele I have compiled domoticz from source (very new for me using virtual debian on synology, not so easy but very interesting) and I have juste modify the line 578 with production[1] and now the production seems updated following pooling rate :) . I will make more longer test to confirm that.

If it works, can we add a parameter into the plugin in order to chose to Envoy gateway (metered or not) or check if production[1] is available and if yes use it? (and why not add voltage RMS value?)
TurboX
Posts: 40
Joined: Wednesday 07 September 2022 9:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: enphase envoy with (HTTP) interface

Post by TurboX »

It definitely works with the modification.
Line: data from actual Domoticz plugin with 30s polling rate
Dash: data from Home Assistant plugin (polling rate not configurable)
Dot: data from modified Domoticz plugin with 30s polling rate
Screenshot_20230628-113725.png
Screenshot_20230628-113725.png (161.78 KiB) Viewed 21415 times
User avatar
gizmocuz
Posts: 2394
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: enphase envoy with (HTTP) interface

Post by gizmocuz »

Great that you can compile now!

Could you replace the parseProduction function with:

Code: Select all

void EnphaseAPI::parseProduction(const Json::Value& root)
{
	if (!IsItSunny())
	{
		m_sql.safe_query(
			"UPDATE DeviceStatus SET LastUpdate='%s' WHERE (HardwareID==%d)", TimeToString(nullptr, TF_DateTime).c_str(), m_HwdID);
		return;
	}
	if (root["production"].empty() == true)
	{
		//No production details available
		return;
	}
	size_t sproduction = root["production"].size();
	bool bIsMeteredVersion = (sproduction > 1);
	if (bIsMeteredVersion)
	{
		bIsMeteredVersion = root["production"][1]["whLifetime"].asInt() != 0;
	}
	Json::Value reading = (bIsMeteredVersion) ? root["production"][1] : root["production"][0];

	int musage = reading["wNow"].asInt();
	int mtotal = reading["whLifetime"].asInt();

	SendKwhMeter(m_HwdID, 1, 255, musage, mtotal / 1000.0, "Enphase kWh Production");
}
This should automatically detect if you have a metered envoy and that it is also measuring (maybe you can install the metered version without CT clamps?)

I think the value from root["production"][0] should be accurate.... hope so, as I don't have the metered version)
Quality outlives Quantity!
TurboX
Posts: 40
Joined: Wednesday 07 September 2022 9:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: enphase envoy with (HTTP) interface

Post by TurboX »

I don't know if it's my paste the cause:

Code: Select all

<pre>[ 17%] <span style="color:#26A269">Building CXX object CMakeFiles/domoticz.dir/hardware/EnphaseAPI.cpp.o</span>
<b>c++:</b> <span style="color:#C01C28"><b>fatal error: </b></span>Processus arrêté signal terminated program cc1plus
compilation terminated.
make[2]: *** [CMakeFiles/domoticz.dir/build.make:1437 : CMakeFiles/domoticz.dir/hardware/EnphaseAPI.cpp.o] Erreur 1
make[1]: *** [CMakeFiles/Makefile2:384 : CMakeFiles/domoticz.dir/all] Erreur 2
make: *** [Makefile:156 : all] Erreur 2
</pre>
TurboX
Posts: 40
Joined: Wednesday 07 September 2022 9:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: enphase envoy with (HTTP) interface

Post by TurboX »

Sorry, it was probably me the problem :lol: . I succeed to compile again.

It works but is it sure that the old domoticz.sh is erase and rewrited by the "make" command ? Or to be sure, it is better to restart from scratch (remove dev-domoticz folder)?
User avatar
gizmocuz
Posts: 2394
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: enphase envoy with (HTTP) interface

Post by gizmocuz »

Thanks for verifying. I will make the patch/commit/beta

domoticz.sh is not overwritten bij de make command
Quality outlives Quantity!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests