Skip to content

Create single_phase_16kw.py#405

Merged
kellerza merged 22 commits intokellerza:mainfrom
deondti:patch-3
Jan 28, 2025
Merged

Create single_phase_16kw.py#405
kellerza merged 22 commits intokellerza:mainfrom
deondti:patch-3

Conversation

@deondti
Copy link
Copy Markdown
Contributor

@deondti deondti commented Jan 22, 2025

Creating a " single_phase_16kw.py" definition.
Major changes from 5/8Kw to 16Kw
Sensor(172, "Grid_Ct_Power_10", WATT, -10),
Sensor(169, "Grid_power_10", WATT, -10),

SENSORS += NumberRWSensor(230, "Grid Charge Battery current", AMPS, min=0, max=140) SENSORS += NumberRWSensor(210, "Battery Max Charge current", AMPS, min=0, max=290) SENSORS += NumberRWSensor(211, "Battery Max Discharge current", AMPS, min=0, max=290)

Battery charge MAX is derived from the physical inverter LCD settings.

Grid and CT power is because it would only read eg. 500W instead of 5000W

Creating a " single_phase_16kw.py" definition.
Major changes from 5/8Kw to 16Kw
    Sensor(172, "Grid_Ct_Power_10", WATT, -10),
    Sensor(169, "Grid_power_10", WATT, -10),

SENSORS += NumberRWSensor(230, "Grid Charge Battery current", AMPS, min=0, max=140)
SENSORS += NumberRWSensor(210, "Battery Max Charge current", AMPS, min=0, max=290)
SENSORS += NumberRWSensor(211, "Battery Max Discharge current", AMPS, min=0, max=290)

Battery charge MAX is derived from the physical inverter LCD settings.

Grid and CT power is because it would only read eg. 500W instead of 5000W
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 22, 2025

Codecov Report

Attention: Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.

Project coverage is 71.16%. Comparing base (81d718c) to head (f87a56d).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
src/sunsynk/definitions/single_phase_16kw.py 0.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #405      +/-   ##
==========================================
- Coverage   71.49%   71.16%   -0.34%     
==========================================
  Files          27       28       +1     
  Lines        1912     1921       +9     
==========================================
  Hits         1367     1367              
- Misses        545      554       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kellerza
Copy link
Copy Markdown
Owner

If you import from the single_phase you only need to define changes & not all sensors

look at 3ph lv & hv to see how this is done
Import SENSORS, create a copy and add sensors to overwrote ones with the same name

Copy link
Copy Markdown
Contributor Author

@deondti deondti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected?

Comment thread src/sunsynk/definitions/single_phase_16kw.py Outdated
@kellerza kellerza mentioned this pull request Jan 22, 2025
Co-authored-by: Johann Kellerman <kellerza@gmail.com>
@kellerza
Copy link
Copy Markdown
Owner

kellerza commented Jan 23, 2025

The selection mechanism is still pending. Or do you prefer me to work on that?

@deondti
Copy link
Copy Markdown
Contributor Author

deondti commented Jan 24, 2025

The selection mechanism is still pending. Or do you prefer me to work on that?

config.yaml added sensor definition, documentation ammended
Where/what else needs to change?
I really don't know much...... learning as I go

@kellerza
Copy link
Copy Markdown
Owner

Just commit changes to this branch, then it will update

@deondti
Copy link
Copy Markdown
Contributor Author

deondti commented Jan 24, 2025

Just commit changes to this branch, then it will update

Please help , I think I'm stuck.
To me it looks like the file is in the branch but I don't think it is...
or am I just being a noob ?

@kellerza
Copy link
Copy Markdown
Owner

The best would be to install pre-commit locally & use that to fix up your tests that are failing.

pip install pre-commit
git add . && pre-commit run --all

I implemented dynamic loading, so you should just add single-phase-16kw to config.yaml in the edge addon folder

you can also rebase on the latest changes (after a commit!) using git pull --rebase, maybe you need to include "upstream main" as part of your rebase

SENSORS += NumberRWSensor(210, "Battery Max Charge current", AMPS, min=0, max=290)
SENSORS += NumberRWSensor(211, "Battery Max Discharge current", AMPS, min=0, max=290)

)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably need to delete line 40 to make the test pass?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skip to content
Navigation Menu

kellerza

sunsynk

Code
Issues 23
Pull requests 4
Discussions
Actions
Projects
Security

Insights

Back to pull request #405
Create single_phase_16kw.py #286

Jobs

Run details

