Giter Club home page Giter Club logo

goodwe-sems-home-assistant's Introduction

GoodWe SEMS API integration for Home Assistant

Paypal-shield Buy Me A Coffee

Integration for Home Assistant that retrieves PV data from GoodWe SEMS API.

Setup

Easiest install method via HACS

hacs_badge

The repository folder structure is compatible with HACS and is included by default in HACS.

Install HACS via: https://hacs.xyz/docs/installation/manual. Then search for "SEMS" in the Integrations tab (under Community). Click HACS > Integrations > Explore and Download Repositories > search for SEMS > click the result > Download.

Manual Setup

Crude sensor for Home Assistant that scrapes from GoodWe SEMS portal. Copy all the files in custom_components/sems/ to custom_components/sems/ your Home Assistant config dir.

Configure integration

The required ID of your Power Station can be retrieved by logging in to the SEMS Portal with your credentials: https://www.semsportal.com

After login you'll see the ID in your URL, e.g.: https://semsportal.com/PowerStation/PowerStatusSnMin/12345678-1234-1234-1234-123456789012

In this example the ID of the Power Station is: 12345678-1234-1234-1234-123456789012

In the home assistant GUI, go to Configuration > Integrations and click the Add Integration button. Search for GoodWe SEMS API.

Fill in the required configuration and it should find your inverters.

Note that changed to configuration.yaml are no longer necessary and can be removed.

Optional: control the invertor power output via the "switch" entity

It is possible to temporarily pause the energy production via "downtime" functionality available on the invertor. This is exposed as a switch and can be used in your own automations.

Please note that it is using an undocumented API and can take a few minutes for the invertor to pick up the change. It takes approx 60 seconds to start again when the invertor is in a downtime mode.

Recommended: use visitor account if you do not need to control the inverter

In case you are only reading the inverter stats, you can use a Visitor (read-only) account.

Create via the official app, or via the web portal: Login to www.semsportal.com, go to https://semsportal.com/powerstation/stationInfonew. Create a new visitor account. Login to the visitor account once to accept the EULA. Now you should be able to use it in this component.

Extra (optional) templates to easy access data as sensors

Replace $NAME with your inverter entity id.

  - platform: template
    sensors:
      pv_temperature:
        value_template: '{{ states.sensor.inverter_$NAME.attributes.tempperature }}'
        unit_of_measurement: 'C'
        friendly_name: "PV Temperature"
      pv_eday:
        value_template: '{{ states.sensor.inverter_$NAME.attributes.eday }}'
        unit_of_measurement: 'kWh'
        friendly_name: "PV energy day"
      pv_etotal:
        value_template: '{{ states.sensor.inverter_$NAME.attributes.etotal }}'
        unit_of_measurement: 'kWh'
        friendly_name: "PV energy total"
      pv_iday:
        value_template: '{{ states.sensor.inverter_$NAME.attributes.iday }}'
        unit_of_measurement: ''
        friendly_name: "PV income day"
      pv_itotal:
        value_template: '{{ states.sensor.inverter_$NAME.attributes.itotal }}'
        unit_of_measurement: ''
        friendly_name: "PV income total"
      pv_excess:
        value_template: '{{ states.sensor.inverter_$NAME.attributes.pmeter }}'
        unit_of_measurement: 'W'
        friendly_name: "PV spare"
      # battery soc
      pv_soc:
        value_template: '{{ states.sensor.inverter_$NAME.attributes.soc }}'
        unit_of_measurement: '%'
        friendly_name: "Battery power"

Note that states.sensor.inverter_$NAME.state contains the power output in W.

Screenies

Detail window

Add as Integration

Integration configuration flow

Debug info

Add the last line in configuration.yaml in the relevant part of logger:

logger:
  default: info
  logs:
    custom_components.sems: debug

Notes

  • Sometimes the SEMS API is a bit slow, so time-out messages may occur in the log as [ERROR]. The component should continue to work normally and try fetch again the next minute.

Development setup

Credits

Inspired by https://github.com/Sprk-nl/goodwe_sems_portal_scraper and https://github.com/bouwew/sems2mqtt . Also supported by generous contributions by various helpful community members.

goodwe-sems-home-assistant's People

Contributors

ads5555 avatar darek-margas avatar denifia avatar jacmatias avatar markruys avatar michaelthomasmpt avatar mkonecny-atlassian avatar philipbrennan avatar sjoerd-creator avatar spockz avatar timsoethout avatar tuxick avatar vpotusflotus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

