-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify UI for devices that only have a power state #12
base: main
Are you sure you want to change the base?
Conversation
Only add the TelevisionSpeaker service if we have a device with mute state implemented (which is required for TelevisionSpeaker), which simplifies the UI displayed in HomeKit for things that only have a power state. Additionally, the empty array checks in the Homebridge callbacks weren't working as it turns out `[]` is truthy - which was causing Homebridge to complain that the callback was never called. This check shouldn't actually be needed any more with the first change, but I fixed that before realising the service could be removed completely.
This fixes #8 |
Heya - I can't see them I'm afraid! If they're in a review, double-check the whole review was submitted at the top of the page 😄 |
); | ||
|
||
// Mute is a required characteristic for TelevisionSpeaker, if we don't have any mutable devices don't register the service. | ||
if (this.devicesToQueryForMute?.length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should instead check if the volume and/or mute command(s) are configured. It is possible for the volume/mute commands to be configured via only LIRC, at which point there is no devicesToQueryForMute
since LIRC can't be queried. The state falls back to this.states.mute
in that case.
|
||
// register inputs | ||
this.device.inputs.forEach( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should update the type on inputs to be optional
@@ -136,7 +136,7 @@ interface UniversalControlDevice { | |||
*/ | |||
export class Television { | |||
private tvService: Service; | |||
private tvSpeakerService: Service; | |||
private tvSpeakerService: Service | undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of | undefined
, use tvSpeakerService?: Service
to be consistent with other possibly undefined type definitions.
Only add the TelevisionSpeaker service if we have a device with mute state implemented (which is required for TelevisionSpeaker), which simplifies the UI displayed in HomeKit for things that only have a power state.
Additionally, the empty array checks in the Homebridge callbacks weren't working as it turns out
[]
is truthy - which was causing Homebridge to complain that the callback was never called. This check shouldn't actually be needed any more with the first change, but I fixed that before realising the service could be removed completely.I ran into this troubleshooting a warning from Homebridge:
with a very basic config for my projector: