Page 6 of 8

Re: enphase envoy with (HTTP) interface

Posted: Monday 17 July 2023 16:49
by Sebastiii
gizmocuz wrote: Monday 17 July 2023 13:34 Okey, I leave the counters as it is reported. Beta 15436 is not touching it anymore
So negative value is back :D
But counter still moving when it's negative :

Image

After few secs :

Image

I'm on : Image

So I'm a bit confused of this :o

Looking at your code change, it's done on : parseProduction it should be done on parseConsumption method right ?

So, like this :

Code: Select all

void EnphaseAPI::parseConsumption(const Json::Value& root)
{
	if (root["consumption"].empty())
	{
		return;
	}

	int iIndex = 2;
	for (const auto& itt : root["consumption"])
	{
		int activeCount = itt["activeCount"].asInt();
		if (activeCount == 0)
			continue;

		m_bHaveConsumption = true;

		std::string szName = "Enphase " + itt["measurementType"].asString();
		int musage = itt["wNow"].asInt();
		
		if (musage < 0)
		musage = 0; //seems sometimes the production value is negative??
		
		int mtotal = itt["whLifetime"].asInt();
		if (mtotal != 0)
		{
			SendKwhMeter(m_HwdID, iIndex++, 255, musage, mtotal / 1000.0, szName);
		}
	}
}
And remove the part one you added from parseProduction ?
Thanks.

Re: enphase envoy with (HTTP) interface

Posted: Monday 17 July 2023 17:46
by Sebastiii
@gizmocuz, I have seen you change about the token, so I was able to confirm that on Windows, it works now, great work ;)
Then, I'm able to try the above explained code to see if it does like I'm thinking :)

Edit : about the token, it works but I'm still getting those message in log :

Code: Select all

2023-07-17 17:56:42.232 Error: Enphase: Error getting http data! (token not found)
2023-07-17 17:56:49.143 Error: Enphase: Error getting http data! (token not found)
2023-07-17 17:56:58.022 Error: Enphase: Error getting http data! (token not found)
2023-07-17 17:57:05.421 Error: Enphase: Error getting http data! (token not found)

Re: enphase envoy with (HTTP) interface

Posted: Monday 17 July 2023 18:07
by Sebastiii
Sebastiii wrote: Monday 17 July 2023 16:49

Code: Select all

void EnphaseAPI::parseConsumption(const Json::Value& root)
{
	if (root["consumption"].empty())
	{
		return;
	}

	int iIndex = 2;
	for (const auto& itt : root["consumption"])
	{
		int activeCount = itt["activeCount"].asInt();
		if (activeCount == 0)
			continue;

		m_bHaveConsumption = true;

		std::string szName = "Enphase " + itt["measurementType"].asString();
		int musage = itt["wNow"].asInt();
		
		if (musage < 0)
		musage = 0; //seems sometimes the production value is negative??
		
		int mtotal = itt["whLifetime"].asInt();
		if (mtotal != 0)
		{
			SendKwhMeter(m_HwdID, iIndex++, 255, musage, mtotal / 1000.0, szName);
		}
	}
}
This doesn't work, because I cancel negative value, that not I wanted lol
I just want the counter to not move :D

Re: enphase envoy with (HTTP) interface

Posted: Monday 17 July 2023 18:57
by Sebastiii
With my different testing code, I can't achieve it !
In older Domoticz 2021, it was working, I have looked at older code :

Code: Select all

void EnphaseAPI::parseNetConsumption(const Json::Value& root)
{
	if (root["consumption"].empty() == true)
	{
		return;
	}
	if (root["consumption"][1].empty() == true)
	{
		_log.Log(LOG_ERROR, "EnphaseAPI: Invalid data received");
		return;
	}

	Json::Value reading = root["consumption"][1];

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

	SendKwhMeter(m_HwdID, 3, 255, musage, mtotal / 1000.0, "Enphase kWh Net Consumption");

	m_c2power.powerusage1 = mtotal;
	m_c2power.powerusage2 = 0;
	m_c2power.usagecurrent = musage;
	sDecodeRXMessage(this, (const unsigned char *)&m_c2power, "Enphase Net Consumption kWh Total", 255);
}
I think this one was working, but not really sure too !

Re: enphase envoy with (HTTP) interface

Posted: Monday 17 July 2023 19:16
by Sebastiii
Weird, on Windows, I can't see error related to token, but plugin didn't work :

Code: Select all