goodwe-sems-home-assistant's Issues

Can not open config flow

Tim,
Bedankt voor je script,
Ik heb denk ik de files gecopieerd maar bij toepassing start sems niet en krijg ik de opmerking dat config flow niet te openen is.
Doe ik iets fout?

HACS SEMS Warning

You are using a custom integration for sems which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
19:15:36 – loader.py (WARNING)

But working perfectly - Thank you for you works

data is not updated

Hello, I have installed this component in Hassio and the data is not updated, only if I restart Hassio makes a new reading of the data. regards

Attributes not available anymore

After the update of HA to 2021.8 and SEMS to 3.3 the attributes are not available anymore. One entity is available (sensor.inverter_none_energy) with the state for 'total generation' and the following attributes:
state_class
last_reset
unit_of_measurement
friendly_name
device_class

Non of the other values are available anymore

Additional information ie. Daily power generation

Hey guys,

Looking for some help. I installed the integration and I'm getting current power generation and total power generated however how can I get the information for daily generation onto my overview page?

I'm a bit of a noob so please be gentle. Any help would be greatly appreciated.

Setting last_reset is deprecated and will be unsupported from Home Assistant Core 2021.11

Hi,

Since the latest upgrade of Home Assistant below warning is showing up in the log.

WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.inverter_gw3600d_ns_energy (<class 'custom_components.sems.sensor.SemsStatisticsSensor'>) with state_class measurement has set last_reset. Setting last_reset is deprecated and will be unsupported from Home Assistant Core 2021.11. Please update your configuration if state_class is manually configured, otherwise report it to the custom component author.

Is this something I can fix?

Or does the integration need an update?

Thanks for your help.

Energy Monitor Home Assistant

Hey Tim,

First a big thank you for making this. I’m using it almost a year and it’s working great.

But I have a question. Home Assistant has a new Energy monitor (2021.8). And I’m using your setup to get all things that I want in Home Assistant. But i don’t see my power return in this Energy monitor. I do have it as a entity.

Do you know how I can get this now to use it in the new Home Assistant Energy Monitor.
https://developers.home-assistant.io/docs/core/entity/sensor#long-term-statistics

Thanks in advance,
Marco

HA Naming

I am converting the custom component from Sensors -> Sems.py into Sems -> sensor.py, however when i do this, i get that Sensor_sems isnt a valid component. I am yet to upgrade to 91.4 from 90.1, as i wanted to make sure this worked before going ahead. Any help would be great!

Goodwe Homekit

Great work on the addition of the Homekit sensor.
The data from this sensor in HA I have worked out from the data and comparing to my SEMS screen is the "consumption".

This sensor however is not available in the drop down box when trying to configure HA Energy.
This is also the same for trying to add any other Goodwe sensor to the HA Energy, they are not available to select to "add solar production", "add consumption" or "add return".

The Goodwe homekit has 2 CT's one reads solar production and the other reads the "feed from" or "return to" the grid.
From here consumption should just be a calculation of solar production, plus minus feed to or from the grid.
This is obviously how the SEMS portal calculates it.
I think we should be seeing 3 Homekit sensors. (From/to grid, consumption, solar production)

Not being able to add the Homekit sensor to HA is aparrantly due to the setup/coding of the sensor;
This is what HA says:
You’re configuring a statistic but you couldn’t find your source in the dropdown? That’s caused by a bug in the integration providing the entity. Integrations need to configure their entities correctly so Home Assistant knows that we need to track statistics for it and how.

Open an issue with the author of the integration and link them to https://developers.home-assistant.io/docs/core/entity/sensor#long-term-statistics.

Do not show attributes

Dear sir,
After I have updated your integrations, which worked perfectly before, I cannot use the attributes for the inverter in a card. If I open the entity, I can see the attributes like you show in the readme text.
I have changed the name in the template in configuration.yaml but nothing happens.

sensor:
- platform: template
sensors:
pv_outputpower:
value_template: '{{ states.sensor.inverter_atahualpa.attributes.outputpower }}'
unit_of_measurement: 'W'
friendly_name: "Producción de las placas"
pv_temperature:
value_template: '{{ states.sensor.inverter_atahualpa.attributes.tempperature }}'
unit_of_measurement: 'C'
friendly_name: "Temperatura de las placas"

Do you have any idea about this problem?
Thank you very much in advanced.

