Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/JosephDuffy/homebridge-pc-volume

Homebridge plugin to control your computer's volume using HomeKit and Siri
https://github.com/JosephDuffy/homebridge-pc-volume

computer-volume home-automation homebridge homekit

Last synced: 6 days ago
JSON representation

Homebridge plugin to control your computer's volume using HomeKit and Siri

Awesome Lists containing this project

README

        

# homebridge-pc-volume

[![Verified by Homebridge](https://badgen.net/badge/homebridge/verified/purple)](https://github.com/homebridge/homebridge/wiki/Verified-Plugins)
[![Tests Status](https://github.com/JosephDuffy/homebridge-pc-volume/workflows/Tests/badge.svg)](https://github.com/JosephDuffy/homebridge-pc-volume/actions?query=workflow%3ATests)
[![codecov](https://codecov.io/gh/JosephDuffy/homebridge-pc-volume/branch/master/graph/badge.svg)](https://codecov.io/gh/JosephDuffy/homebridge-pc-volume)
[![npm version](https://img.shields.io/npm/v/homebridge-pc-volume.svg)](https://www.npmjs.com/package/homebridge-pc-volume)

homebridge-pc-volume is a Homebridge plugin that adds a support for changing a computer's volume using HomeKit and Siri.

## OS Support

homebridge-pc-volume utilises [node-loudness](https://github.com/LinusU/node-loudness), which currently supports macOS, Linux (using ALSA), and Windows. Windows may need OpenSSL to be installed; it is required when being run on CI, which installs the latest 64-bit not-light 1.0.2 build avialable from [https://slproweb.com/products/Win32OpenSSL.html](https://slproweb.com/products/Win32OpenSSL.html). I have not personally tested this project on Linux or Windows.

## Installation

First, [install Homebridge](https://github.com/nfarina/homebridge#installation).

Then install homebridge-pc-volume via `npm`:

`npm install -g homebridge-pc-volume`

homebridge-pc-volume will also need to be specified as an accessory in your `~/.homebridge/config.json`:

```
{
// Other keys here...
"accessories": [
{
"accessory": "ComputerSpeakers",
"name": "MacBook"
}
]
}
```

Note that `accessory` _must_ be "ComputerSpeakers", while the `name` can be any value of your choosing.

## Configuration

When the property `logarithmic` is set to `true` the volume will be [scaled logarithmically](https://www.wolframalpha.com/input/?i=100*(log10(1%2Bx)%2F2)+from+x%3D0+to+100).

The `services` property can be used to decide how your computer's speaker will be exposed: as a lightbulb, fan, speaker, or a combination of all 3.

Please note that while iOS 11 supports "HomeKit speakers" this appears to actually be via AirPlay 2, so the "speaker" option is unlikely to work!

If no services key is provided a lightbulb will be exposed.

### Lightbulb Only (default, implicit)

```
"accessories": [
{
"accessory": "ComputerSpeakers",
"name": "MacBook"
}
]
```

### Lightbulb Only (default prior to 1.1)

```
"accessories": [
{
"accessory": "ComputerSpeakers",
"name": "MacBook",
"services": ["lightbulb"]
}
]
```

### Fan Only

```
"accessories": [
{
"accessory": "ComputerSpeakers",
"name": "MacBook",
"services": ["fan"]
}
]
```

### Speaker and Fan

```
"accessories": [
{
"accessory": "ComputerSpeakers",
"name": "MacBook",
"services": ["speaker", "fan"]
}
]
```

### Volume Buttons

Buttons can be exposed that will increase or decrease the system volume by a set percentage. These services are called `increase-button` and `decrease-button`. `switchVolumeDelta` can be provided to change the default percentage change of 5%. `switchDelay` controls the delay in ms between the switch being turned on and turned back off. Without a delay the Home app will not display the change. Defaults to `10`.

```
"accessories": [
{
"accessory": "ComputerSpeakers",
"name": "MacBook",
"services": ["fan", "increase-button", "decrease-button"],
"switchVolumeDelta": 10,
"switchDelay": 100
}
]
```

### Initial Values

If you wish to set some initial values when the plugin starts you can set the `initialVolume` and `initiallyMuted` properties:

```
"accessories": [
{
"accessory": "ComputerSpeakers",
"name": "MacBook",
"initialVolume": 70,
"initiallyMuted": true
}
]
```

## Development

To develop homebridge-pc-volume locally:

1. Clone the project
2. Run `npm install`
3. Run `npm run build`
4. Run `npm install --global $(pwd)`

This will allow homebridge to find your local version of homebridge-pc-volume. After making changes you will need to restart homebridge.

You may also stop any homebridge instance you already have running and run `yarn build:watch:debug`, which will start homebridge, and automatically restart it when a source file is updated. This instance of homebridge uses the `.homebridge-debug/config.json` config file.