2023-07-17 19:13:49.499 Error: Enphase: Invalid data received! (production/json)
2023-07-17 19:13:58.136 Error: Enphase: Invalid data received! (production/json)
2023-07-17 19:14:06.795 Error: Enphase: Invalid data received! (production/json)
2023-07-17 19:14:15.495 Error: Enphase: Invalid data received! (production/json)
2023-07-17 19:14:24.254 Error: Enphase: Invalid data received! (production/json)
2023-07-17 19:14:32.967 Error: Enphase: Invalid data received! (production/json)
2023-07-17 19:14:41.675 Error: Enphase: Invalid data received! (production/json)
2023-07-17 19:14:50.383 Error: Enphase: Invalid data received! (production/json)

Re: enphase envoy with (HTTP) interface

Posted: Tuesday 18 July 2023 0:09
by AintBigAintClever
Would these recent changes tie with version R4-10-35 no longer being supported? Since Sunday evening the three kWh counters (IDs 00000901-903) from my Envoy have frozen.

Here's what's in the log.
2023-07-17 22:47:01 Status: Envoy: Connected, serial: 122031021955, software: R4-10-35
2023-07-17 22:47:01 Status: Envoy: Unsupported software version! Please contact us for support!
2023-07-17 22:47:01 Error: Envoy: Error getting http data! (production)

(times and version changed as the forum sees anything with a dot in the middle of it as a URL and rejects it outright).

Re: enphase envoy with (HTTP) interface

Posted: Tuesday 18 July 2023 11:06
by TurboX
Sebastiii wrote: Monday 17 July 2023 18:07
Sebastiii wrote: Monday 17 July 2023 16:49

Code: Select all

void EnphaseAPI::parseConsumption(const Json::Value& root)
{
	if (root["consumption"].empty())
	{
		return;
	}

	int iIndex = 2;
	for (const auto& itt : root["consumption"])
	{
		int activeCount = itt["activeCount"].asInt();
		if (activeCount == 0)
			continue;

		m_bHaveConsumption = true;

		std::string szName = "Enphase " + itt["measurementType"].asString();
		int musage = itt["wNow"].asInt();
		
		if (musage < 0)
		musage = 0; //seems sometimes the production value is negative??
		
		int mtotal = itt["whLifetime"].asInt();
		if (mtotal != 0)
		{
			SendKwhMeter(m_HwdID, iIndex++, 255, musage, mtotal / 1000.0, szName);
		}
	}
}
This doesn't work, because I cancel negative value, that not I wanted lol
I just want the counter to not move :D
Hello,

You mean that the value of "whLifetime" into net-consumption decrease when you export to the grid?
If yes, it is related to Envoy configuration, no? Or perhaps it miss another counter which count how much you export?

Re: enphase envoy with (HTTP) interface

Posted: Tuesday 18 July 2023 11:23
by Sebastiii
TurboX wrote: Tuesday 18 July 2023 11:06 Hello,

You mean that the value of "whLifetime" into net-consumption decrease when you export to the grid?
If yes, it is related to Envoy configuration, no? Or perhaps it miss another counter which count how much you export?
Hello,
I was able to compile Domoticz under a Ubuntu Hyper-V VM, so I can try to understand the code, and you are right, the "whLifetime" into net-consumption decrease when exporting to the grid.

So, I fear, that we can't do nothing on Domoticz side finally, and in final, it's good to have a Linky plugin working to know exactly the "net-consumption"

So in fact, it's an Enphase design, now I don't know if it does that before V7 firmware, I'm pretty sure native doesn't decrease the counter on V5 firmware, and I was also using Node-RED to MQTT previously and with this URL to getting information to parse to Domoticz : https://envoy.local/stream/meter

In fact, it could be nice to have this working in native Enphase plugins ;)

