-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
Palazzetti power control #131833
base: dev
Are you sure you want to change the base?
Palazzetti power control #131833
Conversation
self, | ||
coordinator: PalazzettiDataUpdateCoordinator, | ||
description: PalazzettiNumberEntityDescription, | ||
entry_id: str, |
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.
not used
MIN_POWER = 1 | ||
MAX_POWER = 5 |
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.
why set those as const if they are only used once anyways?
config_entry.runtime_data, | ||
PalazzettiNumberEntityDescription( | ||
key="combustion_power", | ||
translation_key="combustion_power", | ||
device_class=NumberDeviceClass.POWER_FACTOR, | ||
native_min_value=MIN_POWER, | ||
native_max_value=MAX_POWER, | ||
native_step=1, | ||
value_property="power_mode", | ||
update_fn=client.set_power_mode, | ||
), | ||
config_entry.entry_id, |
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.
imo either you are planning for more entities here, in which case you should still make a list and iterate, or you might just as well hardcode it into the entity definition directly
{ATTR_ENTITY_ID: ENTITY_ID, "value": 1}, | ||
blocking=True, | ||
) | ||
mock_palazzetti_client.set_power_mode.assert_called_once_with(1) |
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.
maybe verify that the value did indeed change
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 don't think that I can do that. The client API is fully mocked and does not update its state.
@dataclass(frozen=True, kw_only=True) | ||
class PalazzettiNumberEntityDescription(NumberEntityDescription): | ||
"""Describes Palazzetti number entity.""" | ||
|
||
value_property: str | ||
update_fn: Callable[[int], Coroutine[Any, Any, None]] |
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.
@dataclass(frozen=True, kw_only=True) | |
class PalazzettiNumberEntityDescription(NumberEntityDescription): | |
"""Describes Palazzetti number entity.""" | |
value_property: str | |
update_fn: Callable[[int], Coroutine[Any, Any, None]] |
unused now
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.
Thanks, LGTM 👍
Proposed change
Add a number entity to Palazzetti to control the "combustion power" of the stove.
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: