Help Reading JSON from Auroravision API (Solar Inverter Data)

I’ve been trying to read data from the ABB Auroravision platform using a JSON query to their service. I can authenticate and retrieve the JSON, but I’m having issues filtering it and have been going in circles trying to get the right configuration.

I’ve removed some of the personally identifiable information so please ignore the brackets.

Desired Outcome: I’m trying to get the “Today” KWH value so I can display it as part of my dashboard.

Current Platform Configuration:

  - platform: rest
    name: Aurora_API
    resource: https://easyview.auroravision.net/easyview/services/gmi/summary/PlantEnergy.json?eids=<ID Goes Here>
    username: <Account Goes Here>
    password: <Password Goes Here>
    authentication: basic
    scan_interval: 900

Current Returned JSON:

{"status":"SUCCESS","fields":[
{"type":"instant","field":"GenerationPower","label":"now","entityId":111,"entityName":"Residence","timeZone":"ACT","units":"kilowatts","parameters":[],"start":1567824300000,"startLabel":"2019-09-07 12:15:00 CST","end":1567824300000,"endLabel":"2019-09-07 12:15:00 CST","value":"3.018246582031"},
{"type":"window","field":"GenerationEnergy","label":"today","entityId":111,"entityName":"Residence","timeZone":"ACT","units":"kilowatt-hours","parameters":[{"value":"60","name":"DataItem.now.maxCacheAge"},{"value":"true","name":"SummaryRequest"}],"start":1567753200000,"startLabel":"20190906163000","end":1567824625333,"endLabel":"20190907122025","sampleStart":1567753201000,"sampleStartLabel":"20190906163001","sampleEnd":1567824300000,"sampleEndLabel":"20190907121500","value":"14.762"},
{"type":"window","field":"GenerationEnergy","label":"week","entityId":111,"entityName":"Residence","timeZone":"ACT","units":"kilowatt-hours","parameters":[{"value":"60","name":"DataItem.now.maxCacheAge"},{"value":"true","name":"SummaryRequest"}],"start":1567321200000,"startLabel":"20190901163000","end":1567824625333,"endLabel":"20190907122025","sampleStart":1567321212000,"sampleStartLabel":"20190901163012","sampleEnd":1567824300000,"sampleEndLabel":"20190907121500","value":"121.37"},
{"type":"window","field":"GenerationEnergy","label":"month","entityId":111,"entityName":"Residence","timeZone":"ACT","units":"kilowatt-hours","parameters":[{"value":"60","name":"DataItem.now.maxCacheAge"},{"value":"true","name":"SummaryRequest"}],"start":1567321200000,"startLabel":"20190901163000","end":1567824625333,"endLabel":"20190907122025","sampleStart":1567321212000,"sampleStartLabel":"20190901163012","sampleEnd":1567824300000,"sampleEndLabel":"20190907121500","value":"121.37"},
{"type":"window","field":"GenerationEnergy","label":"lifetime","entityId":111,"entityName":"Residence","timeZone":"ACT","units":"kilowatt-hours","parameters":[{"value":"60","name":"DataItem.now.maxCacheAge"},{"value":"true","name":"SummaryRequest"}],"start":631152000000,"startLabel":"19900101093000","end":1567824625333,"endLabel":"20190907122025","sampleStart":1561694992000,"sampleStartLabel":"20190628133952","sampleEnd":1567824300000,"sampleEndLabel":"20190907121500","value":"1164.833"}]
,"timestamp":1567824625562}

I’ve played around with the sensors and using “value_template” but I’m doing my head in. I can get the right value by placing “{{ my_test_json.fields[1].value }}” in the template test area, but the configuration.yaml doesn’t want to play ball (and I don’t like using static array identifiers in case ABB change the ordering).

Any help (brutal or otherwise) would be much appreciated. It will be something simple I’m missing.

I’m just about to purchase one of these inverters, and wanting to confirm I can integrate into Home Assistant before purchasing.

Did you manage to get this working?

Can you share any screenshots of what you acheived?

As far as reading JSON from the cloud, still working out the filtering on that (I admit, I put it aside and haven’t got back to it).

