Help needed with new sensor solar component. (almost there)

Hi there,

I’m not a programmer at all, though i’m trying to create a new component to read out the data from my solar inverter.

I have previously made a python script which worked, but then I found out I needed to use Pypi for all new components. This is where i’m stuck at the moment.

The code which is working can be found at:

The code which isn’t working can be found here:

Pypi code which belongs to the above components can be found at:

I hope someone is willing to help me with the code and/or point me in the right direction.
I feel that it is something small. Especially for a programmer.

Regards,
Passie

Great effort, unfortunately I have no python skills to help you.
I also have a zeversolar inverter. Would be great to be able to use this with HA.

Did you already managed to get it working? If not, I hope someone from the community is able to support!

I have stopped development of this component.
You can connect with the Zeversolar cloud via the REST component.

Hi @passie, I am new to HA.
Would you be able to share how?
Thanks in advance

Regards, Duff

Hi @Duff78,

Welcome to home assistant and the forum.
No problem with sharing my configuration.

I’m currently using the following configuration in my setup.

  - platform: rest
    resource: https://www.zevercloud.com/api/v1/getPlantOverview?key=<your_api_key>
    json_attributes:
      - E-Today
      - E-Month
      - E-Total
      - TotalYield
      - CO2Avoided
      - Power
    name: zeversolar
    value_template: 'OK'
  - platform: template
    sensors:
      e_today_value:
        value_template: '{{ states.sensor.zeversolar.attributes["E-Today"]["value"] }}'
        unit_of_measurement: "kWh"
      e_month_value:
        value_template: '{{ states.sensor.zeversolar.attributes["E-Month"]["value"] }}'
        unit_of_measurement: "kWh"
      e_total_value:
        value_template: '{{ states.sensor.zeversolar.attributes["E-Total"]["value"] }}'
        unit_of_measurement: "MWh"
      totalyield_value:
        value_template: '{{ states.sensor.zeversolar.attributes["TotalYield"]["value"] }}'
        unit_of_measurement: "€"
      co2avoided_value:
        value_template: '{{ states.sensor.zeversolar.attributes["CO2Avoided"]["value"] }}'
        unit_of_measurement: "T"
      power_value:
        value_template: '{{ states.sensor.zeversolar.attributes["Power"]["value"] }}'
        unit_of_measurement: "W"

You can find your API key on the Zevercloud website.
On the Zevercloud website goto Configuration --> Plant configuration and scroll to the bottom.
There you find your API key.

Let me know if you ran into any problem, I’ll try to help you out.

Regards,
Passie

Hi Passie,

Thanks a lot for the help.
Works like a charm :+1:t2:

Regards, Gijs

Hi Passie,

I cheered too soon. Today I get errors for every value. First I thought it was because the sun wasn’t up and my PV didn’t turn on yet. But now still nothing. The graphs under the history section don’t register any power generation as well. Do you have any ideas or suggestions?

Thanks a lot

Logboekdetails ( ERROR )

Sat Nov 23 2019 11:05:31 GMT+0100 (Central European Standard Time)

Could not render template power_value: UndefinedError: ‘mappingproxy object’ has no attribute ‘Power’

Could you paste the config you have now?
And what do you get if you go to the url, are you getting json back?

Hi,

Dit is wat ik in m’n config heb staan.

sensor:
#Zeversolar PV sensor (https)
  - platform: rest
    resource: https://www.zevercloud.com/api/v1/getPlantOverview?key= !secret ZEVERSOLAR_API
    json_attributes:
      - E-Today
      - E-Month
      - E-Total
      - TotalYield
      - CO2Avoided
      - Power
    name: zeversolar
    value_template: 'OK'
  - platform: template
    sensors:
      e_today_value:
        value_template: '{{ states.sensor.zeversolar.attributes["E-Today"]["value"] }}'
        unit_of_measurement: "kWh"
      e_month_value:
        value_template: '{{ states.sensor.zeversolar.attributes["E-Month"]["value"] }}'
        unit_of_measurement: "kWh"
      e_total_value:
        value_template: '{{ states.sensor.zeversolar.attributes["E-Total"]["value"] }}'
        unit_of_measurement: "MWh"
      totalyield_value:
        value_template: '{{ states.sensor.zeversolar.attributes["TotalYield"]["value"] }}'
        unit_of_measurement: "€"
      co2avoided_value:
        value_template: '{{ states.sensor.zeversolar.attributes["CO2Avoided"]["value"] }}'
        unit_of_measurement: "T"
      power_value:
        value_template: '{{ states.sensor.zeversolar.attributes["Power"]["value"] }}'
        unit_of_measurement: "W"

Zie in de log een aantal meldingen staan.
Zal er een paar sturen als de PV aan gaat

mvg, Gijs

Why is there a space between your getPlantOverview?key= and !secret ? (not sure if this is the problem)
Besides that. It looks similar to my configuration.

btw: Please answer in English so everybody else could learn from it as well.

Hi Passie,

I put the API back in the config, because removing the space didn’t help. Now it works again.

The cause was a combination of router losing connection in combination with the space in the API key. I don’t know if it is just me, but some of the error messages on HA are leading me on a wild goose chase.

Passie, thanks again

1 Like

Checkout this https://github.com/CheongKoo/HA_AppDaemonZeverSolar.

I have it working and it seems to be work fine (just got it working). Just the real-time power value in kW and it seems about 5 minutes quicker than getting the ZeverCloud data (that flicks between W and kW so is difficult to plot or use for automations).

Hello,

@passie
I’ve been using your code successfully for several months. Over a week it stopped working and I’m getting the following error in HA

Error fetching data: https://www.zevercloud.com/api/v1/getPlantOverview?key=<my API key> failed with HTTPSConnectionPool(host='www.zevercloud.com', port=443): Read timed out. (read timeout=10)

I have got onto the Zevercloud and they said that they stopped using the old API and sent me a document referring to the new one. Zevercloud New API

I gave it a go trying to use Http request but have no developer skills and got nothing at the end. Can you have look yourself and see is it working for you

Let me get back on that. Mine has also stopped working.

As a work around you could use pvoutput. Within pvoutput you can configure your solar app + api key.
I don’t know how to do this via curl / rest.

Is it possible that you’ve linked the old document? Last revision date is 2018-01-04 and also the filename indicates this is an old document(“Zevercloud api-en2018-04-18.pdf”)?

I have been onto Zevercloud twice and that’s what I have got. You’re wright about the dates, they don’t make sense.
As far as I can understant the document, apart from from AppKey and APPsecret that are assigned by zevercloud you also need to use a signature. The signature is given by some other gateway like Alibaba. Hovewer I’m not a developer and I don’t fully understant the whole mechanism of using all those required parameters to retrieve the plant data.
The AppKey and APPsecret can be found in zevercloud account management settings.

Instead of going to the main site, i’ve just grabbed it directly from the inverter. Can probably do this with scrape too, but this was easier for me.

  - platform: command_line
    command: python3 -c "import requests; print(requests.get('http://192.168.1.131/home.cgi').text)"
    name: "Zeversolar - current power"
    value_template: "{{ value.split('\n')[10] }}"
    unit_of_measurement: 'W'
  - platform: command_line
    command: python3 -c "import requests; print(requests.get('http://192.168.1.131/home.cgi').text)"
    name: "Zeversolar - energy today"
    value_template: "{{ value.split('\n')[11] }}"
    unit_of_measurement: 'kWh'

I have just checked it on mine and it’s working. To be honest, the two parameters are good enough for me.

Thanks for sharing

1 Like

Got the API working with an Python script, command line sensor and templates:

1 Like