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

Update __init__.py #114

Merged
merged 2 commits into from
Oct 28, 2022
Merged

Update __init__.py #114

merged 2 commits into from
Oct 28, 2022

Conversation

ryanm101
Copy link
Contributor

Fix for #110

@ryanm101
Copy link
Contributor Author

ryanm101 commented Oct 28, 2022

Changed all ">", 0 to ">=", 0 as I cant think of a time where 0 would be invalid as a result of a calculation.

@binsentsu binsentsu merged commit 9fe42d9 into binsentsu:master Oct 28, 2022
@ryanm101 ryanm101 deleted the 110_fix branch October 29, 2022 03:40
@treynaer
Copy link
Contributor

treynaer commented Jan 5, 2023

I manually apply the change on the Battery SOC, otherwise the component cannot start when the SOC is 0.

battery_SoC = validate(decoder.decode_32bit_float(), ">=", 0.0)

About the other sensors, energy is probably only 0 when you have a new inverter/meter/battery. If 0 is detected in that case it should be ignored I guess.

@binsentsu
Copy link
Owner

@treynaer I don't own a battery myself so can't test it, but I agree that 0 should be an acceptable value for battery_Soc. With the meter values validated as >= 0, there were sometimes 'false' drops to 0 in the readings. Do you see these also for the battery Soc field with this patch applied?

@treynaer
Copy link
Contributor

treynaer commented Jan 7, 2023

It's difficult to say because the battery is at this moment empty most of the time.

What I however get a lot is the following exception after allowing 0% SOC. Its good that this doesn't show op.

This error originated from a custom integration.

Logger: custom_components.solaredge_modbus
Source: custom_components/solaredge_modbus/__init__.py:130
Integration: SolarEdge Modbus (documentation)
First occurred: January 6, 2023 at 04:31:44 (90 occurrences)
Last logged: 04:48:19

Error reading modbus data
Traceback (most recent call last):
  File "/config/custom_components/solaredge_modbus/__init__.py", line 195, in async_refresh_modbus_data
    update_result = self.read_modbus_data()
  File "/config/custom_components/solaredge_modbus/__init__.py", line 251, in read_modbus_data
    and self.read_modbus_data_battery1()
  File "/config/custom_components/solaredge_modbus/__init__.py", line 768, in read_modbus_data_battery1
    return self.read_modbus_data_battery("battery1_", 0xE100)
  File "/config/custom_components/solaredge_modbus/__init__.py", line 855, in read_modbus_data_battery
    battery_SoC = validate(decoder.decode_32bit_float(), ">=", 0.0)
  File "/config/custom_components/solaredge_modbus/__init__.py", line 130, in validate
    raise ValueError(f"Value {value} failed validation ({comparison}{against})")
ValueError: Value -3.4028234663852886e+38 failed validation (>=0.0)

And this one:

This error originated from a custom integration.

Logger: custom_components.solaredge_modbus
Source: custom_components/solaredge_modbus/__init__.py:646
Integration: SolarEdge Modbus (documentation)
First occurred: January 6, 2023 at 04:31:39 (3 occurrences)
Last logged: 04:43:39

Error reading modbus data
Traceback (most recent call last):
  File "/config/custom_components/solaredge_modbus/__init__.py", line 195, in async_refresh_modbus_data
    update_result = self.read_modbus_data()
  File "/config/custom_components/solaredge_modbus/__init__.py", line 246, in read_modbus_data
    self.read_modbus_data_inverter()
  File "/config/custom_components/solaredge_modbus/__init__.py", line 646, in read_modbus_data_inverter
    self.data["acenergy"] = round(acenergy * 0.001, 3)
OverflowError: int too large to convert to float

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

Successfully merging this pull request may close these issues.

None yet

3 participants