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

Error when writing schedule setting to inverter #94

Open
yelonek opened this issue Nov 27, 2024 · 0 comments
Open

Error when writing schedule setting to inverter #94

yelonek opened this issue Nov 27, 2024 · 0 comments

Comments

@yelonek
Copy link

yelonek commented Nov 27, 2024

I'm running the code from interactive window.
I connected to inverter. It was properly recognized as ET - it is GW8KN-ET.

But then I run this code:

sch3 = await inverter.read_setting("eco_mode_3")
result = await inverter.write_setting("eco_mode_3", sch3)

and get a ValueError:

ValueError                                Traceback (most recent call last)
Cell In[26], [line 1](vscode-notebook-cell:?execution_count=26&line=1)
----> [1](vscode-notebook-cell:?execution_count=26&line=1) result = await inverter.write_setting("eco_mode_3", sch3)

File c:\Users\(...)\.venv\Lib\site-packages\goodwe\et.py:669, in ET.write_setting(self, setting_id, value)
    [667](file:///C:/Users/(...)/.venv/Lib/site-packages/goodwe/et.py:667) setting = self._settings.get(setting_id)
    [668](file:///C:/Users/(...)/.venv/Lib/site-packages/goodwe/et.py:668) if setting:
--> [669](file:///C:/Users/(...)/.venv/Lib/site-packages/goodwe/et.py:669)     await self._write_setting(setting, value)
    [670](file:///C:/Users/(...)/.venv/Lib/site-packages/goodwe/et.py:670) else:
    [671](file:///C:/Users/(...)/.venv/Lib/site-packages/goodwe/et.py:671)     if setting_id.startswith("modbus"):

File c:\Users\dozmi\source\repos\goodweplc\.venv\Lib\site-packages\goodwe\et.py:682, in ET._write_setting(self, setting, value)
    [680](file:///C:/Users/(...)/.venv/Lib/site-packages/goodwe/et.py:680)     raw_value = setting.encode_value(value, response.response_data()[0:2])
    [681](file:///C:/Users/(...)/.venv/Lib/site-packages/goodwe/et.py:681) else:
--> [682](file:///C:/Users/(...)/.venv/Lib/site-packages/goodwe/et.py:682)     raw_value = setting.encode_value(value)
    [683](file:///C:/Users/(...)/.venv/Lib/site-packages/goodwe/et.py:683) if len(raw_value) <= 2:
    [684](file:///C:/Users/(...)/.venv/Lib/site-packages/goodwe/et.py:684)     value = int.from_bytes(raw_value, byteorder="big", signed=True)

File c:\Users\dozmi\source\repos\goodweplc\.venv\Lib\site-packages\goodwe\sensor.py:707, in Schedule.encode_value(self, value, register_value)
    [705](file:///C:/Users/(...)/.venv/Lib/site-packages/goodwe/sensor.py:705)     if self.read_value(ProtocolResponse(value, None)):
    [706](file:///C:/Users/(...)/.venv/Lib/site-packages/goodwe/sensor.py:706)         return value
--> [707](file:///C:/Users/(...)/.venv/Lib/site-packages/goodwe/sensor.py:707) raise ValueError


ValueError:

Seems like if self.read_value(ProtocolResponse(value, None)): is evaluating to False.
This settings is definitely available in the SolarGo app. Any hints?

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

No branches or pull requests

1 participant