Unable to fetch data from SEMS. 'NoneType' object is not subscriptable

Hi I've just noticed some errors and the SEMS integration stopping recently. I get the following 2 errors Unable to fetch data from SEMS. 'NoneType' object is not subscriptable and Unable to fetch data from SEMS. Expecting value: line 1 column 1 (char 0). I'm running the latest code, API version. Any help would be greatly appreciated, cheers.

warning with 2021.9.2 : Setting last_reset is deprecated and will be unsupported from 2021.11

I've got a warning in the logging when starting Home Assistant 2021.9.2:

Entity sensor.inverter_goodwe3000_energy (<class 'custom_components.sems.sensor.SemsStatisticsSensor'>) with state_class measurement has set last_reset. Setting last_reset is deprecated and will be unsupported from Home Assistant Core 2021.11.

I think this is the change needed: https://developers.home-assistant.io/blog/2021/08/16/state_class_total/

related to #49

Error " unexpected state class " for sensor since homeasstant 2021.9

Since last update of home assistant (2021.9) , things seem to have changed for energy sensors.
I get below error for the SEMS sensor (also for all other energy logging sensors)

Unexpected state class
The following entities do not have the expected state class 'total_increasing'

image

Attributes show unavailable

My added attributes are not working they are all showing as unavailable, I replaced $NAME with Goodwe (Thats how it is called in Home assistant)

This is an example of the first attribute in my configuration.yaml:

sensor:
platform: template
sensors:
pv_outputpower:
value_template: '{{ states.sensor.inverter_Goodwe.attributes.outputpower }}'
unit_of_measurement: 'W'
friendly_name: "PV Power output"

Not detecting Invertor

Hi. I installed this integration and followed the instructions. I put my username (email), password and ID from the SEMS website, as instructed and no inverter is detected. I checked the log and it says error. Please help

Found a better API

While decompiling the Solargo app I found a better API that's refreshes the data more often and results in less errors

Get token:
POST /api/Solargo/Login HTTP/1.1 Host: solargo.sems.com.cn language: en Content-Type: application/json Content-Length: 74 {"sn": "_serial_of_goodwe_", "password": "_MD5_hash_of_password_"}

Geta data:
GET /api/Solargo/GetRealdataOverview?language=%22en%22&sn=_serial_of_goodwe_ HTTP/1.1 Host: solargo.sems.com.cn token: _token_ language: en

Are you willing to use this API for your HA Custom Component? If not then I will try to make my own component.

Any hope for integrating Home Kit?

I've added some code to version 1.0.0 to read my Home Kit data. Still keep this version installed even though I migrated monitoring from Home Kit onto Iotawatt. Looked at your update yesterday but still only inverter.
Would be nice to see Home Kit too.

I can paste here entire json downloaded from account having Home Kit, probably can fork 1.0.0. and paste my messy code too.

Sensor name is 'sensor.inverter_none'

Hi,

after reinstalling the integration since the 3.1.0 update (I think), the inverter is now exposed through a sensor called sensor.invertor_none. Previously this was sensor.sems_portal.

This looks fishy to me. I expected to see the name of my inverter as defined on the semsportal.com website (Management > Plant > Device Management > Modify. I explicitly gave my inverter a name there after observing that the sensor in home assistant reported "none" as the name.

However, I don't see the sensor being renamed...

Thanks for looking into this :)

Possible to add Buy and Seller attributes marked as energy?

Many thanks for the very prompt update for HA Energy. I'm guessing that the configuration of the HA Add Consumption and Return to grid might be satisfied by the inverter Seller and Buy attributes? If that's correct, is there a way to either add these manually or have them in the HACS integration so they appear in the list when you confiure these sections of HA Energy.

Warning "Detected I/O inside the event loop" showing in log using new BETA version

Problem:

