Add sighthound integration#28824
Conversation
|
OK CI is failing because simplehound has |
|
We currently still support 3.6, so that requires an integration to work with Python 3.6 as well. However, we are in the process of moving away from 3.6, now Python 3.8 has become stable. IMHO, there are 2 options. Either make it Python 3.6 compatible or hold off a bit until we've officially dropped Python 3.6. |
|
Made python 3.6 compatible |
|
The commit history is a bit of a mess now, does this matter? |
|
History looks ok. 👍 |
There was a problem hiding this comment.
We should prefix the event with the integration name. Replace image_processing.
There was a problem hiding this comment.
Set should_poll property to False instead in the entity.
There was a problem hiding this comment.
Please rename add_devices to add_entities.
There was a problem hiding this comment.
Please use dict[key] for required config keys and keys with default config schema values.
There was a problem hiding this comment.
We can remove call to parent. It doesn't have an init method.
There was a problem hiding this comment.
Does this have side effects? We don't want side effects in init method.
We should check that the api key is ok before creating the entity.
Probably create the api instance before creating the entity and pass the api to the entity.
Don't we want to create a single api instance and pass the same instance to all entities?
There was a problem hiding this comment.
Unfortunately the API doesn't have an endpoint to validate credentials, so the integration will raise an exception if invalid credentials only when processing is performed. One option is to perform processing of a test image to see if credentials are valid? Any other suggestions? In the meantime I will raise this with the API provider
There was a problem hiding this comment.
Processing a mock image would be ok, I think.
There was a problem hiding this comment.
Camera name doesn't have to be an instance attribute since it's only used in this method. Just make it a local variable.
|
If we add a test for the api test failure case, coverage should be enough. |
|
Are PR merged automatically? |
|
No, it's done manually. Thanks for the ping. 👍 |
Description:
Adds integration for person detection with Sighthound cloud. The Sighthound Developer tier (free for non-commercial use) allows 5000 requests per month. If you need more requests per month you will need to sign up for a production account (i.e. Basic or Pro account).
This integration adds an image processing entity where the state of the entity is the number of people detected in an image. For each person detected, an image_processing.person_detected event is fired. The event data includes the entity_id of the image processing entity firing the event, and the bounding box around the detected person. Note that in order to prevent accidentally using up your requets to Sighthound, by default the component will not automatically scan images, but requires you to call the image_processing.scan service e.g. using an automation triggered by motion. Alternativley, periodic scanning can be enabled by configuring a scan_interval.
Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#11203
Example entry for
configuration.yaml(if applicable):Checklist:
tox. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
python3 -m script.hassfest.requirements_all.txtby runningpython3 -m script.gen_requirements_all..coveragerc.