Skip to content

Commit

Permalink
fix: cached speakers persisting after deletion/rename in config. This…
Browse files Browse the repository at this point in the history
… was causing duplicate speakers to appear in homekit
  • Loading branch information
joeyhage committed Apr 12, 2023
1 parent cabacb6 commit dc1e8d0
Show file tree
Hide file tree
Showing 17 changed files with 8,554 additions and 2,947 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: joeyhage
15 changes: 9 additions & 6 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ about: Create a report to help us improve
title: ''
labels: bug
assignees: joeyhage

---

<!-- You must use the issue template below when submitting a bug -->

**Describe The Bug:**

<!-- A clear and concise description of what the bug is. -->

**To Reproduce:**

<!-- Steps to reproduce the behavior. -->

**Expected behavior:**

<!-- A clear and concise description of what you expected to happen. -->

**Logs:**
Expand All @@ -31,14 +33,15 @@ Show your Homebridge config.json here, remove any sensitive information.
```

**Screenshots:**

<!-- If applicable, add screenshots to help explain your problem. -->

**Environment:**

* **Plugin Version**:
* **Homebridge Version**: <!-- homebridge -V -->
* **Node.js Version**: <!-- node -v -->
* **NPM Version**: <!-- npm -v -->
* **Operating System**: <!-- Raspbian / Ubuntu / Debian / Windows / macOS / Docker / hb-service -->
- **Plugin Version**:
- **Homebridge Version**: <!-- homebridge -V -->
- **Node.js Version**: <!-- node -v -->
- **NPM Version**: <!-- npm -v -->
- **Operating System**: <!-- Raspbian / Ubuntu / Debian / Windows / macOS / Docker / hb-service -->

<!-- Click the "Preview" tab before you submit to ensure the formatting is correct. -->
6 changes: 4 additions & 2 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@ about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: joeyhage

---

**Is your feature request related to a problem? Please describe:**

<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->

**Describe the solution you'd like:**

<!-- A clear and concise description of what you want to happen. -->

**Describe alternatives you've considered:**

<!-- A clear and concise description of any alternative solutions or features you've considered. -->

**Additional context:**
<!-- Add any other context or screenshots about the feature request here. -->

<!-- Add any other context or screenshots about the feature request here. -->

<!-- Click the "Preview" tab before you submit to ensure the formatting is correct. -->
13 changes: 7 additions & 6 deletions .github/ISSUE_TEMPLATE/support-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ about: Need help?
title: ''
labels: question
assignees: joeyhage

---

<!-- You must use the issue template below when submitting a support request -->

**Describe Your Problem:**

<!-- A clear and concise description of what problem you are trying to solve. -->

**Logs:**
Expand All @@ -25,14 +25,15 @@ Show your Homebridge config.json here, remove any sensitive information.
```

**Screenshots:**

<!-- If applicable, add screenshots to help explain your problem. -->

**Environment:**

* **Plugin Version**:
* **Homebridge Version**: <!-- homebridge -V -->
* **Node.js Version**: <!-- node -v -->
* **NPM Version**: <!-- npm -v -->
* **Operating System**: <!-- Raspbian / Ubuntu / Debian / Windows / macOS / Docker / hb-service -->
- **Plugin Version**:
- **Homebridge Version**: <!-- homebridge -V -->
- **Node.js Version**: <!-- node -v -->
- **NPM Version**: <!-- npm -v -->
- **Operating System**: <!-- Raspbian / Ubuntu / Debian / Windows / macOS / Docker / hb-service -->

<!-- Click the "Preview" tab before you submit to ensure the formatting is correct. -->
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"

- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "monthly"
14 changes: 11 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: Build and Lint

on: [push, pull_request]
on:
push:
branches: [ main ]
paths-ignore:
- '.github/**'
- '.husky/**'
- '.vscode/**'
pull_request:
branches: [ main ]

