leaf-homekit

command module
v0.0.0-...-3bbea14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2022 License: MIT Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

leaf-homekit

HomeKit support for the Nissan Leaf using hc and my Leaf Go library.

When running, this service publishes a single HomeKit accessory exposing three services:

  1. A battery service indicating the current charge of your Leaf and its charging status.
  2. A switch service indicating whether the Leaf is currently charging. If the Leaf is plugged in but not charging, you can flip this switch on to begin charging the vehicle.
  3. A switch service for the Leaf's climate control. Flipping this switch on starts the vehicle's climate control system.

The Nissan API does not expose climate control status, and it is not possible to disable charging once it has started. As a result, the two switches are stateless and will always reset to the off position. HomeKit does not expose a stateless switch (button) service we can use.

After the vehicle is paired with your iOS Home app, you can control it with any service that integrates with HomeKit, including Siri ("How much battery does the Leaf have?") and Apple Watch. If you have a home hub like an Apple TV or iPad, you can control the Leaf remotely.

Installing

The tool can be installed with:

go get -u github.com/joeshaw/leaf-homekit

You will need a configuration file with your Nissan username and password. The format is the same as the config file for the leaf, so you can use it for both tools.

You will need to create a file like ~/.leaf:

username foo@example.com
password carwingsPassw0rd

Then you can run the service:

leaf-homekit -config ~/.leaf

The service will make an initial call to the Nissan service to get the current battery information -- this can take nearly 30 seconds -- before it exposes the accessory to HomeKit.

To pair, open up your Home iOS app, click the + icon, choose "Add Accessory" and then tap "Don't have a Code or Can't Scan?" You should see the Leaf under "Nearby Accessories." Tap that and enter the PIN 00102003 (or whatever you chose in your config file).

Contributing

Issues and pull requests are welcome. When filing a PR, please make sure the code has been run through gofmt.

License

Copyright 2020 Joe Shaw

leaf-homekit is licensed under the MIT License. See the LICENSE file for details.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址