Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enphase: energy and power empty #17817

Open
1 task done
othi opened this issue Dec 19, 2024 · 3 comments
Open
1 task done

enphase: energy and power empty #17817

othi opened this issue Dec 19, 2024 · 3 comments
Assignees
Labels
devices Specific device support

Comments

@othi
Copy link
Contributor

othi commented Dec 19, 2024

Describe the bug

My Enphase Envoy API returns the following at the URL http://{{ .host }}/production.json:
{"production":[{"type":"inverters","activeCount":22,"readingTime":1734616504,"wNow":207,"whLifetime":6787031}],"storage":[{"type":"acb","activeCount":0,"readingTime":0,"wNow":0,"whNow":0,"state":"idle"}]}

The jq query as defined here

jq: if .production[] | select(.measurementType == "production").activeCount >= 1 then .production[] | select(.measurementType == "production").wNow else .production[] | select(.type == "inverters").wNow end
does not return anything.

(.production[] | select(.measurementType == "production").wNow) // (.production[] | select(.type == "inverters").wNow) does work for me but I don't have an instance that returns measurementType so I can't be sure if the jq is correct. It's probably missing the activeCount check.

The same is true for

jq: if .production[] | select(.measurementType == "production").activeCount >= 1 then .production[] | select(.measurementType == "production").whLifetime else .production[] | select(.type == "inverters").whLifetime end
replacing wNow with whLifetime

Steps to reproduce

  1. Configure an Enphase meter in PV mode
  2. Start evcc

Configuration details

- name: enphase
    type: template
    template: enphase
    usage: pv
    host: 192.168.xx.xx # IP-Adresse oder Hostname
    token: eyJraW...

Log details

[site ] ERROR 2024/12/19 14:46:02 pv 1 power: jq: empty result
[site ] DEBUG 2024/12/19 14:46:02 pv power: 0W

What type of operating system are you running?

HomeAssistant Add-on

Nightly build

  • I have verified that the issue is reproducible with the latest nightly build

Version

0.131.12

@othi othi changed the title enphase: pv and power empty enphase: energy and power empty Dec 19, 2024
@andig
Copy link
Member

andig commented Dec 19, 2024

/cc @premultiply @ivoks

@andig andig added the devices Specific device support label Dec 19, 2024
@ivoks
Copy link
Contributor

ivoks commented Dec 20, 2024

I see. Assumption was that the key are universal, but it seems that they are not. We need to check if they exist before we use them. I'll try to work on this today. @othi does production.json?details=1 return different set of keys? I see you are using http, and not https, so you have an older firmware too (not using tokens for auth)?

@othi
Copy link
Contributor Author

othi commented Dec 20, 2024

The enphase template uses http itself:

uri: http://{{ .host }}/production.json

but it returns a 301 to the https URL anyway.

My gateway is on firmware 8.2.4264, which seems to be fairly recent (november 2024), and I do use a token.

As for the output of production.json?details=1:

# curl -H "Authorization: Bearer eyJra..." https://192.168.xx.xx/production.json?details=1
{"production":[{"type":"inverters","activeCount":22,"readingTime":1734687932,"wNow":442,"whLifetime":6788138}],"storage":[{"type":"acb","activeCount":0,"readingTime":0,"wNow":0,"whNow":0,"state":"idle"}]}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devices Specific device support
Projects
None yet
Development

No branches or pull requests

4 participants