-
-
Notifications
You must be signed in to change notification settings - Fork 87
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
Fix missing state class for reactive power sensors after #1417 #1451
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1451 +/- ##
=======================================
Coverage 94.69% 94.69%
=======================================
Files 12 12
Lines 1943 1943
=======================================
Hits 1840 1840
Misses 103 103 ☔ View full report in Codecov by Sentry. |
@N3rdix it'd be useful to include an assert in the tests to confirm the unit returned for this device class is what is expected. |
@drc38 although I added an assert in the test_init.py it does not feel to be the best place. As we do not have a test_sensor.py yet and I am not confident enough yet with pytest to build such a test from scratch easily I thought an experienced view might help. |
Best to put the assert statements here ocpp/tests/test_charge_point_v16.py Line 270 in d351da0
Using mock config creates the integration's sensors so no need to do so manually. Thanks for contributing hope that helps. |
Also add the device class here ocpp/custom_components/ocpp/const.py Line 127 in d351da0
And update reactive units with HA values ocpp/custom_components/ocpp/const.py Line 116 in d351da0
|
Hi @drc38, I've added the asserts and adjusted the mock data accordingly. Do you think this is enough/ok? |
After explicitly switching to reactive power device class I missed the state_class also depending on this device_class (#1417).
Should fix #1449 (the raised repair regarding the changed unit of measurement is expected nevertheless)