Skip to content

pantherale0/ha-familysafety

Repository files navigation

Microsoft Family Safety

GitHub Release GitHub Activity License

hacs

Integration to integrate with ha-familysafety.

IMPORTANT: Do not use configuration.yaml to configure this integration as it is not supported

This integration will set up the following platforms.

Platform Description
Sensor Screen time specified as a duration sensor measured in minutes for overall account and/or applications
Sensor Number of pending requests for a given account
Switch Block access to platforms

This integration will register the following services.

Service Description
Block App Blocks a specified application from running
Unblock App Allow a specified application to run
Approve Request* Approves a pending request
Deny Request* Denies a pending request

Service Help

  1. The target entity that you use should be the used screen time sensor that is registered for the account you wish to block an application for.
  2. Application names must be exactly as seen in the extra state attributes for the used screen time sensor, for example:
    • For "LEGO® CITY UNDERCOVER: 0"
    • Use "LEGO® CITY UNDERCOVER" (without quotes)

Pending Requests

As of 2024.12.0b0, support for pending requests has been added. Each time pending requests are retrieved (so everytime a request is approved/denied or on each update interval) this GUID of the specific request will change, therefore if used in automations, you should retrieve the GUID for use in the service calls by filtering the requests attribute found under the Pending Requests sensor.

If you would like to try, enable experimental features in the options flow (after initial configuration). This is found in the Configure collected accounts menu.

Installation

Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

  1. Install integration from HACS
  2. Restart Home Assistant
  3. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Microsoft Family Safety"

IMPORTANT: Make sure you do the following steps after starting the config flow as the response token can expire very quickly

  1. First authorize a session by navigating to the following URL: https://login.live.com/oauth20_authorize.srf?cobrandid=b5d15d4b-695a-4cd5-93c6-13f551b310df&client_id=000000000004893A&response_type=code&redirect_uri=https%3A%2F%2Flogin.live.com%2Foauth20_desktop.srf&response_mode=query&scope=service%3A%3Afamilymobile.microsoft.com%3A%3AMBI_SSL&lw=1&fl=easi2&login_hint=
  2. Once logged in you should be taken to a blank page copy the full URL in the address bar (including https)
  3. Paste the copied URL into the OAuth response URL field in the Home Assistant UI.

Configuration is done in the UI

From the configuration menu:

  • Additional entities can be configured to create switches to unlblock or block specific applications and also register screen time sensors

    1. Select "Configure application entities"
    2. Select required applications from list and press "Submit"
  • You can control what accounts are collected

    1. Select "Configure collected accounts"
    2. A list of available accounts to control will appear, check the box next to the name of the account you would like entities for. NOTE: By default no options are selected and therefore all accounts will be collected

Contributions are welcome!

If you want to contribute to this please read the Contribution guidelines