Enphase power monitoring

Hi,

It took some time but I think I have found and solved the errors in the ENVOY PV read-out plug-in by elordude
I have modified the files D_ENVOY.json and I_ENVOY.xml
As far I could check today the figures Current power, Energy today, Energy this week and Energy lifetime are correct imported.
I also managed to show the first tree figures in the device
There is still a field “System uptime” that is empty but I did not spend any time on that yet

Installation of the attached files via:
APPS/Develop APPS/Luup files
Upload the files from your computer
Check the box “Restart Luup after upload”

Then:
APPS/Develop APPS/Create device
Fill in the name of your device e.g. Envoy in the field Description
Fill in D_ENVOY.xml in the field Upnp Device Filename
Finally fill in the IP address of your Envoy in the appropriate field in the new created device

Regards,
Jacob

This is awesome! Thanks for fixing my crappy code - works much better now - I was learning how to code in Lua (still learning) while creating this plugin. This plugin + Datamine are the best

regards
Harry

Is there a way to expose the variables such that they can be used a triggers in a scene?

It would be nice to do something like
If power>1000 then turn on X

I don’t live in a net metering state :frowning: so I need to match my power production to consumption. So if my power production exceeded my base usage I could turn on various appliances while my production is high enough.

Some combination of the Power Arithmetic plugin, PLEG and/or Combination Switch should do the job.

Hi,
I added the Life time and System up time readings and made some better handling incase some values are in Wh instead of KWh. Also made the control look a little cleaner with UI5.

As this was my first ever lua coding it took me hours more than I expected, but it works :wink:

Cheers Rene.

elordude, Jacob, reneboer:
Thank you so much for sharing your efforts with the rest of us.

I’m using the latest files uploaded here, but there appears to be a bug with “This Week” and “Lifetime Energy” numerical values being the same (“This Week” not correct). Can anyone confirm/fix? Thanks.

KKL,

I have the same issue i will take ca look at the code and come up with a fix - it might take me few days since I have to test it during the day when there is solar power

regards
Harry

Hi kkl, elordude,

I remember seeing this for a short moment as well, but it cleared for some reason ???. Are you still seeing it after a reload?

The only minor tweak I made since this version is on the uptime string, adding - 1, but that is just cosmetic:
local SysUpDate = string.sub(ENVOY_Raw,s_end,ut_end - 1)

Cheers Rene

Hi gents,
I have not touched the plugin after the modification by reneboer and it is working perfectly
Jacob

I am still seeing it after reboot. The way I installed it was to follow Jacob’s instructions, using two of those files, and the other two from reneboer’s post.

I’m excited to get my Enphase solar tied in with my Vera. I uploaded the four files (and the two updates), created the generic device, added the device name and IP address of the Envoy… but still nothing. I added the DataMine app, still nothing. I feel like such a NOOB.

Could someone step through the install of everything ??? … slowly? :slight_smile:

Thanks!

I got my Enphase/Envoy system installed yesterday and was thrilled to see you guys have developed this. I tried to follow these instructions to the letter:

[quote=“Jacob, post:21, topic:171972”]Hi,

It took some time but I think I have found and solved the errors in the ENVOY PV read-out plug-in by elordude
I have modified the files D_ENVOY.json and I_ENVOY.xml
As far I could check today the figures Current power, Energy today, Energy this week and Energy lifetime are correct imported.
I also managed to show the first tree figures in the device
There is still a field “System uptime” that is empty but I did not spend any time on that yet

Installation of the attached files via:
APPS/Develop APPS/Luup files
Upload the files from your computer
Check the box “Restart Luup after upload”

Then:
APPS/Develop APPS/Create device
Fill in the name of your device e.g. Envoy in the field Description
Fill in D_ENVOY.xml in the field Upnp Device Filename
Finally fill in the IP address of your Envoy in the appropriate field in the new created device

Regards,
Jacob[/quote]

But when I restart the system I see the following error:
Envoy[113] : Startup Lua Failed
The device shows the today power in kWh but no data is shown for the Power or This week. I am running UI7 right now and am pretty new to device creation and luup. What am I doing wrong? Any help will be greatly appreciated.

Cheers

I just worked on installing the same plugin and had the same issue. Finally sorted it out to a change in the formatting of the web site reporting the data figures. I have made corrections to the I_Envoy.xml file.

Also, while researching the issue discovered that an API call now exists for the monitor locally - provided you have upgraded the firmware. Site address is

http:///api/v1/production

This would be a much cleaner way to get the data. I plan on making the change to this code when I have time.

Well, I went ahead and made the changes to use the new API - much cleaner without all of the error handling needed for units.

Thanks Robert,

This is a lot cleaner interface indeed.

Cheers Rene

This is great - I was not aware of the local API - thanks for cleaning up my code :wink:

Harry

@robertgabrielson

I have installed your file and it works perfect
However there is a lay-out error in the Devices view (UI7)

I tried to correct this in the D_Envoy.json file but so far without succes.
Im I looking in the right direction?

“Control”: [
{
“ControlGroup”:“1”,
“ControlPair”:“1”,
“ControlType”:“label”,
“top”: 0,
“left”: 0,
“text_align”: “left”,
“Label”: {
“lang_tag”: “power”,
“text”: “Power :”
},
“Display”: {
“Top”: 60,
“Left”: 50,
“Width”: 85,
“Height”: 20
}
},
{
“ControlGroup”:“1”,
“ControlPair”:“1”,
“ControlType”:“variable”,
“top”: 0,
“left”: 0.5,
“text_align”: “right”,
“Display”: {
“Service”: “urn:micasaverde-com:serviceId:EnergyMetering1”,
“Variable”: “Watts”,
“Top”: 60,
“Left”: 190, // should this be modified?
“Width”: 55,
“Height”: 20
}
},
{
“ControlGroup”:“1”,
“ControlPair”:“1”,
“ControlType”:“label”,
“top”: 0,
“left”: 1.5,
“text_align”: “left”,
“Label”: {
“lang_tag”: “watts”,
“text”: “W”
},

Noticed this too, i’m a Lua newbie so trying to figure it out myself. Yes, I believe thats the right area. Ill keep plugging away at it.

I Think I have found it.
The control group column controls the location

{
				"ControlGroup":"1", 
				"ControlPair":"1",
				"ControlType":"variable",
				"top": 0,
				"left": 1,                       // Changed from 0,5 to 1 resulted in better positioning
				"text_align": "right",
				"Display": {
					"Service": "urn:micasaverde-com:serviceId:EnergyMetering1",
					"Variable": "Watts",
					"Top": 60,
					"Left": 190,         // This one controls the location on the detailed display
					"Width": 55,
					"Height": 20 
				}

Hi,

There is a significant difference between UI5/6 and UI7 in this. Before the default width of a scene group was 3 button witdths, i.e. “x”: “3” even if you set it to 1, 2 or 6. And if you want to make it wider, the device on the panel had to get wider as well (“x”>“4” in the top definition) else the values would not be shown.

However, with the new UI7 layout, the width of the device is fixed. Now the scene group x means the number of columns you like to use and you can make it 1, 2, 3 or 15. The higher the number of columns, the narrower they get. If you now position a control in the control group mapping to that scene group you place the control relative of the number of columns. Example will help;
SceneGroup “x”: “1”, means you can use a value between 0 and 1 from left to right.
SceneGroup “x”: “3”, means left 0 -1 is first column, 1-2 is second and 2-3 is third, but still on that same left to right width.

I think the quickest and most compatible change is to SceneGroup with “id”: “1” and change “x”: “6” to “x”: “3”. I cannot test my assumption right now, but give it a shot.

Cheers Rene.