If you’re interested in just getting the “point in time” reading from the inverter its just a matter of connecting to the register using modbus. This will give you the current AC output of the inverter which you can use to trigger any particular automations.

modbus:
  type: tcp
  host: 192.168.1.XXX
  port: 502

Sensor configuration below:

sensor:
  - platform: modbus
    scan_interval: 60
    registers:
    - name: Inverter_currentPower
      slave: 1
      register: 40088
      register_type: holding
      unit_of_measurement: W
      count: 1
      scale: 10
      offset: 0
      precision: 1
      data_type: int

Dodgy makeshift screenshot until I get myself together and come up with something prettier:

Inverter

In that case you’ll need to iterate through the data’s list to find the information you want. For example this looks for label == 'today' and returns the contents of its value field (which happens to be 14.762).

{% for field in value_json.fields %}
  {% if field.label == 'today' %}
    {{ field.value }}
  {% endif %}
{% endfor %}
1 Like

Thanks Taras!

That did the trick. I’ll look into different cards to make it a bit more asthetically pleasing, but it gets the information I was after.

  - platform: rest
    name: Aurora_API_Today
    resource: https://easyview.auroravision.net/easyview/services/gmi/summary/PlantEnergy.json?eids=<SiteID>&tz=<timezone>&nDays=0%2C6%2C29&now=false&dateLabel=yyyy-MM-dd+HH%3Amm%3Ass+zzz&locale=en&fields=GenerationEnergy&v=2.1.52
    username: <username>
    password: <password>
    authentication: basic
    scan_interval: 900
    value_template: > 
       {% for field in value_json.fields %}{% if field.label == 'today' %}{{ field.value }}{% endif %}{% endfor %}
    unit_of_measurement: kWh

If you need your particular URL, the easiest way (this is in chrome) is to visit https://easyview.auroravision.net/easyview/ , Open Developer Tools (F12) and look at the “Network” tab. You’re looking for the line that starts with “PlantEnergy.json”.

Copy the link and you’re away!

3 Likes

I don’t know if it’s possible to encounter the situation where the data fails to contains the label you want. Should you believe this can happen, then this version will report unknown.

{% set x = 'unknown' %}
{% for field in value_json.fields %}
  {% if field.label == 'today' %}
    {% set x = field.value %}
  {% endif %}
{% endfor %}
{{ x }}

Where can I find the API documentation?

1 Like

Também estou interessado em como obter acesso a documentação e a chave API.

Hi,
Could u share the code that allows to create the “inverter_currentPower” graph?
Thanks.

Hi
Thanks a lot. I have managed to add the “energy today” sensor using this thread but also would like to add the current energy, i did it like this but the second sensor does not work. What am I doing wrong?

sensor:
  - platform: rest
    name: Aurora_API_Today
    resource: https://easyview.auroravision.net/easyview/services/gmi/summary/PlantEnergy.json?eids=<ID>&tz=Europe/Amsterdam&nDays=0%2C6%2C29&now=false&dateLabel=yyyy-MM-dd+HH%3Amm%3Ass+zzz&locale=en&fields=GenerationEnergy&v=2.1.52
    username: <username>
    password: <password>
    authentication: basic
    scan_interval: 900
    value_template: > 
       {% for field in value_json.fields %}{% if field.label == 'today' %}{{ field.value }}{% endif %}{% endfor %}
    unit_of_measurement: kWh
    
  - platform: rest
    name: Aurora_API_Now
    resource: https://easyview.auroravision.net/easyview/services/gmi/summary/PlantEnergy.json?eids=<ID>&tz=Europe/Amsterdam&nDays=0%2C6%2C29&now=false&dateLabel=yyyy-MM-dd+HH%3Amm%3Ass+zzz&locale=en&fields=GenerationEnergy&v=2.1.52
    username: <username>
    password: <password>
    authentication: basic
    scan_interval: 900
    value_template: > 
       {% for field in value_json.fields %}{% if field.label == 'now' %}{{ field.value }}{% endif %}{% endfor %}
    unit_of_measurement: Watt

You specified “now=false” in your json query, therefore you don’t get the “now” value at all.

Try this:

resource: https://easyview.auroravision.net/easyview/services/gmi/summary/PlantEnergy.json?eids=<ID>