Skip to content
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

mobile_app component #21475

merged 24 commits into from Mar 2, 2019


None yet
4 participants
Copy link

robbiet480 commented Feb 27, 2019


This provides the initial implementation of the mobile_app component for use with native mobile apps.

Pull request in with documentation (if applicable): home-assistant/< PR number goes here>


  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New or updated dependencies have been added to requirements_all.txt by running script/
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

This comment has been minimized.

Copy link
Member Author

robbiet480 commented Feb 27, 2019

@balloob Once you give the initial OK in terms of style i'll write some tests for the webhook payloads.

@robbiet480 robbiet480 force-pushed the robbiet480:mobile_app branch from 2614e1b to 4f3c5f5 Feb 27, 2019

robbiet480 added some commits Feb 27, 2019


This comment has been minimized.

Copy link
Member Author

robbiet480 commented Feb 27, 2019

Some things to still determine:

  • Should devices be put in the device registry?
  • How does application specific code get implemented (e.g. iOS push categories need to be exposed)?
  • Can extra attributes be passed in the registration dictionary for use by application specific code later? Specific use case would be at least the push notification token required for notifications.
  • How do we want to identify different apps? For now, i've added two keys to the registration payload app_id and app_version. The iOS app sends app_id as io.robbie.HomeAssistant. I would recommend we suggest bundle ID as app_id for future implementers. However, maybe it needs to be something more descriptive for frontend usage?
  • Should we extend NetDisco and the discovery component to add a generic Zeroconf service like _hass-mobile_app._tcp.local.?

This comment has been minimized.

Copy link
Member Author

robbiet480 commented Feb 27, 2019

Initial support for mobile_app webhooks (including encryption via libsodium) is in the iOS app at home-assistant/home-assistant-iOS@74dfba2. If a webhook ID and secret has been set then the calls that the webhook supports will be sent via webhook instead of REST API.

robbiet480 added some commits Mar 2, 2019


balloob approved these changes Mar 2, 2019

@balloob balloob added this to the 0.89.0 milestone Mar 2, 2019

robbiet480 added some commits Mar 2, 2019

@balloob balloob merged commit 655ada1 into home-assistant:dev Mar 2, 2019

3 checks passed

Hound No violations found. Woof!
cla-bot Everyone involved has signed the CLA
continuous-integration/travis-ci/pr The Travis CI build passed

@wafflebot wafflebot bot removed the in progress label Mar 2, 2019


This comment has been minimized.

Copy link
Member Author

robbiet480 commented Mar 2, 2019

Thanks! 🐬 🍪 💯

@robbiet480 robbiet480 referenced this pull request Mar 3, 2019


mobile_app improvements #21607

3 of 3 tasks complete

balloob added a commit that referenced this pull request Mar 5, 2019

mobile_app component (#21475)
* Initial pass of a mobile_app component

* Fully support encryption, validation for the webhook payloads, and other general improvements

* Return same format as original API calls

* Minor encryption fixes, logging improvements

* Migrate Owntracks to use the superior PyNaCl instead of libnacl, mark it as a requirement in mobile_app

* Add mobile_app to .coveragerc

* Dont manually b64decode on OT

* Initial requested changes

* Round two of fixes

* Initial mobile_app tests

* Dont allow making registration requests for same/existing device

* Test formatting fixes

* Add mobile_app to default_config

* Add some more keys allowed in registration payloads

* Add support for getting a single device, updating a device, getting all devices. Also change from /api/mobile_app/register to /api/mobile_app/devices

* Change device_id to fingerprint

* Next round of changes

* Add keyword args and pass context on all relevant calls

* Remove SingleDeviceView in favor of webhook type to update registration

* Only allow some properties to be updated on registrations, rename integration_data to app_data

* Add call service test, ensure events actually fire, only run the encryption tests if sodium is installed

* pylint

* Fix OwnTracks test

* Fix iteration of devices and remove device_for_webhook_id

@balloob balloob referenced this pull request Mar 6, 2019


0.89.0 #21712

@robbiet480 robbiet480 modified the milestones: 0.89.0, mobile_app Mar 14, 2019

@balloob balloob referenced this pull request Mar 20, 2019


0.90.0 #22216

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.