It gives all seconds :
data: {"production":{"ph-a":{"p":1919.827,"q":173.834,"s":1926.83,"v":240.912,"i":7.999,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"net-consumption":{"ph-a":{"p":-834.044,"q":-707.92,"s":-1145.832,"v":240.62,"i":-4.762,"pf":-1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"total-consumption":{"ph-a":{"p":1085.782,"q":-534.086,"s":778.994,"v":240.62,"i":3.237,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}}}

data: {"production":{"ph-a":{"p":1924.043,"q":173.762,"s":1930.468,"v":240.823,"i":8.054,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"net-consumption":{"ph-a":{"p":-833.042,"q":-708.648,"s":-1152.422,"v":240.524,"i":-4.791,"pf":-1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"total-consumption":{"ph-a":{"p":1091.001,"q":-534.886,"s":784.753,"v":240.524,"i":3.263,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}}}

data: {"production":{"ph-a":{"p":1928.395,"q":174.192,"s":1935.88,"v":240.783,"i":8.026,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"net-consumption":{"ph-a":{"p":-838.875,"q":-709.104,"s":-1146.799,"v":240.479,"i":-4.769,"pf":-1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"total-consumption":{"ph-a":{"p":1089.52,"q":-534.912,"s":783.258,"v":240.479,"i":3.257,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}}}

data: {"production":{"ph-a":{"p":1928.045,"q":173.612,"s":1934.912,"v":240.768,"i":8.032,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"net-consumption":{"ph-a":{"p":-832.894,"q":-711.081,"s":-1146.211,"v":240.461,"i":-4.767,"pf":-1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"total-consumption":{"ph-a":{"p":1095.151,"q":-537.47,"s":785.274,"v":240.461,"i":3.266,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}}}

data: {"production":{"ph-a":{"p":1949.904,"q":173.759,"s":1953.695,"v":240.838,"i":8.162,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"net-consumption":{"ph-a":{"p":-856.434,"q":-713.259,"s":-1170.925,"v":240.531,"i":-4.868,"pf":-1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"total-consumption":{"ph-a":{"p":1093.47,"q":-539.5,"s":792.32,"v":240.531,"i":3.294,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}}}

data: {"production":{"ph-a":{"p":1989.517,"q":173.696,"s":1992.145,"v":240.968,"i":8.365,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"net-consumption":{"ph-a":{"p":-898.406,"q":-713.076,"s":-1215.399,"v":240.659,"i":-5.05,"pf":-1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"total-consumption":{"ph-a":{"p":1091.111,"q":-539.38,"s":797.82,"v":240.659,"i":3.315,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}}}

data: {"production":{"ph-a":{"p":2028.845,"q":174.492,"s":2031.898,"v":240.959,"i":8.509,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"net-consumption":{"ph-a":{"p":-941.228,"q":-711.723,"s":-1237.335,"v":240.655,"i":-5.142,"pf":-1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"total-consumption":{"ph-a":{"p":1087.617,"q":-537.231,"s":810.35,"v":240.655,"i":3.367,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}}}

data: {"production":{"ph-a":{"p":2028.845,"q":174.492,"s":2031.898,"v":240.959,"i":8.509,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"net-consumption":{"ph-a":{"p":-941.228,"q":-711.723,"s":-1237.335,"v":240.655,"i":-5.142,"pf":-1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"total-consumption":{"ph-a":{"p":1087.617,"q":-537.231,"s":810.35,"v":240.655,"i":3.367,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}}}

data: {"production":{"ph-a":{"p":2100.37,"q":175.302,"s":2103.03,"v":241.056,"i":8.811,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"net-consumption":{"ph-a":{"p":-1010.787,"q":-712.256,"s":-1296.051,"v":240.771,"i":-5.383,"pf":-1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"total-consumption":{"ph-a":{"p":1089.583,"q":-536.954,"s":825.313,"v":240.771,"i":3.428,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}}}

data: {"production":{"ph-a":{"p":2144.475,"q":175.404,"s":2146.78,"v":241.256,"i":9.006,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"net-consumption":{"ph-a":{"p":-1059.295,"q":-712.965,"s":-1334.408,"v":240.99,"i":-5.537,"pf":-1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"total-consumption":{"ph-a":{"p":1085.18,"q":-537.56,"s":835.856,"v":240.99,"i":3.468,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}}}

data: {"production":{"ph-a":{"p":2176.841,"q":175.073,"s":2180.563,"v":241.273,"i":9.086,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"net-consumption":{"ph-a":{"p":-1089.041,"q":-712.045,"s":-1350.738,"v":241.024,"i":-5.604,"pf":-1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"total-consumption":{"ph-a":{"p":1087.8,"q":-536.972,"s":839.19,"v":241.024,"i":3.482,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}}}

data: {"production":{"ph-a":{"p":2190.098,"q":175.082,"s":2194.522,"v":241.285,"i":9.109,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"net-consumption":{"ph-a":{"p":-1099.943,"q":-710.921,"s":-1350.83,"v":241.057,"i":-5.604,"pf":-1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"total-consumption":{"ph-a":{"p":1090.155,"q":-535.84,"s":844.965,"v":241.057,"i":3.505,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}}}

data: {"production":{"ph-a":{"p":2195.283,"q":174.942,"s":2200.769,"v":241.287,"i":9.13,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"net-consumption":{"ph-a":{"p":-1103.098,"q":-710.064,"s":-1354.382,"v":241.075,"i":-5.618,"pf":-1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}},"total-consumption":{"ph-a":{"p":1092.185,"q":-535.122,"s":846.56,"v":241.075,"i":3.512,"pf":1.0,"f":50.0},"ph-b":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0},"ph-c":{"p":0.0,"q":0.0,"s":0.0,"v":0.0,"i":0.0,"pf":0.0,"f":0.0}}}
production["ph-a"].p

Code: Select all

[
    {
        "id": "2ab03576.40b95a",
        "type": "function",
        "z": "990e535c.6c9aa",
        "name": "production[\"ph-a\"].p",
        "func": "var msg1 = {};\nvar msg2 = {};\nvar msg3 = {};\nmsg1.topic = \"Envoy/Stream/Prod\"\n\nif ((msg.payload.production[\"ph-a\"].p) < 0) {\n  (msg.payload.production[\"ph-a\"].p) = 0;\n}\n\nmsg1.payload = {\"command\":\"udevice\",\"idx\":142,\"nvalue\":0,\"svalue\":((msg.payload.production[\"ph-a\"].p).toString())};\n//msg2.payload = {\"command\":\"udevice\",\"idx\":200,\"nvalue\":0,\"svalue\":((msg.payload.production[\"ph-a\"].p).toString() + \";0\")};\nmsg3.payload = {\"command\":\"udevice\",\"idx\":193,\"nvalue\":0,\"svalue\":(\"0\" + \";0\" + \";0\" + \";0\" + \";\" + (msg.payload.production[\"ph-a\"].p).toString() + \";0\")};\n//return [[msg1,msg2,msg3]];\nreturn [[msg1,msg3]];",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 410,
        "y": 420,
        "wires": [
            [
                "6d349e5f.f4c798"
            ]
        ]
    }
]
["net-consumption"]["ph-a"].p :

Code: Select all

[
    {
        "id": "f43980a0.3f7be",
        "type": "function",
        "z": "990e535c.6c9aa",
        "name": "[\"net-consumption\"][\"ph-a\"].p",
        "func": "//msg.payload = msg.payload[\"net-consumption\"][\"ph-a\"].p;\n//msg.topic = \"Envoy/Stream/NetConso\"\n//return msg;\n\n//msg.topic = \"Envoy/Stream/NetConso\"\n//msg.payload = {\"command\":\"udevice\",\"idx\":143,\"nvalue\":0,\"svalue\":((msg.payload[\"net-consumption\"][\"ph-a\"].p).toString())};\n//return msg;\n\nvar msg1 = {};\nvar msg2 = {};\nvar msg3 = {};\nmsg1.topic = \"Envoy/Stream/NetConso\"\n\nmsg1.payload = {\"command\":\"udevice\",\"idx\":143,\"nvalue\":0,\"svalue\":((msg.payload[\"net-consumption\"][\"ph-a\"].p).toString())};\n\nif ((msg.payload[\"net-consumption\"][\"ph-a\"].p) < 0) {\n  (msg.payload[\"net-consumption\"][\"ph-a\"].p) = 0;\n}\n\n//msg2.payload = {\"command\":\"udevice\",\"idx\":191,\"nvalue\":0,\"svalue\":((msg.payload[\"net-consumption\"][\"ph-a\"].p).toString() + \";0\")};\nmsg3.payload = {\"command\":\"udevice\",\"idx\":198,\"nvalue\":0,\"svalue\":(\"0\" + \";0\" + \";0\" + \";0\" + \";\" + (msg.payload[\"net-consumption\"][\"ph-a\"].p).toString() + \";0\")};\n//return [[msg1,msg2,msg3]];\nreturn [[msg1,msg3]];",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 420,
        "y": 460,
        "wires": [
            [
                "6d349e5f.f4c798"
            ]
        ]
    }
]
["total-consumption"]["ph-a"].p

Code: Select all

[
    {
        "id": "6c81fa17.83fd3c",
        "type": "function",
        "z": "990e535c.6c9aa",
        "name": "[\"total-consumption\"][\"ph-a\"].p",
        "func": "var msg1 = {};\nvar msg2 = {};\nvar msg3 = {};\nmsg1.topic = \"Envoy/Stream/TotConso\"\n\nmsg1.payload = {\"command\":\"udevice\",\"idx\":144,\"nvalue\":0,\"svalue\":((msg.payload[\"total-consumption\"][\"ph-a\"].p).toString())};\n//msg2.payload = {\"command\":\"udevice\",\"idx\":199,\"nvalue\":0,\"svalue\":((msg.payload[\"total-consumption\"][\"ph-a\"].p).toString() + \";0\")};\nmsg3.payload = {\"command\":\"udevice\",\"idx\":197,\"nvalue\":0,\"svalue\":(\"0\" + \";0\" + \";0\" + \";0\" + \";\" + (msg.payload[\"total-consumption\"][\"ph-a\"].p).toString() + \";0\")};\n//return [[msg1,msg2,msg3]];\nreturn [[msg1,msg3]];",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 420,
        "y": 500,
        "wires": [
            [
                "6d349e5f.f4c798"
            ]
        ]
    }
]
With this streamer URL, it's nice to get data quickly without problem and it's running fine like the data arrives all second by itself, bu I think it's only an a metered S device !

Re: enphase envoy with (HTTP) interface

Posted: Tuesday 18 July 2023 11:29
by Sebastiii
TurboX wrote: Tuesday 18 July 2023 11:06 If yes, it is related to Envoy configuration, no? Or perhaps it miss another counter which count how much you export?
It seems there is no other counter from JSON :

Code: Select all

{
  "production": [
    {
      "type": "inverters",
      "activeCount": 10,
      "readingTime": 1689672307,
      "wNow": 1990,
      "whLifetime": 794245
    },
    {
      "type": "eim",
      "activeCount": 1,
      "measurementType": "production",
      "readingTime": 1689672381,
      "wNow": 1383.663,
      "whLifetime": 8087131.524,
      "varhLeadLifetime": 1.406,
      "varhLagLifetime": 2767830.098,
      "vahLifetime": 10025014.587,
      "rmsCurrent": 5.905,
      "rmsVoltage": 243.853,
      "reactPwr": 179.63,
      "apprntPwr": 1387.134,
      "pwrFactor": 1,
      "whToday": 3427.524,
      "whLastSevenDays": 122008.524,
      "vahToday": 4974.587,
      "varhLeadToday": 0.406,
      "varhLagToday": 1981.098,
      "lines": [
        {
          "wNow": 1383.663,
          "whLifetime": 8087131.524,
          "varhLeadLifetime": 1.406,
          "varhLagLifetime": 2767830.098,
          "vahLifetime": 10025014.587,
          "rmsCurrent": 5.905,
          "rmsVoltage": 243.853,
          "reactPwr": 179.63,
          "apprntPwr": 1387.134,
          "pwrFactor": 1,
          "whToday": 3427.524,
          "whLastSevenDays": 122008.524,
          "vahToday": 4974.587,
          "varhLeadToday": 0.406,
          "varhLagToday": 1981.098
        }
      ]
    }
  ],
  "consumption": [
    {
      "type": "eim",
      "activeCount": 1,
      "measurementType": "total-consumption",
      "readingTime": 1689672381,
      "wNow": 936.196,
      "whLifetime": 14002862.31,
      "varhLeadLifetime": 9996315.349,
      "varhLagLifetime": -2727986.277,
      "vahLifetime": 16852007.983,
      "rmsCurrent": 1.848,
      "rmsVoltage": 243.617,
      "reactPwr": -595.13,
      "apprntPwr": 450.259,
      "pwrFactor": 1,
      "whToday": 9790.31,
      "whLastSevenDays": 122779.31,
      "vahToday": 12690.983,
      "varhLeadToday": 8597.349,
      "varhLagToday": 0,
      "lines": [
        {
          "wNow": 936.196,
          "whLifetime": 14002862.31,
          "varhLeadLifetime": 9996315.349,
          "varhLagLifetime": -2727986.277,
          "vahLifetime": 16852007.983,
          "rmsCurrent": 1.848,
          "rmsVoltage": 243.617,
          "reactPwr": -595.13,
          "apprntPwr": 450.259,
          "pwrFactor": 1,
          "whToday": 9790.31,
          "whLastSevenDays": 122779.31,
          "vahToday": 12690.983,
          "varhLeadToday": 8597.349,
          "varhLagToday": 0
        }
      ]
    },
    {
      "type": "eim",
      "activeCount": 1,
      "measurementType": "net-consumption",
      "readingTime": 1689672381,
      "wNow": -447.467,
      "whLifetime": 5929178.418,
      "varhLeadLifetime": 9996316.755,
      "varhLagLifetime": 39843.821,
      "vahLifetime": 16852007.983,
      "rmsCurrent": -4.057,
      "rmsVoltage": 243.617,
      "reactPwr": -774.759,
      "apprntPwr": -988.268,
      "pwrFactor": -1,
      "whToday": 0,
      "whLastSevenDays": 0,
      "vahToday": 0,
      "varhLeadToday": 0,
      "varhLagToday": 0,
      "lines": [
        {
          "wNow": -447.467,
          "whLifetime": 5929178.418,
          "varhLeadLifetime": 9996316.755,
          "varhLagLifetime": 39843.821,
          "vahLifetime": 16852007.983,
          "rmsCurrent": -4.057,
          "rmsVoltage": 243.617,
          "reactPwr": -774.759,
          "apprntPwr": -988.268,
          "pwrFactor": -1,
          "whToday": 0,
          "whLastSevenDays": 0,
          "vahToday": 0,
          "varhLeadToday": 0,
          "varhLagToday": 0
        }
      ]
    }
  ],
  "storage": [
    {
      "type": "acb",
      "activeCount": 0,
      "readingTime": 0,
      "wNow": 0,
      "whNow": 0,
      "state": "idle"
    }
  ]
}

Re: enphase envoy with (HTTP) interface

Posted: Tuesday 18 July 2023 15:40
by Sebastiii
I'm noob in code but trying something on my side and getting some value :

Using this URL : "https://envoy.local/ivp/meters/readings"

I'm getting Production and Net consumption from attached binary :

Code: Select all

2023-07-18 15:30:45.514  Error: Enphase: 5925664 POSITIF mtotal
2023-07-18 15:30:46.075  Error: Enphase: 1169.702 INSTALLER2
2023-07-18 15:30:46.076  Error: Enphase: 14.069000000000001 INSTALLER2
2023-07-18 15:30:53.098  Error: Enphase: Enphase total-consumption FULL
2023-07-18 15:30:53.098  Error: Enphase: 14007336 FULL mtotal
2023-07-18 15:30:53.099  Error: Enphase: Enphase net-consumption POSITIF
2023-07-18 15:30:53.099  Error: Enphase: 5925664 POSITIF mtotal
2023-07-18 15:30:53.668  Error: Enphase: 1182.9870000000001 INSTALLER2
2023-07-18 15:30:53.669  Error: Enphase: 7.056 INSTALLER2
2023-07-18 15:31:01.849  Error: Enphase: Enphase total-consumption FULL
2023-07-18 15:31:01.849  Error: Enphase: 14007339 FULL mtotal
2023-07-18 15:31:01.849  Error: Enphase: 5925664 NEGATIF Before
2023-07-18 15:31:01.849  Error: Enphase: Enphase net-consumption NEGATIF
2023-07-18 15:31:01.849  Error: Enphase: 5929828 NEGATIF after
2023-07-18 15:31:01.849  Error: Enphase: -4 NEGATIF
2023-07-18 15:31:02.378  Error: Enphase: 1202.7639999999999 INSTALLER2
2023-07-18 15:31:02.379  Error: Enphase: -9.4990000000000006 INSTALLER2
2023-07-18 15:31:14.855  Error: Enphase: Enphase total-consumption FULL
2023-07-18 15:31:14.855  Error: Enphase: 14007343 FULL mtotal
2023-07-18 15:31:14.855  Error: Enphase: 5925664 NEGATIF Before
2023-07-18 15:31:14.855  Error: Enphase: Enphase net-consumption NEGATIF
2023-07-18 15:31:14.855  Error: Enphase: 5929828 NEGATIF after
2023-07-18 15:31:14.855  Error: Enphase: -38 NEGATIF
2023-07-18 15:31:15.394  Error: Enphase: 1232.3610000000001 INSTALLER2
2023-07-18 15:31:15.396  Error: Enphase: -43.786999999999999 INSTALLER2
Above last value : "1232.3610000000001" is current Production
Above last value : "-43.786999999999999" is current Net consumption

It seems that we can get the value and maybe create a device like the inverters code :D
But it's surely better to get value from : "http://envoy.local/stream/meter", but I don't know how to do that !

With those, we don't need to rely on "whLifetime"

What do you think ?

JSON from URL "https://envoy.local/ivp/meters/readings" give that :

Code: Select all

[
  {
    "eid": 704643328,
    "timestamp": 1689684022,
    "actEnergyDlvd": 8093735.96,
    "actEnergyRcvd": 7152.519,
    "apparentEnergy": 10031644.535,
    "reactEnergyLagg": 2768407.246,
    "reactEnergyLead": 1.406,
    "instantaneousDemand": 1523.971,
    "activePower": 1523.971,
    "apparentPower": 1534.124,
    "reactivePower": 175.162,
    "pwrFactor": 0.995,
    "voltage": 242.471,
    "current": 6.336,
    "freq": 50,
    "channels": [
      {
        "eid": 1778385169,
        "timestamp": 1689684022,
        "actEnergyDlvd": 8093735.96,
        "actEnergyRcvd": 7152.519,
        "apparentEnergy": 10031644.535,
        "reactEnergyLagg": 2768407.246,
        "reactEnergyLead": 1.406,
        "instantaneousDemand": 1523.971,
        "activePower": 1523.971,
        "apparentPower": 1534.124,
        "reactivePower": 175.162,
        "pwrFactor": 0.995,
        "voltage": 242.471,
        "current": 6.336,
        "freq": 50
      },
      {
        "eid": 1778385170,
        "timestamp": 1689684022,
        "actEnergyDlvd": 0,
        "actEnergyRcvd": 8984.014,
        "apparentEnergy": 9042.897,
        "reactEnergyLagg": 1077.881,
        "reactEnergyLead": 0,
        "instantaneousDemand": -0.061,
        "activePower": -0.061,
        "apparentPower": 0.605,
        "reactivePower": 0,
        "pwrFactor": -1,
        "voltage": 2.541,
        "current": 0.238,
        "freq": 50
      },
      {
        "eid": 1778385171,
        "timestamp": 1689684022,
        "actEnergyDlvd": 0.012,
        "actEnergyRcvd": 23744.338,
        "apparentEnergy": 3507.246,
        "reactEnergyLagg": 1084.48,
        "reactEnergyLead": 1.512,
        "instantaneousDemand": 0,
        "activePower": 0,
        "apparentPower": 0,
        "reactivePower": 0,
        "pwrFactor": 0,
        "voltage": 11.318,
        "current": 0,
        "freq": 50
      }
    ]
  },
  {
    "eid": 704643584,
    "timestamp": 1689684022,
    "actEnergyDlvd": 8892435.104,
    "actEnergyRcvd": 2973034.387,
    "apparentEnergy": 16856637.782,
    "reactEnergyLagg": 39844.005,
    "reactEnergyLead": 9998748.575,
    "instantaneousDemand": -633.991,
    "activePower": -633.991,
    "apparentPower": 1058.976,
    "reactivePower": -798.301,
    "pwrFactor": -0.6,
    "voltage": 242.236,
    "current": 4.377,
    "freq": 50,
    "channels": [
      {
        "eid": 1778385425,
        "timestamp": 1689684022,
        "actEnergyDlvd": 8892435.104,
        "actEnergyRcvd": 2973034.387,
        "apparentEnergy": 16856637.782,
        "reactEnergyLagg": 39844.005,
        "reactEnergyLead": 9998748.575,
        "instantaneousDemand": -633.991,
        "activePower": -633.991,
        "apparentPower": 1058.976,
        "reactivePower": -798.301,
        "pwrFactor": -0.6,
        "voltage": 242.236,
        "current": 4.377,
        "freq": 50
      },
      {
        "eid": 1778385426,
        "timestamp": 1689684022,
        "actEnergyDlvd": 0,
        "actEnergyRcvd": 69605.361,
        "apparentEnergy": 20246.638,
        "reactEnergyLagg": 1062.699,
        "reactEnergyLead": 0.497,
        "instantaneousDemand": -0.898,
        "activePower": -0.898,
        "apparentPower": 1.28,
        "reactivePower": 0,
        "pwrFactor": -1,
        "voltage": 7.192,
        "current": 0.178,
        "freq": 50
      },
      {
        "eid": 1778385427,
        "timestamp": 1689684022,
        "actEnergyDlvd": 0,
        "actEnergyRcvd": 83338.891,
        "apparentEnergy": 838.795,
        "reactEnergyLagg": 1050.276,
        "reactEnergyLead": 0.177,
        "instantaneousDemand": -0.02,
        "activePower": -0.02,
        "apparentPower": 0.021,
        "reactivePower": 0,
        "pwrFactor": 0,
        "voltage": 3.328,
        "current": 0,
        "freq": 50
      }
    ]
  }
]

Re: enphase envoy with (HTTP) interface

Posted: Tuesday 18 July 2023 17:20
by Sebastiii
So I think the best way is to go with the URL : "http://envoy.local/stream/meter" for the metered version, like it will not use "whLifetime" and like this URL is auto-updated all seconds, the counter will be match the real values (Consumption, Production, and Net-Production).

Edit : But with this, we can't have a counter !

Ofc, the real issue is on Enphase like the add Import/Export to grid now !

Re: enphase envoy with (HTTP) interface

Posted: Thursday 20 July 2023 9:02
by TurboX
Hello @Sebastiii
I'm agree with you, the stream of the metered version seems to be an excellent option.
Perhaps, the best is to have an independant plugin (docker) which could provide data to MQTT with auto discovery.

Re: enphase envoy with (HTTP) interface

Posted: Thursday 20 July 2023 10:23
by Sebastiii
TurboX wrote: Thursday 20 July 2023 9:02 Hello @Sebastiii
I'm agree with you, the stream of the metered version seems to be an excellent option.
Perhaps, the best is to have an independant plugin (docker) which could provide data to MQTT with auto discovery.
Hello :)
Yes this is already the case, it wasn't working anymore after last firmware update but using the "commissioned token" permit to have it back :
https://community.jeedom.com/t/tuto-enp ... t/87453/64 ;)

But with this one, we can't get counter, still with stream/meter, we have data all seconds that permit to handle quickly device with a script, etc.

There is maybe a solution around another data to collect :
https://community.home-assistant.io/t/e ... 328668/689 from the URL : https://envoy.local/ivp/meters/readings

This need a big code to have proper value but seems to be possible it seems ;)

Re: enphase envoy with (HTTP) interface

Posted: Thursday 20 July 2023 12:14
by hemant5400z
Hi,

I have a Envoy-s standard https://envoy.local/ivp/meters/readings i just get [] so no data is available there.

I do get data from http://local-ip/production.json
http://local-ip/api/v1/production/inverters

I would like to use the rid idx.data to calculate the Lifetime, does anyone know to do that?

dz.devices('Enphase kWh Production').counterToday work but that one is not usable I need dz.devices('Enphase kWh Production').data but calling it does not work. :(

I get /dzVents/generated_scripts/Tellerstanden_Jaartotalen.lua:39: attempt to perform arithmetic on a nil value

Hemant

Re: enphase envoy with (HTTP) interface

Posted: Thursday 20 July 2023 13:20
by TurboX

Re: enphase envoy with (HTTP) interface

Posted: Thursday 20 July 2023 23:32
by AintBigAintClever
I've had to roll back to build 15369 as an upgrade on 15th July broke access to my Envoy S Metered (4-10-35 firmware, which according to the Enphase Installer Toolkit is up-to-date). Reverting to the backup brought the three kWh counters (IDs 00000901 to 00000903) back online.

Re: enphase envoy with (HTTP) interface

Posted: Friday 21 July 2023 13:05
by Sebastiii
Hello,

It seems that we have a solution, but this need to be coded on Domoticz !
To shame that I wasn't able to do it :(

https://community.home-assistant.io/t/e ... ach/594082

Re: enphase envoy with (HTTP) interface

Posted: Wednesday 26 July 2023 15:53
by Sebastiii
Hello,

So I'm trying to use NODE-RED to be able to see if I can get correct value and it seems yes :
This is what I sent to device to MQTT to get correct counter :

Using different address :
https://ENVOYIP/ivp/meters/readings :

Code: Select all

Envoy/Meters/Prod :
msg2.payload = {"command":"udevice","idx":2442,"nvalue":0,"svalue":((msg.payload[0].activePower) + ";" + (msg.payload[0].actEnergyDlvd * 1000))};

Envoy/Meters/Net : 
msg2.payload = {"command":"udevice","idx":2443,"nvalue":0,"svalue":((msg.payload[1].activePower) + ";" + (msg.payload[1].actEnergyDlvd * 1000))};
https://ENVOYIP/production.json (this is current code into Enphase integrated plugins)

Code: Select all

Envoy/Meters/Total :
msg2.payload = {"command":"udevice","idx":2441,"nvalue":0,"svalue":((msg.payload.consumption[0].wNow).toString() + ";" + (msg.payload.consumption[0].whLifetime).toString())};
https://ENVOYIP/stream/meter (this one supply all seconds current watt (Total/Prod/Net) useful to command device quickly !)

Code: Select all

Prod : 
msg1.payload = {"command":"udevice","idx":142,"nvalue":0,"svalue":((msg.payload.production["ph-a"].p).toString())};
Net : 
msg1.payload = {"command":"udevice","idx":143,"nvalue":0,"svalue":((msg.payload["net-consumption"]["ph-a"].p).toString())};
Total : 
msg1.payload = {"command":"udevice","idx":144,"nvalue":0,"svalue":((msg.payload["total-consumption"]["ph-a"].p).toString())};
So it can be nice to have it in default plugins :)
Above is for Monophased, for Triphased, it's possible too, value are present !

So we have to mix from 2 URLs, for this one (/ivp/meters/readings), the counter doesn't decrease when exporting is running for NET production !

Re: enphase envoy with (HTTP) interface

Posted: Thursday 27 July 2023 10:48
by Sebastiii
Hello,

I have tested another way from stream/meter URL with specific electric device (instant + counter) setup as "computed" like this, it doesn't rely on a counter, and we need that the data is always running.

But, this type of "computed" device decrease when value are negative, is it possible to add an option to avoid it ?
Thanks.

Re: enphase envoy with (HTTP) interface

Posted: Monday 31 July 2023 3:45
by Sebastiii
Hi,
Any news to take value from IVP url?
It works good from node red because counter doesn't decrease when value is negative from enphase envoy s.

And about an option to block decrease from a electric l'instant /counter) in computed mode?

Thanks