jobs:
build:
Expand All @@ -12,10 +20,10 @@ jobs:
node-version: [15.x, 16.x, 17.x, 18.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ name: "CodeQL"
on:
push:
branches: [ main ]
paths-ignore:
- '.github/**'
- '.husky/**'
- '.vscode/**'
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
Expand All @@ -38,11 +42,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -53,7 +57,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -67,4 +71,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Ignore compiled code
dist
.homebridge-spotify-speaker

# ------------- Defaults ------------- #

Expand Down
5 changes: 5 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
src
config.dev.json
TEMPLATE_README.md
.homebridge-spotify-speaker
.tool-versions

# ------------- Defaults ------------- #

Expand All @@ -17,6 +19,9 @@ TEMPLATE_README.md
# typescript
tsconfig.json

# jest
jest.config.js

# vscode
.vscode

Expand Down
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [1.2.4] - 2023-04-06

### Fixed

- Speaker accessories (lightbulbs) no longer appear in Homekit after being deleted or renamed in the plugin config.

## [1.2.3] - 2023-04-05

### Changed

- Change poblouin references to joeyhage since the old homebridge plugin is no longer maintained

[unreleased]: https://github.com/joeyhage/homebridge-spotify-speaker-temp/compare/v1.2.3...HEAD
[1.2.3]: https://github.com/joeyhage/homebridge-spotify-speaker-temp/compare/1.2.2...v1.2.3
[1.2.2]: https://github.com/joeyhage/homebridge-spotify-speaker-temp/releases/tag/1.2.2
22 changes: 17 additions & 5 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
The MIT License (MIT)
MIT License

Copyright © 2022 Pierre-Olivier Blouin
Copyright (c) 2023 Joseph Hage

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

# Homebridge Spotify Speaker

[![verified-by-homebridge](https://badgen.net/badge/homebridge/verified/purple)](https://github.com/homebridge/homebridge/wiki/Verified-Plugins)
[![npm version](https://img.shields.io/npm/v/homebridge-spotify-speaker)](https://www.npmjs.com/package/homebridge-spotify-speaker) [![npm downloads](https://img.shields.io/npm/dt/homebridge-spotify-speaker)](https://www.npmjs.com/package/homebridge-spotify-speaker) [![Build and Lint](https://github.com/joeyhage/homebridge-spotify-speaker/actions/workflows/build.yml/badge.svg)](https://github.com/joeyhage/homebridge-spotify-speaker/actions/workflows/build.yml)
[![npm version](https://img.shields.io/npm/v/homebridge-spotify-speaker)](https://www.npmjs.com/package/homebridge-spotify-speaker) [![npm downloads](https://img.shields.io/npm/dt/homebridge-spotify-speaker)](https://www.npmjs.com/package/homebridge-spotify-speaker) [![Build and Lint](https://github.com/joeyhage/homebridge-spotify-speaker-temp/actions/workflows/build.yml/badge.svg)](https://github.com/joeyhage/homebridge-spotify-speaker-temp/actions/workflows/build.yml)

Forked from poblouin/homebridge-spotify-speaker since it is no longer being maintained.

## Please read before using and facing any deceptions

The main purpose of this plugin is to expose a speaker in Homekit that is linked to a specific spotify device ID and that will play a specific playlist once activated. As of the current state, it is not a real speaker in Homekit, it's a lightbulb. A speaker accessory requires Airplay 2 and Spotify is not Airplay 2 compatible yet (will it ever be!?). With a lightbulb, you can toggle on/off the playlist and change the volume via the brightness setting.

The primary use case for me is that we have a little feather friend at home, and I wanted an easy way to start playing its Spotify playlist when we leave home. I might improve it in the future, but for now this is what I needed. I guess once Spotify will support Airplay 2, we will be able to play Spotify on the Homepod Mini, for example and this plugin won't have any purpose anymore. If you feel that something could be improved, PRs are the most welcome!

## Distinction between Spotify Connect and Spotify Connect API

Spotify Connect is the technology built-in the Spotify app (Desktop and Mobile) that allow a device to play music on a compatible Spotify Connect device.
Expand All @@ -25,12 +24,16 @@ I am not able to find an official, up to date and complete list of compatible Sp

## Speaker setup

The speaker itself only need to be Spotify connect compatible. Either natively or you can use a library to make a speaker compatible. I personally use a bluetooth speaker hooked up to a Raspberry pi and I use [Raspotify](https://github.com/dtcooper/raspotify).
The speaker itself only need to be Spotify connect compatible. Either natively or you can use a library to make a speaker compatible. I personally use an Amazon Echo Dot.

## Warning about the volume

This is Homekit's behaviour to set back the brightness to 100% when a device is shut down. There is nothing I can do about it unfortunately. So to make sure that you don't turn on your speaker with the volume set to 100%, use a scene to toggle on the speaker and set the default volume (brightness) in there.

### Future enhancement planned

I plan to add an option to use a switch instead of a lightbulb and a new configuration option for volume. This would allow setting the volume to the same thing every time the switch is toggled on.

## Spotify Setup

To use this plugin you must provide some authentication information to Spotify and those steps has to be done manually. Note that Spotify Premium is required in order to use the Connect API.
Expand Down Expand Up @@ -91,7 +94,7 @@ You can also use the [Spotify developer console](https://developer.spotify.com/c

## Issues and Questions

If you run into issues or you need help please use the [issues template](https://github.com/joeyhage/homebridge-spotify-speaker/issues/new/choose). Fill all the relevant sections and submit your issue. It is important that you use the templates because I will automatically be assigned to your issue and I will receive an email. If you use the blank template without assigning me, I will most likely miss the Github notification since I have too many of them with work, I can't read them all.
If you run into issues or you need help please use the [issues template](https://github.com/joeyhage/homebridge-spotify-speaker-temp/issues/new/choose). Fill all the relevant sections and submit your issue. It is important that you use the templates because I will automatically be assigned to your issue and I will receive an email. If you use the blank template without assigning me, I will most likely miss the Github notification since I have too many of them with work, I can't read them all.

## FAQ

Expand All @@ -113,5 +116,4 @@ To try it before changing the Homebridge plugin settings, test the [Start/Resume

## Contributors

Special thanks to Tuca, the reason behind this plugin.
![One Scary Reptile](assets/scary-reptile.png)
Special thanks to [@poblouin](https://github.com/poblouin) who had the original idea for this plugin and did all the heavy lifting! See [poblouin/homebridge-spotify-speaker](https://github.com/poblouin/homebridge-spotify-speaker) for the original repository.
Binary file removed assets/scary-reptile.png
Binary file not shown.
Loading

0 comments on commit dc1e8d0

Please sign in to comment.