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
Add Freebox Home alarm panel #102607
Add Freebox Home alarm panel #102607
Conversation
Hey there @hacf-fr, @Quentame, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
5486c75
to
798ef91
Compare
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.
LGMT, waiting for the pipeline check before merging
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.
Please address the comments in a new PR. Thanks!
async def async_alarm_disarm(self, code: str | None = None) -> None: | ||
"""Send disarm command.""" | ||
if await self.set_home_endpoint_value(self._command_disarm): | ||
self._set_state(STATE_ALARM_DISARMED) |
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.
_set_state
doesn't accept the Home Assistant entity state, it accepts the device state.
alarm2 = next( | ||
filter( | ||
lambda x: (x["name"] == "alarm2" and x["ep_type"] == "signal"), | ||
local_node["show_endpoints"], |
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.
Please use a generator expression instead of filter + lambda.
hass.states.get("alarm_control_panel.systeme_d_alarme").state == "armed_night" | ||
) | ||
# Fake that the entity is triggered. | ||
hass.states.async_set("alarm_control_panel.systeme_d_alarme", STATE_ALARM_DISARMED) |
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.
This doesn't test the integration at all. It just tests the state machine.
Please patch and mock the client library instead. If we want to test the services, please call the services via the service registry and assert that the correct call was made to the patched library client.
https://developers.home-assistant.io/docs/development_testing#writing-tests-for-integrations
assert hass.states.get("alarm_control_panel.systeme_d_alarme").state == "disarmed" | ||
|
||
|
||
async def test_reproducing_states( |
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.
We don't need to test reproduce state.
Breaking change
Proposed change
Add Freebox Home alarm panel, following previous Freebox Home API addition:
Type of change
Additional information
Checklist
black --fast 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
..coveragerc
.To help with the load of incoming pull requests: