Skip to content

fano0001/home-assistant-mazda

 
 

Repository files navigation

Introduction

This is a fork of the Mazda Connected Services integration originally written by bdr99 that has been packaged into a HACS compatible custom integration. The original code was part of the Home Assistant core integrations prior to a DMCA takedown notice issue by Mazda Motor Corporation. It should restore all functionality previously available in the core integration.

Installation

With HACS

  1. Add this repository as a custom repository in HACS.
  2. Download the integration.
  3. Restart Home Assistant

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

Manual

Copy the mazda_cs directory, from custom_components in this repository, and place it inside your Home Assistant Core installation's custom_components directory. Restart Home Assistant prior to moving on to the Setup section.

Note: If installing manually, in order to be alerted about new releases, you will need to subscribe to releases from this repository.

Authentication

Important

A browser extension is required to successfully authenticate with Mazda. Do not skip this step! The chrome extension is tied to the folder location on your computer and may disappear if you move the folder.

Mazda Connected Services uses OAuth authentication which blocks automated logins. Authentication requires a browser-based OAuth flow using a browser extension to capture the mobile app redirect URL.

Setup

chrome-extension

  • Download the latest chrome-extension.zip from releases (or use ./browser-extensions/chrome-extension/ from source)
  • Extract the zip file (or use source)
  • Open Google Chrome and navigate to chrome://extensions/ or Edge edge://extensions/
  • Enable "Developer mode"
  • Click "Load unpacked" and select the extracted folder
  • Try to authenticate

safari-extension

Requires Xcode and a free developer account

  • Download the latest safari-extension.zip from releases (or use ./browser-extensions/safari-extension/ from source)
  • Extract the zip file
  • Open the Xcode project
  • Go to project settings and set your free developer account as the 'Team' for both Targets (com.mazda.oauth-helper and com.mazda.oauth-helper.extension). Also ensure 'Signing Certificate' is set to 'Development'
  • Quit Safari if open and build the extension
  • Open Safari and enable the extension in Safari settings
  • Build the extension again
  • The app window should indicate the extension is 'On'.

Remote Control Events v1 (Notification Automation)

This is a early, beta, opt-in feature enabled via the 'Remote control events' switch in the diagnostic section of the integration. I am working on v2 with proper push support and event documentation will be changing, meaning automations will need updating in the future. v1 lays the groundwork for v2 and is functionally very close to proper push support, if not ideal.

When a button is pressed (lock, hazard, climate), the integration starts a background process that polls the inbox in MyMazda 1-5 times. As soon as a success or failure is detected, an event is fired in Home Assistant and the process stops. This event can then be detected to trigger automations, including notifications. See the examples folder for notification automation.

  • Timing: is specifically related to the intervals of typical responses for success/failure/rejection.
    • This will be obviated in v2, so unlikely I'll adjust further.
    • In an effort to reduce calls to Mazda, the integration will send null button presses until this check is complete (Mazda rejects them with a busy notification anyways).

About

Custom component for Home Assistant that adds integration for Mazda Connected Services

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Python 73.9%
  • Swift 11.6%
  • JavaScript 7.6%
  • HTML 6.6%
  • CSS 0.3%