Annotations
1 error and 1 warning
Check pylint
failed Jan 27, 2025 in 28s
1s
0s
0s
18s
8s
Run pylint src
pylint src
shell: /usr/bin/bash -e {0}
env:
DEFAULT_PYTHON: 3.11
pythonLocation: /opt/hostedtoolcache/Python/3.11.11/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.11.11/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.11/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.11/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.11/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.11/x64/lib
************* Module sunsynk.definitions.single_phase_16Kw
src/sunsynk/definitions/single_phase_16Kw.py:32:0: C0303: Trailing whitespace (trailing-whitespace)
src/sunsynk/definitions/single_phase_16Kw.py:40:0: C0305: Trailing newlines (trailing-newlines)
src/sunsynk/definitions/single_phase_16Kw.py:1:0: C0103: Module name "single_phase_16Kw" doesn't conform to snake_case naming style (invalid-name)
src/sunsynk/definitions/single_phase_16Kw.py:3:0: W0611: Unused CELSIUS imported from sunsynk (unused-import)
src/sunsynk/definitions/single_phase_16Kw.py:3:0: W0611: Unused KWH imported from sunsynk (unused-import)
src/sunsynk/definitions/single_phase_16Kw.py:3:0: W0611: Unused VOLT imported from sunsynk (unused-import)
src/sunsynk/definitions/single_phase_16Kw.py:5:0: W0611: Unused SelectRWSensor imported from sunsynk.rwsensors (unused-import)
src/sunsynk/definitions/single_phase_16Kw.py:5:0: W0611: Unused SwitchRWSensor imported from sunsynk.rwsensors (unused-import)
src/sunsynk/definitions/single_phase_16Kw.py:5:0: W0611: Unused SystemTimeRWSensor imported from sunsynk.rwsensors (unused-import)
src/sunsynk/definitions/single_phase_16Kw.py:5:0: W0611: Unused TimeRWSensor imported from sunsynk.rwsensors (unused-import)
src/sunsynk/definitions/single_phase_16Kw.py:12:0: W0611: Unused BinarySensor imported from sunsynk.sensors (unused-import)
src/sunsynk/definitions/single_phase_16Kw.py:12:0: W0611: Unused FaultSensor imported from sunsynk.sensors (unused-import)
src/sunsynk/definitions/single_phase_16Kw.py:12:0: W0611: Unused InverterStateSensor imported from sunsynk.sensors (unused-import)
src/sunsynk/definitions/single_phase_16Kw.py:12:0: W0611: Unused MathSensor imported from sunsynk.sensors (unused-import)
src/sunsynk/definitions/single_phase_16Kw.py:12:0: W0611: Unused SDStatusSensor imported from sunsynk.sensors (unused-import)
src/sunsynk/definitions/single_phase_16Kw.py:12:0: W0611: Unused TempSensor imported from sunsynk.sensors (unused-import)


Your code has been rated at 9.91/10

Error: Process completed with exit code 20.
0s
0s
0s
Create single_phase_16kw.py · 7bd9b81

@deondti
Copy link
Copy Markdown
Contributor Author

deondti commented Jan 28, 2025

Hi @kellerza

Am I on the right track?

Could you please help with these last 2 errors? I have no idea what it means...

In codecov

Comment thread hass-addon-sunsynk-edge/config.yaml Outdated
DONGLE_SERIAL_NUMBER: str?
PORT: str
SENSOR_DEFINITIONS: list(single-phase|three-phase|three-phase-hv)
SENSOR_DEFINITIONS: list(single-phase|single-phase-16Kw|three-phase|three-phase-hv)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either all names needs to be lowercase, or we need a .lower() in the load function in definitions/init.py

Kw will not match the filename kw today

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm only stuck with codecov now, it helps to read, think and solve but codecov is another story...

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codecov should be taken care of by a previous commit. It imports and tests all the existing definition files.

@kellerza kellerza merged commit ca73003 into kellerza:main Jan 28, 2025
@kellerza
Copy link
Copy Markdown
Owner

Thanks @deondti !

you should be able to test this once the edge version is built

@deondti
Copy link
Copy Markdown
Contributor Author

deondti commented Jan 28, 2025

sorry for the lengthy mess and THANK YOU for your patience

@deondti
Copy link
Copy Markdown
Contributor Author

deondti commented Jan 28, 2025

Tested and seems to be fine, thank you again for this great project

@talabirast
Copy link
Copy Markdown

I haven't fully tested it yet, but it seems that this mode also works on deye single_phase_18kw

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.

3 participants