-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
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
Replace token in camera.push with webhook #18380
Conversation
e4203d5
to
98e13dc
Compare
_LOGGER = logging.getLogger(__name__) | ||
|
||
DEPENDENCIES = ['http'] | ||
RECEIVED_DATA = 'push_camera_received' |
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
hass.http.register_view(CameraPushReceiver(hass, | ||
config[CONF_IMAGE_FIELD])) | ||
try: | ||
hass.components.webhook.async_register(DOMAIN, 'push', |
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.
'push' ? Pass the entity name.
camera.image_field) | ||
return | ||
|
||
await camera.update_image(data[camera.image_field].file.read(), |
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.
file.read()
is doing I/O
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.
it's memory, it's not from the filesystem. file is the property that contains the image bytes received by the webhook.
@@ -117,6 +107,15 @@ def __init__(self, hass, name, buffer_size, timeout, image_field, | |||
"""Call when entity is added to hass.""" | |||
self.hass.data[PUSH_CAMERA_DATA][self.webhook_id] = self | |||
|
|||
try: | |||
self.hass.components.webhook.async_register(DOMAIN, | |||
self.entity_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.
Why entity id ? This will be shown in the UI, let's do name?
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.
sorry, you suggested entity name, I read entity id :(
Description:
This moves from the temporary webhook solution to the webhook solution in #16817
Related issue (if applicable): fixes #16817
Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#7451
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:
REQUIREMENTS
variable (example).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.If the code does not interact with devices: