-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
Support for Apple Push Notification Service #3756
Conversation
hass = get_test_home_assistant() | ||
self.assertFalse(notify.setup(hass, config)) | ||
|
||
def test_register_new_device(self): |
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.
- D102: Missing docstring in public method
How can I re-run the build? Seems like a random failure. |
Is this the successor of #2984? |
Yes |
awesome work here. you and @robbiet480 should chat, potentially. |
@robbiet480 do you want me to do anything else to this or is it ok to merge? |
I just skimmed this, it looks fine. Need to take a closer look at the code first though. Will try my best to get that done today. |
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.
Good work. A smal change and we can merge it 👍
def get_service(hass, config): | ||
"""Return push service.""" | ||
descriptions = load_yaml_config_file( | ||
os.path.join(os.path.dirname(__file__), 'apns_services.yaml')) |
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.
Dont use a own service yaml. Add to service.yaml like other platform do...
DOMAIN = "apns" | ||
APNS_DEVICES = "apns.yaml" | ||
DEVICE_TRACKER_DOMAIN = "device_tracker" | ||
SERVICE_REGISTER = "register" |
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.
Can you rename it apns_register
to indicate that it is part of the apns platform?
The APNS platform uses the Apple Push Notification service (APNS) to deliver notifications from Home Assistant.
To use the APNS service you will need an apple developer account and you will need to create an App to receive push notifications. For more information see the apple developer documentation.
Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#905
Example entry for
configuration.yaml
(if applicable):Configuration Variables:
name: The name of the app.
sandbox: If true notifications will be sent to the sandbox (test) notification service.
cert_file: The certificate to use to authenticate with the APNS service.
Usage:
The APNS platform will register two services, notify/[app_name] and apns/[app_name].
apns/app_name:
This service will register device id's with home assistant. In order to receive a notification a device must be registered. The app on the device can use this service to send its id during startup, the id will be stored in the [app_name]_apns.yaml.
See didRegisterForRemoteNotificationsWithDeviceToken in the apple developer documentation for more information.
notify/app_name
This service will send messages to a registered device. The following parameters can be used:
message: The message to send
target: The desired state of the device, only devices that match the state will receive messages. To enable state tracking a registered device must have a device_tracking_id added to the [app_name]_apns.yaml file. If this id matches a device in known_devices.yaml its state will be tracked.
data:
badge: The number to display as the badge of the app.
sound: The name of a sound file in the app bundle or in the Library/Sounds folder.
category: Provide this key with a string value that represents the identifier property of the UIMutableUserNotificationCategory
content_available: Provide this key with a value of 1 to indicate that new content is available.
Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
tox
run successfully. Your PR cannot be merged unless tests passREQUIREMENTS
variable (example).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.If the code does not interact with devices:
tox
run successfully. Your PR cannot be merged unless tests pass