-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
status entities for battery calibration & balancing #296
Changes from all commits
0dc4fc2
a46d510
b73c0bd
06ceef3
579f943
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,10 +8,12 @@ | |
from .lib.context import RctPowerContext | ||
from .lib.entities import ( | ||
battery_sensor_entity_descriptions, | ||
battery_binary_sensor_entity_descriptions, | ||
fault_sensor_entity_descriptions, | ||
inverter_sensor_entity_descriptions, | ||
) | ||
from .lib.entity import ( | ||
RctPowerBinarySensorEntity, | ||
RctPowerFaultSensorEntity, | ||
RctPowerSensorEntity, | ||
) | ||
|
@@ -35,6 +37,15 @@ async def async_setup_entry( | |
for entity_description in battery_sensor_entity_descriptions | ||
] | ||
|
||
battery_binary_sensor_entities = [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I understand HA's component architecture correctly, setting up a binary sensor in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TBH, I'm not fully aware of the component architecture, as I never built an integration myself. But it makes sense, even though it just seems to work in my installation without complying with the convention. |
||
RctPowerBinarySensorEntity( | ||
coordinators=list(context.update_coordinators.values()), | ||
config_entry=entry, | ||
entity_description=entity_description, | ||
) | ||
for entity_description in battery_binary_sensor_entity_descriptions | ||
] | ||
|
||
inverter_sensor_entities = [ | ||
RctPowerSensorEntity( | ||
coordinators=list(context.update_coordinators.values()), | ||
|
@@ -56,6 +67,7 @@ async def async_setup_entry( | |
async_add_entities( | ||
[ | ||
*battery_sensor_entities, | ||
*battery_binary_sensor_entities, | ||
*inverter_sensor_entities, | ||
*fault_sensor_entities, | ||
] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can avoid this hack by setting the
unique_id
. I honestly don't remember why I'm not using thekey
either. That's what you get when nobody reviews my code 🙈There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I didn't think that we could just override the use of a generated id by setting it explicitly. Will change this.