Home Assistant Community

Goodwe rest sensor for multiple json elements

templates
Tags: #<Tag:0x00007fcf4dd29d48>
#18

Just tried it, and all working this end.

How often does this sensor update, and is it possible to change the refresh time?

#19

Nice to see it is working.

I don’t have a clue how often it updates. If I look in my grafana dashboard which shows the data that home assistant exports to influxdb, i have a data point around every 2/3 minutes for this day. If you have a clue how to control it, please let me know.

#20

Hi there,
Nice to see this progress on a Goodwe integration.
I have also received info about native access instead of web scraping for which I’ll update the code… Soon ish

#21

I’ve added in the following so i can get an update every 5mins.

import datetime
from datetime import timedelta
MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=5)
#22

Can you share the information? I have some time until Monday to work on this. :slight_smile:

#23

Works awesome man! Thanks @TimmyBankers

#24

I added the code in this repository (cleaned up a bit).

Also found out that the scraping interval can be configured with config setting: scan_interval, and no code changes are required.

#25

I have 2 inverters but sensor is showing status only one of them :frowning:

#26

@jojoro, I think the json parsing part of the code just takes the first element of a list somewhere. This means the current code only supports the first inverter. Feel free to update the code. :slight_smile:

#27

Hello Everyone. I wish I could contribute, your work is amazing.
I am however a complete beginner. I have managed to get this working though.
Is it possible to display only some of the many attributes on the UI ?
Lets say PV voltage and current for example.

#28

Hello all,
I am also very new to Home Assistant, only a few weeks.
I have also managed to get this working.
It is possible to display only some atrributes on the UI.
I use this method:
platform: template
sensors:
invertersn:
value_template: “{{ states.sensor.sems_portal.attributes.sn }}”
pvvoltage1:
value_template: “{{ states.sensor.sems_portal.attributes.vpv1 }}”
pvvoltage2:
value_template: “{{ states.sensor.sems_portal.attributes.vpv2 }}”
I don’t know if this is the correct method but it will display the attributes sn,vpv1, vpv2
I hope this will help you a little more.

#29

Hallo Bart

Thank you very much, it work perfectly

#30

Hello,
You can use also the custom:state-attribute-element to get this info out of the sensor.sems_portal
(so that it wouldn’t create a sensor for every attribute you want to show)

https://github.com/custom-cards/state-attribute-element

Kind regards,

Bart

#31

Thanks Bart,

This works great!
Do you know if there is a way to return the value from each attribute as a number rather than as a text string?

I’d like to be able to graph the output over a period of time.

27%20pm

#32

Just create a sensor.
See below for my implementation (the spellingmistakes are intentional!)

##########################################################################
## Goodwe Inverter sensor
##########################################################################
sensor:
  - platform: sems
    username: 'your_id'
    password: 'your_pw'
    scan_interval: 900
  - platform: template
    sensors:
      pv_eday:
        value_template: '{{ states.sensor.sems_portal.attributes.eday }}'
        unit_of_measurement: 'kWh'
        friendly_name: "PV productie vandaag"
      pv_temperature:
        value_template: '{{ states.sensor.sems_portal.attributes.tempperature }}'
        unit_of_measurement: '°C'
        friendly_name: "Temperatuur Inverter"
      pv_thismonthetotle:
        value_template: '{{ states.sensor.sems_portal.attributes.thismonthetotle }}'
        unit_of_measurement: 'kWh'
        friendly_name: "Totaal deze maand"
      pv_lastmonthetotle:
        value_template: '{{ states.sensor.sems_portal.attributes.lastmonthetotle }}'
        unit_of_measurement: 'kWh'
        friendly_name: "Totaal t/m vorige maand"
      pv_output_power:
        value_template: '{{ states.sensor.sems_portal.attributes.outputpower }}'
        unit_of_measurement: 'W'
        friendly_name: "PV power"
#33

Issues after upgrading to 0.92? See here: https://github.com/TimSoethout/goodwe-sems-home-assistant/issues/3

#34

Did this work for you? I cant get it working. Could you possible share you files?

#35

I see I made a small typing mistake, the first needed { is not shown, sorry about that.

{
  "domain": "sems",
  "name": "Goodwe SEMS scraper",
  "documentation": "https://github.com/TimSoethout/goodwe-sems-home-assistant",
  "dependencies": [],
  "codeowners": [],
  "requirements": []
}

The issue-text on github has also been corrected.

#36

Thanks, I had already added the { but I also made a typo I now corrected. It’s working again.

#37

Any plans to change this from a scraper to a REST API call?
Documentation:
http://au.sems.com.cn:82/swagger/ui/index

E.g.

curl -X POST --header 'Accept: application/json' --header 'token: {"uid": "[redacted]","timestamp": 1558143769193,"token": "[redacted]","client": "web","version": "","language": "en-GB" }' 'http://au.semsportal.com:82/api/v2/Common/GetApis'

Payload

{
  "language": "en-gb",
  "function": null,
  "hasError": false,
  "msg": "success",
  "code": "0",
  "data": [
    "http://au.semsportal.com:82/api",
    "http://eu.semsportal.com:82/api",
    "http://hk.semsportal.com:82/api",
    "http://192.168.1.114:8080/api",
    "http://192.168.1.114:8888/api",
    "http://192.168.90.32:8821/api"
  ],
  "components": {
    "para": "{}",
    "langVer": 4,
    "timeSpan": 0,
    "api": "http://au.semsportal.com:82/api/v2/Common/GetApis"
  }