2020-09-01 16:44:42 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sems doing I/O at custom_components/sems/sensor.py, line 63: login_response = requests.post(
2020-09-01 16:44:42 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sems doing I/O at custom_components/sems/sensor.py, line 98: response = requests.post(

Fix:
Add/Wrap those calls as a job to the executor and await hem.

https://developers.home-assistant.io/docs/asyncio_working_with_async#calling-sync-functions-from-async

Please note, that the current state of this integration make Home Assistant execution halt/blocked until these calls are finished. Basically, this integration causes hiccups for the whole system now.

Looking at the error logs i think code line 105 needs editing:
response = requests.post(_PowerStationURL, headers=headers, data=data, timeout=_RequestTimeout)

Monthly amount

Hi Tim,

Is it also possible to read out the monthly production of the solar-panels?

Integration setup hangs

Hi,

I have been a long time fan of your custom integration. It has worked very well for so far but with this new upgrade i am now not able to use the new 3.1.1 version. The HACS integration upgrade went well (reinstallations also installing normally) & the HA integration removal/reinstall also seems to add normally.

However, after the HA integration is added (also if i restart HA) i get these series of errors that seems to hang up some other parts of my HA instance (both prd & dev instances behave the same) & other integrations like automations don't work normally. Also, i never see any sensors created.

These are the errors i see in my log.

Also & a perhaps an indication of something (not sure what though) i found that my sems portal web account seems to be getting 'expired' now. Until i remove the integrations & restart to stop continued setup attempts i found i could not even log on to the website with out an 'login expired' message. After the integration was removed i could once again use the sems portal website normally.

Hope this information helps you to troubleshoot thins & i am more than happy to work with you on this issue if that is of any help.

Regards
Nick Harrison

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:237
Integration: Sensor (documentation, issues)
First occurred: 9:34:06 (1 occurrences)
Last logged: 9:34:06

Setup of platform sems is taking longer than 60 seconds. Startup will proceed without waiting any longer.

Logger: homeassistant.bootstrap
Source: bootstrap.py:554
First occurred: 9:38:12 (1 occurrences)
Last logged: 9:38:12

Setup timed out for bootstrap - moving forward

Logger: custom_components.sems.sems_api
Source: custom_components/sems/sems_api.py:71
Integration: GoodWe SEMS API (documentation, issues)
First occurred: 9:40:31 (2 occurrences)
Last logged: 9:41:03

Unable to fetch login token from SEMS API. HTTPSConnectionPool(host='eu.semsportal.com', port=443): Read timed out. (read timeout=30)

homeassistant.exceptions.TemplateError: UndefinedError: 'None' has no attribute 'attributes'

Hi
Today I update my HA to 2021.4.6 and after reboot I checked the log and saw the following errors:
homeassistant.exceptions.TemplateError: UndefinedError: 'None' has no attribute 'attributes'

and

Template variable error: 'None' has no attribute 'attributes' when rendering '{{ states.sensor.sems_portal.attributes.tempperature }}'
Template variable error: 'None' has no attribute 'attributes' when rendering '{{ states.sensor.sems_portal.attributes.eday }}'
Template variable error: 'None' has no attribute 'attributes' when rendering '{{ states.sensor.sems_portal.attributes.etotal }}'
Template variable error: 'None' has no attribute 'attributes' when rendering '{{ states.sensor.sems_portal.attributes.iday }}'
Template variable error: 'None' has no attribute 'attributes' when rendering '{{ states.sensor.sems_portal.attributes.itotal }}'

I must admit, I'm not sure if these errors have occurred with earlier updates as well, could be these were in it for some time.

Expanded logs:

Logger: homeassistant.helpers.template
Source: helpers/template.py:1346
First occurred: 8:24:39 PM (84 occurrences)
Last logged: 8:36:40 PM

Template variable error: 'None' has no attribute 'attributes' when rendering '{{ states.sensor.sems_portal.attributes.tempperature }}'
Template variable error: 'None' has no attribute 'attributes' when rendering '{{ states.sensor.sems_portal.attributes.eday }}'
Template variable error: 'None' has no attribute 'attributes' when rendering '{{ states.sensor.sems_portal.attributes.etotal }}'
Template variable error: 'None' has no attribute 'attributes' when rendering '{{ states.sensor.sems_portal.attributes.iday }}'
Template variable error: 'None' has no attribute 'attributes' when rendering '{{ states.sensor.sems_portal.attributes.itotal }}'

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:133
Integration: Sensor (documentation, issues)
First occurred: 8:24:16 PM (2 occurrences)
Last logged: 8:28:53 PM

The sems platform for the sensor integration does not support platform setup. Please remove it from your config.
The thinq_v2 platform for the sensor integration does not support platform setup. Please remove it from your config.

Logger: homeassistant.components.template.template_entity
Source: components/template/template_entity.py:72
Integration: Template (documentation, issues)
First occurred: 8:24:40 PM (6 occurrences)
Last logged: 8:24:40 PM

TemplateError('UndefinedError: 'None' has no attribute 'attributes'') while processing template 'Template("{{ states.sensor.sems_portal.attributes.tempperature }}")' for attribute '_state' in entity 'sensor.pv_temperature'
TemplateError('UndefinedError: 'None' has no attribute 'attributes'') while processing template 'Template("{{ states.sensor.sems_portal.attributes.eday }}")' for attribute '_state' in entity 'sensor.pv_eday'
TemplateError('UndefinedError: 'None' has no attribute 'attributes'') while processing template 'Template("{{ states.sensor.sems_portal.attributes.etotal }}")' for attribute '_state' in entity 'sensor.pv_etotal'
TemplateError('UndefinedError: 'None' has no attribute 'attributes'') while processing template 'Template("{{ states.sensor.sems_portal.attributes.iday }}")' for attribute '_state' in entity 'sensor.pv_iday'
TemplateError('UndefinedError: 'None' has no attribute 'attributes'') while processing template 'Template("{{ states.sensor.sems_portal.attributes.itotal }}")' for attribute '_state' in entity 'sensor.pv_itotal'

HA 2021.3.0 requests version manifest

As described in releasenotes of HA 2021.3.0, a version number is required in the manifest file:
https://www.home-assistant.io/blog/2021/03/03/release-20213/#read-more
Could you please add this? Thanks for this very nice plugin, use it with much pleasure!

Output HA log:
Logger: homeassistant.loader
Source: loader.py:802
First occurred: 17:32:12 (2 occurrences)
Last logged: 17:32:13

No 'version' key in the manifest file for custom integration 'sems'. This will not be allowed in a future version of Home Assistant. Please report this to the maintainer of 'sems'

Update Scan Interval

Probably just something I have overlooked, but how can I update the scan interval (without readding the entity)? Its currently set to the default of 60 seconds but I would like to change it to 30 seconds. I have tried updating DEFAULT_SCAN_INTERVAL and CONF_SCAN_INTERVAL with no luck. Thanks in advance for any advice.

integration not found

Im trying to install the integration, both both via HACS or manual>integration the integration is not found.

What can I do wrong? Currently Im updating all to latest software

Battery and PV levels?

Is it possible to scrap battery level and current PV generation data?

I tried the following for the battery but it didn't work:
pv_ibattery:
value_template: '{{ states.sensor.sems_portal.attributes.ibattery }}'
unit_of_measurement: 'kWh'
friendly_name: "Battery level"

Thanks for the SEMS sensor so far! Works great!

Show excess power available

Extra useful template - I popped the following in so that I could use it to signal if power over that being used was available:

pv_excess:
value_template: '{{ states.sensor.sems_portal.attributes.pmeter }}'
unit_of_measurement: 'W'
friendly_name: "PV spare"

Inverter name shows 'None'

Hi,

Thank you for creating this integration :)

I installed it on my HA, I've inserted my credentials, and retrieved the station ID via the URL, but HA shows two entities, 'Inverter None' and 'Inverter None Energy'. It does not show a correct name...

I'm also trying to integrate it with the new Energy menu item in the latest HA, but the net HA integration only lets me select the 'Inverter None Energy' which is the total of generated power over time, and I can't select the current generated power entity.

What am I doing wrong?

Energy dashboard values wiped after restart

I just restarted home assistant and my energy dashboard for the day has been wiped. Best guess I have is that the last_reset state attribute of sensor.inverter_home_energy is not being updated on restart. These are the state attributes after the restart
state_class: measurement last_reset: '1970-01-01T00:00:00+00:00' unit_of_measurement: kWh friendly_name: Inverter Home Energy device_class: energy

Won't show up in integrations

I've installed through HACS.
Tried 3.2.0 and master. Installation seems to work. Files are available in custom components. HomeAssistant recognizes the fact that custom componen has been installed.
However, I can't add it through integrations. When I search for it, it shows no results.

I've tried the oldway of adding it through configuration.yml.
It shows the integration on the info page of homeassistant. No device or sensor shows up related to the integration.
Setting the loglevel to debug gives no additional logging output.

Warnings and errors in Home Assistant log

I've been using this integration for a couple weeks now and I think it's great. Thanks!

Today I noticed an error and a warning in the Home Assistant logs. Both occur quite frequently and I can't find a particular pattern.
2020-09-01 13:18:05 ERROR (SyncWorker_18) [custom_components.sems.sensor] Unable to fetch data from SEMS. HTTPSConnectionPool(host='www.semsportal.com', port=443): Read timed out. (read timeout=30)
and
2020-09-01 09:37:45 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.sems_portal is taking over 10 seconds

I found these in Supervisor>System>System Log> Core tab. I don't experience any problems and the data from Goodwe is still updated, only sometimes delayed. Is this an error on my side or maybe a bug in the integration? I couldn't find much info online.

Extra info:

  • Home Assistant installed as a VM on my ProxMox server
  • Home Assistant version 0.114.4
  • Goodwe SEMS integration for Home Assistant version 1.0.0 (installed with HACS)

If any extra info is needed, please let me know!

No longer working in HA after recent update

After recent update via HACS the integration stopped working with Home Assistant.

It still communicates with my inverter :

2021-08-24 13:43:37 DEBUG (MainThread) [custom_components.goodwe.goodwe_inverter] Connecting to DT family inverter at 192.168.123.10:8899 2021-08-24 13:43:37 DEBUG (MainThread) [custom_components.goodwe.goodwe_inverter] Send: '7f03753100280409' 2021-08-24 13:43:38 DEBUG (MainThread) [custom_components.goodwe.goodwe_inverter] Received: 'aa557f0350000000000001353830303044545332303957303134324757384b2d4454202020ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000003f203f2000802d800310001000004e4'

But then there is an error directly in HA:

2021-08-24 13:43:48 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/config/custom_components/goodwe/sensor.py", line 157, in async_refresh self.entity.update_value(inverter_response) File "/config/custom_components/goodwe/sensor.py", line 196, in update_value self.async_schedule_update_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 621, in async_schedule_update_ha_state self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 464, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 500, in _async_write_ha_state attr.update(self.state_attributes or {}) ValueError: dictionary update sequence element #0 has length 77; 2 is required

I guess the problem is here:

ValueError: dictionary update sequence element #0 has length 77; 2 is required

Unable to fetch data from SEMS. (Query not successful (The authorization has expired, please login again.))

Hi, i just installed this plugin via HACS/Integration page and entered my username/password and powerstation id from semsportal link but i'm getting these errors:

Error while setting up sems platform for sensor
7:50:49 PM – (ERROR) Sensor
Unable to fetch data from SEMS.
7:50:49 PM – (ERROR) GoodWe SEMS PV API (custom integration)

These are the debug details:

I think this's the problem but i don't know how can i fix it: 19:50:49 "Query not successful (The authorization has expired, please login again.)"

2021-08-06 19:50:44 DEBUG (SyncWorker_4) [custom_components.sems.sems_api] Login Response: <Response [200]>
2021-08-06 19:50:44 DEBUG (SyncWorker_4) [custom_components.sems.sems_api] SEMS - API Token received: {"uid": "2749c6f2---91112022e7a3", "timestamp": 1628268644590, "token": "b3a860ba3f89b0687f133d" (I don't have an idea where this token coming from. This's not my station id) , "client": "ios", "version": "", "language": "en"}
2021-08-06 19:50:44 DEBUG (SyncWorker_4) [custom_components.sems.sems_api] Querying SEMS API for power station id: 669e30d9-715a-417f-a127-3b683849429a
2021-08-06 19:50:45 INFO (MainThread) [custom_components.hacs] <Integration hacs/integration> Registration completed
2021-08-06 19:50:45 INFO (MainThread) [custom_components.hacs] Restore started
2021-08-06 19:50:45 INFO (MainThread) [custom_components.hacs] Restore done
2021-08-06 19:50:45 INFO (MainThread) [custom_components.hacs] Setup task HacsSetupTask.SENSOR
2021-08-06 19:50:45 INFO (MainThread) [custom_components.hacs] Stage changed: HacsStage.WAITING
2021-08-06 19:50:45 INFO (MainThread) [custom_components.hacs] Setup complete, waiting for Home Assistant before startup tasks starts
2021-08-06 19:50:45 INFO (MainThread) [custom_components.hacs] HACS is enabled
2021-08-06 19:50:45 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.hacs
2021-08-06 19:50:46 DEBUG (SyncWorker_4) [custom_components.sems.sems_api] Query not successful (The authorization has expired, please login again.), retrying with new token, 2 retries remaining
2021-08-06 19:50:46 DEBUG (SyncWorker_4) [custom_components.sems.sems_api] SEMS - Making Power Station Status API Call
2021-08-06 19:50:46 DEBUG (SyncWorker_4) [custom_components.sems.sems_api] API token not set ({"uid": "2749c6f2--
--91112022e7a3", "timestamp": 1628268644590, "token": "b3a860ba3f89b0687f133d", "client": "ios", "version": "", "language": "en"}) or new token requested (True), fetching
2021-08-06 19:50:46 DEBUG (SyncWorker_4) [custom_components.sems.sems_api] SEMS - Getting API token
2021-08-06 19:50:48 DEBUG (SyncWorker_4) [custom_components.sems.sems_api] Login Response: <Response [200]>
2021-08-06 19:50:48 DEBUG (SyncWorker_4) [custom_components.sems.sems_api] SEMS - API Token received: {"uid": "2749c6f2--
--91112022e7a3", "timestamp": 1628268647918, "token": "d34e8915a206ad884b59c2", "client": "ios", "version": "", "language": "en"}
2021-08-06 19:50:48 DEBUG (SyncWorker_4) [custom_components.sems.sems_api] Querying SEMS API for power station id: 669e30d9--
-**-3b683849429a
2021-08-06 19:50:49 DEBUG (SyncWorker_4) [custom_components.sems.sems_api] Query not successful (The authorization has expired, please login again.), retrying with new token, 1 retries remaining
2021-08-06 19:50:49 DEBUG (SyncWorker_4) [custom_components.sems.sems_api] SEMS - Making Power Station Status API Call
2021-08-06 19:50:49 INFO (SyncWorker_4) [custom_components.sems.sems_api] SEMS - Maximum token fetch tries reached, aborting for now
2021-08-06 19:50:49 ERROR (SyncWorker_4) [custom_components.sems.sems_api] Unable to fetch data from SEMS.
2021-08-06 19:50:49 DEBUG (MainThread) [custom_components.sems.sensor] Finished fetching SEMS API data in 6.743 seconds
2021-08-06 19:50:49 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up sems platform for sensor

What can be the problem?

Format of variables

Hi there, thanks for writing this integration.
I have a small/tiny question:
pv_iday:
value_template: '{{ states.sensor.sems_portal.attributes.iday }}'
unit_of_measurement: '€'
friendly_name: "PV income day"
Gives an output of many many characters.
How can I format the output to say ###,## (e.g. for currency)
Thanks a mil,
F

Extending of attributes

Hello , great work, i am using your plugin to water heating and i cannot found some sems attributes stored in powerflow ,like actual load,battery status....
I extended you script function update(self) of this code.

#add info from pwerflow \n
res_data = jsonResponseFinal['data']['powerflow']
self._attributes.update({'pv': float(res_data['pv'][:-3]),
                                      'battery': float(res_data['bettery'][:-3]),
                                     'load': float(res_data['load'][:-3]),
                                     'loadstatus': int(res_data['loadStatus']),
                                     'grid': float(res_data['grid'][:-3]),
                                     'gridstatus': int(res_data['gridStatus'])})

Can you please implement those attributes to sems plugin in next versions ?

Would love to help extend this

I have 2 x GW5048-EM Hybrid inverters. One with a battery, the other without (for now). I would like to try and assist in getting better/more data about battery states etc. I wrote a small API to power an Android app in my house, and got some insight into how (badly) the data is displayed from the SEMS Portal.

Settings depth of discharge of battery

Hi I search solution for use case, when I charge my car at night and I don't want discharge home battery. I need thru Home Assistant disconnect battery. GoodWe doesn't have this function (without change inverter mode and restart), but I think that workaround is setting DoD to 1%. DoD is possible setting only in Android application Sems Portal (no in the web interface, or iOS). Has a API available this function?

Thank you Tom

Unable to prepare setup

Having some troubles setting up this integration.
After importing it through HACS, and then loading it into HomeAssistant and providing all the neccesary credentials, the following error was encounted.
Unable to prepare setup for platform sems.sensor: Platform not found (cannot import name 'STATE_CLASS_MEASUREMENT' from 'homeassistant.components.sensor' (/usr/src/homeassistant/homeassistant/components/sensor/__init__.py)).

There is no homeassistant folder at /usr/src/ so the error reason is clear, however, why this is happening is less so.
Homeassistant is running as Home Assistant 2021.5.4 on a raspberry pi 4, in a docker-compose container.

Lastmonthetotle showing wrong value

Hi!

It looks like the Lastmonthetotle is showing the total amount of produced power.
Thismonthetotle seems to work without a harm. Is there a quick fix? :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.