Add Camera platform to Prosegur#76428
Conversation
|
Also, please remember to add a link to changelog |
e31589e to
31f70bb
Compare
|
Example diagnostic dump: {
"home_assistant": {
"installation_type": "Home Assistant Core",
"version": "2022.9.0.dev0",
"dev": true,
"hassio": false,
"virtualenv": true,
"python_version": "3.10.6",
"docker": false,
"arch": "x86_64",
"timezone": "Europe/Lisbon",
"os_name": "Darwin",
"os_version": "12.5.1",
"run_as_root": false
},
"custom_components": {
"openhasp": {
"version": "0.6.5",
"requirements": [
"jsonschema>=3.2.0"
]
},
"generic_water_heater": {
"version": "0.0.3",
"requirements": []
},
"hacs": {
"version": "1.26.2",
"requirements": [
"aiogithubapi>=22.2.4"
]
},
"erse": {
"version": "2.1.5",
"requirements": [
"pyerse==0.0.4"
]
}
},
"integration_manifest": {
"domain": "prosegur",
"name": "Prosegur Alarm",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/prosegur",
"requirements": [
"pyprosegur==0.0.8"
],
"codeowners": [
"@dgomes"
],
"iot_class": "cloud_polling",
"loggers": [
"pyprosegur"
],
"is_built_in": true
},
"data": {
"installation": {
"installationId": "1102262",
"description": "**REDACTED**",
"image": 1,
"installationType": "RSI",
"pinControl": false,
"status": "DA",
"preboarding": false,
"hasDomotic": false,
"detectors": [
{
"id": "884540",
"description": "**REDACTED**",
"type": "Camera",
"streaming": false
},
{
"id": "884541",
"description": "**REDACTED**",
"type": "Camera",
"streaming": false
},
{
"id": "884542",
"description": "**REDACTED**",
"type": "Camera",
"streaming": false
}
],
"videoDetectors": [],
"services": [
{
"type": "A",
"statusCode": 200
},
{
"type": "V",
"statusCode": 200
},
{
"type": "PB",
"statusCode": 200
}
],
"partitions": [],
"domoticDevices": [],
"accessLevels": [],
"latitude": "**REDACTED**",
"longitude": "**REDACTED**",
"contractId": "**REDACTED**",
"address": "**REDACTED**"
},
"activity": {
"result": {
"code": 200,
"message": "User events list found successfully",
"description": "OK"
},
"data": [
{
"id": "4606293595",
"installationId": "1102262",
"connectionId": "B20029219",
"logId": "-1",
"description": "Disarming by DGOMES",
"operation": "DA",
"creationDate": 1661412894000
},
{
"id": "4605999545",
"installationId": "1102262",
"connectionId": "B20029219",
"logId": "-1",
"description": "Full arming by DGOMES",
"operation": "AT",
"creationDate": 1661388353000
}
]
}
}
} |
|
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. |
| platform.async_register_entity_service( | ||
| SERVICE_REQUEST_IMAGE, | ||
| {}, | ||
| "async_request_image", |
There was a problem hiding this comment.
Why do you need this? We have an update entity service
There was a problem hiding this comment.
The camera sends a still picture through an MMS service, so it's not advisable to update periodically and only use it seldomly (Prosegur will throttle your request heavily).
Prosegur Mobile App also requires this explicit request.
There was a problem hiding this comment.
Some more explanation:
- The alarm camera will trigger on it's self based on motion sensing and send image to Prosegur server
- User might request an out of order camera capture (that's the service I'm proposing)
This service is therefore independent from update entity service which will periodically get the last camera capture available on Prosegur server.
There was a problem hiding this comment.
This service is therefore independent from update entity service which will periodically get the last camera capture available on Prosegur server.
The update entity service allows to request a single update (yes, it could be used periodically in an automation, but by itself it isn't periodically).
There was a problem hiding this comment.
update_service -> request image from Prosegur server
request_image -> request Prosegur to refresh it's server stored image
e221c43 to
04d675d
Compare
35dcb2b to
c535be0
Compare
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
|
Thanks! 🎉 |
MartinHjelmare
left a comment
There was a problem hiding this comment.
Please address the comments in a new PR. Thanks!
| @pytest.fixture | ||
| def mock_install() -> AsyncMock: | ||
| """Return the mocked alarm install.""" | ||
| install = AsyncMock() |
There was a problem hiding this comment.
The installation doesn't need to be an AsyncMock. It can be a MagicMock or Mock.
There was a problem hiding this comment.
It actually does:
async def async_alarm_arm_home(self, code: str | None = None) -> None:
"""Send arm away command."""
> await self._installation.arm_partially(self._auth)
E TypeError: object MagicMock can't be used in 'await' expression
There was a problem hiding this comment.
Either mock the attributes of the installation explicitly or spec the installation according to the original target.
* address late comments on #76428 * adress review * extra tweaks
Proposed change
Adds the camera platform to the integration
Changelog of pyprosegur: dgomes/pyprosegur@0.0.5...0.0.8
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.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: