homebridge-virtual-accessories 3.1.6 → 3.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -20
- package/assets/mentions/youtube-video.png +0 -0
- package/config.schema.json +8 -0
- package/dist/accessories/virtualAccessory.d.ts +1 -2
- package/dist/accessories/virtualAccessory.js +9 -8
- package/dist/accessories/virtualAccessory.js.map +1 -1
- package/dist/accessories/virtualAccessoryDoorbell.d.ts +1 -2
- package/dist/accessories/virtualAccessoryDoorbell.js +0 -10
- package/dist/accessories/virtualAccessoryDoorbell.js.map +1 -1
- package/dist/accessories/virtualAccessoryLightbulb.d.ts +2 -1
- package/dist/accessories/virtualAccessoryLightbulb.js +54 -34
- package/dist/accessories/virtualAccessoryLightbulb.js.map +1 -1
- package/dist/accessories/virtualAccessorySwitch.d.ts +15 -0
- package/dist/accessories/virtualAccessorySwitch.js +105 -27
- package/dist/accessories/virtualAccessorySwitch.js.map +1 -1
- package/dist/accessories/virtualAccessoryValve.js +2 -2
- package/dist/accessories/virtualAccessoryValve.js.map +1 -1
- package/dist/accessoryFactory.d.ts +2 -0
- package/dist/accessoryFactory.js +4 -0
- package/dist/accessoryFactory.js.map +1 -1
- package/dist/configuration/configurationDuration.d.ts +4 -0
- package/dist/configuration/configurationDuration.js +4 -0
- package/dist/configuration/configurationDuration.js.map +1 -1
- package/dist/configuration/configurationTimer.d.ts +1 -0
- package/dist/configuration/configurationTimer.js +7 -1
- package/dist/configuration/configurationTimer.js.map +1 -1
- package/dist/sensors/virtualSensor.js +1 -1
- package/dist/sensors/virtualSensor.js.map +1 -1
- package/dist/timer.d.ts +7 -5
- package/dist/timer.js +25 -23
- package/dist/timer.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
@@ -22,11 +22,6 @@
|
|
22
22
|
|
23
23
|
## <!-- Thin separator line -->
|
24
24
|
|
25
|
-
> [!NOTE]
|
26
|
-
> Make sure to check the [Wiki](https://github.com/justjam2013/homebridge-virtual-accessories/wiki) for updates.
|
27
|
-
|
28
|
-
## <!-- Thin separator line -->
|
29
|
-
|
30
25
|
<details>
|
31
26
|
<summary>
|
32
27
|
|
@@ -70,6 +65,9 @@
|
|
70
65
|
- [Creative Uses](#creative-uses)
|
71
66
|
- [Mentions](#mentions)
|
72
67
|
- [Known Issues](#known-issues)
|
68
|
+
- [Issues with Homebridge UI](#issues-with-homebridge-ui)
|
69
|
+
- [Issues with underlying frameworks](#issues-with-underlying-frameworks)
|
70
|
+
- [Issues with HomeKit](#issues-with-homekit)
|
73
71
|
- [What if I run into a problem?](#what-if-i-run-into-a-problem)
|
74
72
|
</details>
|
75
73
|
|
@@ -79,20 +77,20 @@
|
|
79
77
|
|
80
78
|
This plugin is inspired by Nick Farina's most excellent 🎸 [homebridge-dummy](https://github.com/nfarina/homebridge-dummy) plugin, which formed the backbone of my HomeKit automations. This plugin is Homebridge Verified and is ready for Homebridge 2.0.
|
81
79
|
|
82
|
-
The purpose of this plugin is to provide a single solution for creating different types of virtual HomeKit accessories. In my automations it has replaced seven separate plugins, each of which provided part of the functionality I needed, and all of which had gone unmaintained or abandoned. Also, it became annoying
|
80
|
+
The purpose of this plugin is to provide a single solution for creating different types of virtual HomeKit accessories. In my automations it has replaced seven separate plugins, each of which provided part of the functionality I needed, and all of which had gone unmaintained or abandoned. Also, it became annoying to have to figure out which plugin provided what functionality, or managed which accessory, each time I wanted to make a change.
|
83
81
|
|
84
|
-
The downside to a single plugin is trading ease of accessory maintenance for a single point of failure. However, this is work in progress so I will be
|
82
|
+
The downside to a single plugin is trading ease of accessory maintenance for a single point of failure. However, this is work in progress so I will be releasing bug fixes and updates. Also, I will slowly add new accessories and functionality, either as I need them, or, more likely, in response to requests by users who find this plugin useful.
|
85
83
|
|
86
84
|
Currently, these are the implemented virtual accessories:
|
87
85
|
|
88
|
-
- **Doorbell.** Allows you to use a button as a doorbell and have it play a chime on
|
86
|
+
- **Doorbell.** Allows you to use a button as a doorbell and have it play a chime on HomePods.
|
89
87
|
- **Fan.** Allows you to create a virtual fan and set rotation direction and speed.
|
90
|
-
- **Garage Door.** Allows you to create a virtual garage door. Generates a HomeKit notification when the accessory's state changes.
|
88
|
+
- **Garage Door.** Allows you to create a virtual garage door. Generates a HomeKit notification when the accessory's state changes. CarPlay will display the Garage widget on the display when you approach your home.
|
91
89
|
- **Heater/Cooler.** Allows you to create a virtual thermostat/AC accessory. You can select heater only, cooler only, or heater + cooler combo. The heater/cooler temperature sensor can be updated via a [webhook call](#webhook-service-configuration). Based on the threshold values, the accessory will switch to the appropriate operating state, according to the supported states.
|
92
90
|
- **Humidifier/Dehumidifier.** Allows you to create a virtual humidifier/dehumidifier. You can select humidifier only, dehumidifier only, or humidifier + dehumidifier combo. The humidifier/dehumidifier humidity sensor can be updated via a [webhook call](#webhook-service-configuration). Based on the threshold values, the accessory will switch to the appropriate operating state, according to the supported states.
|
93
|
-
- **Lightbulb.** Allows you to create virtual white (on/off and brightness) and white ambiance (on/off, brightness, and temperature) lightbulbs. In the Home app, this can be used as a dimmer switch.
|
91
|
+
- **Lightbulb.** Allows you to create virtual white (on/off and brightness) and white ambiance (on/off, brightness, and color temperature) lightbulbs. In the Home app, this can be used as a dimmer switch.
|
94
92
|
- **Lock.** Allows you to create a virtual lock. Generates a HomeKit notification when the accessory's state changes.
|
95
|
-
- **Security System.** Allows you to create a virtual security system.
|
93
|
+
- **Security System.** Allows you to create a virtual security system. Generates a HomeKit notification when the accessory's state changes.
|
96
94
|
- **Speaker.** Allows you to create a virtual speaker.
|
97
95
|
- **Valve.** Allows you to create different types of virtual valves: generic, irrigation, shower head, or water faucet.
|
98
96
|
- **Window Covering.** Allows you to create virtual blinds and shades.
|
@@ -100,14 +98,22 @@ Currently, these are the implemented virtual accessories:
|
|
100
98
|
- **Plain old switches.** What it says on the label.
|
101
99
|
- **Normally on/off switches.** The default state of the switch can be set to "on" or "off". This is also the default state when Homebridge restarts. If you pair it with a timer, the switch will revert back to the default state when the timer expires.
|
102
100
|
- **Stateful switches.** The state of the switch persists across restarts of Homebridge. This includes timed switches.
|
103
|
-
- **Timed switches.** This is a way to introduce timers into HomeKit. The switch will revert back to its default state when the timer expires. If the switch is stateful, the timer will be restored after a restart of Homebridge. While care is taken to restore the timer with the appropriate time correction, **absolute accuracy is not guaranteed and should not be expected**. The accuracy of the restored timer will be affected, among other things, by the hardware and software Homebridge is running on, the number of plugins installed, the order with which the plugins are restored, etc.
|
104
101
|
- **Switches with companion sensors.** The switch will trigger a companion sensor when it changes state, generating a HomeKit-native notification in the Home app. Selecting a critical sensor type will allow notifications to bypass Focuses like "Do Not Disturb". This is just the easier way of implementing a switch triggered sensor.
|
105
102
|
- **Dimmer switches.** To create a dimmer switch use a virtual lightbulb.
|
103
|
+
- **Timed switches.** This is a way to introduce timers into HomeKit. The switch will revert back to its default state when the timer expires. If the switch is stateful, the timer will be restored after a restart of Homebridge. While care is taken to restore the timer with the appropriate time correction, **absolute accuracy is not guaranteed and should not be expected**. The accuracy of the restored timer will be affected, among other things, by the hardware and software Homebridge is running on, the number of plugins installed, the order with which the plugins are restored, etc.
|
106
104
|
- **Sensor.** Allows you to create different types of virtual sensors. If Activity Notifications are enabled in the Home app, sensors will generate notifications when their state changes in response to a detected event. Some types of notifications, classified as `critical` by Homekit, are allowed to bypass Focuses like `Do Not Disturb` and some are allowed to appear in CarPlay. Sensors can be activated by different triggers. Currently, the available triggers are:
|
107
105
|
- **Host Ping trigger.** Actvates the sensor after a configurable number of failed attempts to ping a network host. The sensor resets when ping is successful.
|
108
106
|
- **Cron trigger.** Activates the sensor when the time and date match the schedule deascribed by a cron expression. The sensor resets after a brief delay.
|
109
107
|
- **Sun Events trigger.** Activates the sensor when the selected event happens: sunrise, sunset, and golden hour (for the photographers among us). The sensor resets after a brief delay.
|
110
108
|
- **Switch trigger.** To create a switch triggered sensor, create a virtual switch accessory with a companion sensor. This is just the easier way of implementing a switch triggered sensor. A future version may provide the ability to create this pairing as a sensor with a switch trigger.
|
109
|
+
|
110
|
+
<span align="right">
|
111
|
+
<h6>
|
112
|
+
|
113
|
+
[Back to top](https://github.com/justjam2013/homebridge-virtual-accessories)
|
114
|
+
|
115
|
+
</h6>
|
116
|
+
</span>
|
111
117
|
|
112
118
|
## Installation
|
113
119
|
|
@@ -159,6 +165,14 @@ This document provides steps for installing the Entware toolchain and other need
|
|
159
165
|
|
160
166
|
The [Synology DSM 7.2.2 Developer Guide](https://help.synology.com/developer-guide/getting_started/system_requirement.html) provides information to setup the build tools for Synology DSM platforms.
|
161
167
|
|
168
|
+
<span align="right">
|
169
|
+
<h6>
|
170
|
+
|
171
|
+
[Back to top](https://github.com/justjam2013/homebridge-virtual-accessories)
|
172
|
+
|
173
|
+
</h6>
|
174
|
+
</span>
|
175
|
+
|
162
176
|
## Configuration
|
163
177
|
|
164
178
|
You can configure the plugin from the Homebridge UI, or by ediiting the JSON configuration directly in the Homebridge JSON Config editor.
|
@@ -180,9 +194,17 @@ I use [random.org](https://www.random.org/) to generate unique IDs. While the pl
|
|
180
194
|
> [!NOTE]
|
181
195
|
> `acccessoryName` is the name that will apppear on the Homekit tile for the accessory, as well as the accessory header in the plugin config. While a unique name is not required, it is recommended to assign different names to each accessory. As Vitual Accessories For Homebridge uses `accessoryID` as the unique identifier, **you can change the accessory name at any time**, if you so choose to. The name change will be propagated to the Home app.
|
182
196
|
|
183
|
-
|
197
|
+
It is recommended to use the Homebridge UI to configure this plugin, as the requirements may vary based on the property value selections. If you choose to manually create or modify the accessory JSON configurations, the following configurations are references and do not cover all of the different value permutations. Please adjust for your requirements.
|
198
|
+
|
199
|
+
<span align="right">
|
200
|
+
<h6>
|
201
|
+
|
202
|
+
[Back to top](https://github.com/justjam2013/homebridge-virtual-accessories)
|
184
203
|
|
185
|
-
|
204
|
+
</h6>
|
205
|
+
</span>
|
206
|
+
|
207
|
+
## Accessory Configurations
|
186
208
|
|
187
209
|
### Doorbell
|
188
210
|
|
@@ -667,6 +689,14 @@ To add the speaker accessory in the Home app follow these steps:
|
|
667
689
|
> [!NOTE]
|
668
690
|
> Due to limitations in the current version of one of Homebridge UI's dependencies, the Homebridge UI may save additional fields to the JSON config that may not be relevant to a particular accessory. The JSON config for each individual accessory is validated on startup and extranous fields are ignored. In a future release, the startup validation may perform a config cleanup. However. this does not affect the behavior of the accessories, nor does it hurt to manually remove those fields from the JSON config.
|
669
691
|
|
692
|
+
<span align="right">
|
693
|
+
<h6>
|
694
|
+
|
695
|
+
[Back to top](https://github.com/justjam2013/homebridge-virtual-accessories)
|
696
|
+
|
697
|
+
</h6>
|
698
|
+
</span>
|
699
|
+
|
670
700
|
## Webhook Service Configuration
|
671
701
|
|
672
702
|
Virtual Accessories For Homebridge includes a webhook service to update accessory sensors via web calls. There are no changes required to individual accessories' configurations. Simply enabling the webhook service will automatically make all supported virtual sensors available. Curently supported accessory sensors are:
|
@@ -743,6 +773,14 @@ The raw json payload will contain the accessory id of the heater/cooler and the
|
|
743
773
|
> [!NOTE]
|
744
774
|
> The temperature value must be specified in the same temperature units (Celsius or Fahrenheit) as specified by the accessory's configuration.
|
745
775
|
|
776
|
+
<span align="right">
|
777
|
+
<h6>
|
778
|
+
|
779
|
+
[Back to top](https://github.com/justjam2013/homebridge-virtual-accessories)
|
780
|
+
|
781
|
+
</h6>
|
782
|
+
</span>
|
783
|
+
|
746
784
|
## Creative Uses
|
747
785
|
|
748
786
|
I started this plugin as a Homebridge 2.0 ready plugin to replace [homebridge-dummy](https://github.com/nfarina/homebridge-dummy), which, along with six other plugins, formed the backbone of my HomeKit automations. Then I got some really odd requests, like a window covering. Okay ... what the heck are you going to do with a virtual window covering?? Well, the user who requested it wanted to use "Siri open/close .." to control their trash bin, as opposed to "Siri on/off .." as would be required with switches. Yup, "I use [your plugin] for my trash" is what every plugin developer loves to hear! 🤣 <br/>
|
@@ -763,21 +801,54 @@ So here are creative ways people have used this plugin. Maybe they might inspire
|
|
763
801
|
|
764
802
|
People using Virtual Accessories For Homebridge!
|
765
803
|
|
766
|
-
Patrick Hunt, the content creator of the [Make Smart Matter](https://www.youtube.com/@MakeSmartMatter) YouTube channel is using Virtual Accessories For Homebridge.
|
804
|
+
Patrick Hunt, the content creator of the [Make Smart Matter](https://www.youtube.com/@MakeSmartMatter) YouTube channel is using Virtual Accessories For Homebridge. His videos are amusing to watch and it's cool to see him use this plugin to solve common day-to-day problems that most people that use HomeKit will encounter at some point.
|
767
805
|
|
768
|
-
<a href="https://www.youtube.com
|
806
|
+
<a href="https://www.youtube.com/@MakeSmartMatter">
|
769
807
|
<img src="assets/mentions/youtube-video.png" height="240">
|
770
808
|
</a>
|
809
|
+
<p></p>
|
810
|
+
|
811
|
+
You can catch a glimpse in the [Introduction to Automations in Apple Home](https://www.youtube.com/watch?v=zspT4lNZ0QE) video at timestamp [7:46](https://www.youtube.com/watch?v=zspT4lNZ0QE&t=466s).
|
812
|
+
|
813
|
+
He again uses Virtual Accessories for Homebridge in his latest video, [Dummies for Dummies Who Use the HomePod](https://www.youtube.com/watch?v=US5NCnXidYI).
|
771
814
|
|
772
815
|
## Known Issues
|
773
816
|
|
817
|
+
#### Issues with Homebridge UI:
|
818
|
+
|
774
819
|
- The Humidifier/Dehumidifier accessory is not properly rendered in Homebridge UI. Homebrige UI currently is unable to differentiate between Humidifier-only, Dehumidifier-only, and Humidifier-Dehumidifier accessories, but HomeKit renders it correctly.
|
775
820
|
- The Heater/Cooler accessory is not properly rendered in Homebridge UI. Homebrige UI currently is unable to differentiate between Heater-only, Cooler-only, and Heater-Cooler accessories, but HomeKit renders it correctly.
|
776
|
-
|
777
|
-
|
821
|
+
|
822
|
+
#### Issues with underlying frameworks:
|
823
|
+
|
824
|
+
- The ability to order the accessories in the config popup has been rolled back, as it makes it impossible to drag a number slider, for example to set timer values. A bug report has been opened with the underlying framework project and, once this behavior is fixed, this functionality will be restored. The temporary workaround is to manually edit the order of the accessories in the JSON configuration.
|
825
|
+
|
826
|
+
#### Issues with HomeKit:
|
827
|
+
|
828
|
+
- The volume on the Doorbell accessory does not work. This is a limitation of Homekit. Per the [HomeKit Accessory Protocol specification](https://forum.iobroker.net/assets/uploads/files/1634848447889-apple-spezifikation-homekit.pdf), the Doorbell is `the primary service of the Video Doorbell Profile.` What that means is that a Doorbell should only be added to HomeKit as part of a Video Doorbell and the Home app will not display a standalone Doorbell. This plugin takes advantage of the fact that, although it is not displayed, the Doorbell is still there and the companion switch allows you to interact with it, leading HomeKit to play a chime on the HomePods. Unfortunately, because the Doorbell is not displayed, you cannot configure which HomePod(s) it connects to and you cannot configure the volume. You can set the volume level in the free [Eve app](https://www.evehome.com/en-us/eve-app), however it will not affect the HomePod volume.
|
829
|
+
|
830
|
+
> [!NOTE]
|
831
|
+
> I considered creating a virtual Video Doorbell accessory, however I ruled it out due to the amount of work required. Also, this functionality is easily implemented with the [Homebridge Camera Ffmpeg](https://github.com/homebridge-plugins/homebridge-camera-ffmpeg) plugin.
|
832
|
+
>
|
833
|
+
> Without a live feed, you will get a black rectangle in the Home app. Here are a few ways that you can display something instead of that black rectangle:
|
834
|
+
> - Configure it without setting a valid `source` and setting `stillImageSource` to the URL of an image.
|
835
|
+
> - Configure it by setting `source` to `"-loop 1 -i http://192.168.4.63:8086/image"` (where `http://192.168.4.63:8086/image` is the URL to a still image) and setting `maxFPS` to `1`.
|
836
|
+
> - Configure it by setting `source` to a live internet traffic cam or nature cam.
|
837
|
+
>
|
838
|
+
> I have not done this myself, so please refer to the plugin documentation for any questions.
|
778
839
|
|
779
840
|
## What if I run into a problem?
|
780
841
|
|
781
|
-
|
842
|
+
Check the [Wiki](https://github.com/justjam2013/homebridge-virtual-accessories/wiki). Here you will find entries with instructions in the event of breaking updates. I will also post detailed instructions for using certain functionalities, like the webhook service.
|
782
843
|
|
783
|
-
|
844
|
+
If the Wiki entries do not provide answers to your problem, you can [check the #virtual accessories channel on Discord](https://discord.gg/Z8jmyvb) for any notifications, or [open a bug report or a support request here on GitHub](https://github.com/justjam2013/homebridge-virtual-accessories/issues). Please include log outputs and configuration details to the issue, making sure to remove any sensitive information such as passwords, tokens, etc. The more information you provide, the better I can investigate the issues.
|
845
|
+
|
846
|
+
Please open a [Feature Request issue](https://github.com/justjam2013/homebridge-virtual-accessories/issues/new/choose) if you have any enhancement suggestions or any additional functionality that you would like to see added, or comment on an existing issue if one is already open. If the enhancement suggestion fits within the scope of the plugin, I will consider adding it in a future release.
|
847
|
+
|
848
|
+
<span align="right">
|
849
|
+
<h6>
|
850
|
+
|
851
|
+
[Back to top](https://github.com/justjam2013/homebridge-virtual-accessories)
|
852
|
+
|
853
|
+
</h6>
|
854
|
+
</span>
|
Binary file
|
package/config.schema.json
CHANGED
@@ -699,6 +699,14 @@
|
|
699
699
|
"functionBody": "return model.devices[arrayIndices].resetTimer && model.devices[arrayIndices].resetTimer.durationIsRandom === true;"
|
700
700
|
}
|
701
701
|
},
|
702
|
+
"isDynamic": {
|
703
|
+
"title": "Timer is Dynamic",
|
704
|
+
"description": "The timer duration can be changed in the UI",
|
705
|
+
"type": "boolean",
|
706
|
+
"condition": {
|
707
|
+
"functionBody": "return false;"
|
708
|
+
}
|
709
|
+
},
|
702
710
|
"isResettable": {
|
703
711
|
"title": "Timer is Resettable",
|
704
712
|
"description": "The timer is reset every time the accessory is triggered, even if the state of the accessory does not change",
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import type { PlatformAccessory, Service } from 'homebridge';
|
2
2
|
import { VirtualAccessoriesPlatform } from '../platform.js';
|
3
|
-
import { Sensor } from '../sensors/virtualSensor.js';
|
4
3
|
import { AccessoryConfiguration } from '../configuration/configurationAccessory.js';
|
5
4
|
import { VirtualAccessoriesLogger } from '../virtualLogger.js';
|
6
5
|
/**
|
@@ -12,9 +11,9 @@ export declare abstract class Accessory {
|
|
12
11
|
readonly accessory: PlatformAccessory;
|
13
12
|
readonly accessoryConfiguration: AccessoryConfiguration;
|
14
13
|
readonly log: VirtualAccessoriesLogger;
|
14
|
+
protected accessoryName: string;
|
15
15
|
protected defaultState: any;
|
16
16
|
protected storagePath: string;
|
17
|
-
protected companionSensor?: Sensor;
|
18
17
|
private accessoryInformationService?;
|
19
18
|
constructor(platform: VirtualAccessoriesPlatform, accessory: PlatformAccessory);
|
20
19
|
updateConfiguredName(): void;
|
@@ -8,17 +8,18 @@ export class Accessory {
|
|
8
8
|
accessory;
|
9
9
|
accessoryConfiguration;
|
10
10
|
log;
|
11
|
+
accessoryName = '';
|
11
12
|
defaultState;
|
12
13
|
storagePath;
|
13
|
-
companionSensor;
|
14
14
|
accessoryInformationService;
|
15
15
|
constructor(platform, accessory) {
|
16
16
|
this.accessory = accessory;
|
17
17
|
this.platform = platform;
|
18
18
|
// The accessory configuration is stored in the context in VirtualAccessoryPlatform.discoverDevices()
|
19
19
|
this.accessoryConfiguration = accessory.context.deviceConfiguration;
|
20
|
+
this.accessoryName = this.accessoryConfiguration.accessoryName;
|
20
21
|
this.log = this.platform.log;
|
21
|
-
this.log.debug(`[${this.
|
22
|
+
this.log.debug(`[${this.accessoryName}] Accessory context: ${JSON.stringify(accessory.context)}`);
|
22
23
|
this.storagePath = accessory.context.storagePath;
|
23
24
|
if (!this.accessoryConfiguration.accessoryIsStateful) {
|
24
25
|
this.deleteAccessoryState(this.storagePath);
|
@@ -43,28 +44,28 @@ export class Accessory {
|
|
43
44
|
contents = fs.readFileSync(storagePath, 'utf8');
|
44
45
|
}
|
45
46
|
const json = JSON.parse(contents);
|
46
|
-
this.log.debug(`[${this.
|
47
|
+
this.log.debug(`[${this.accessoryName}] Loading state: ${JSON.stringify(json)}`);
|
47
48
|
return json;
|
48
49
|
}
|
49
50
|
saveAccessoryState(storagePath, stateJson) {
|
50
51
|
// Overwrite the existing persistence file
|
51
|
-
this.log.debug(`[${this.
|
52
|
+
this.log.debug(`[${this.accessoryName}] Saving state: ${stateJson}`);
|
52
53
|
try {
|
53
54
|
fs.writeFileSync(storagePath, stateJson, { encoding: 'utf8', flag: 'w' });
|
54
|
-
this.log.debug(`[${this.
|
55
|
+
this.log.debug(`[${this.accessoryName}] Saved state: ${stateJson}`);
|
55
56
|
}
|
56
57
|
catch (error) {
|
57
|
-
this.log.error(`[${this.
|
58
|
+
this.log.error(`[${this.accessoryName}] Error saving state: ${error}`);
|
58
59
|
}
|
59
60
|
}
|
60
61
|
deleteAccessoryState(storagePath) {
|
61
|
-
this.log.debug(`[${this.
|
62
|
+
this.log.debug(`[${this.accessoryName}] Deleting state file ${storagePath}`);
|
62
63
|
if (fs.existsSync(storagePath)) {
|
63
64
|
try {
|
64
65
|
fs.unlinkSync(storagePath);
|
65
66
|
}
|
66
67
|
catch (err) {
|
67
|
-
this.log.error(`[${this.
|
68
|
+
this.log.error(`[${this.accessoryName}] Error deleting state file ${storagePath}`);
|
68
69
|
}
|
69
70
|
}
|
70
71
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"virtualAccessory.js","sourceRoot":"","sources":["../../src/accessories/virtualAccessory.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"virtualAccessory.js","sourceRoot":"","sources":["../../src/accessories/virtualAccessory.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB;;GAEG;AACH,MAAM,OAAgB,SAAS;IAC7B,OAAO,CAAW;IAET,QAAQ,CAA6B;IACrC,SAAS,CAAoB;IAE7B,sBAAsB,CAAyB;IAC/C,GAAG,CAA2B;IAE7B,aAAa,GAAW,EAAE,CAAC;IAE3B,YAAY,CAAC;IAEb,WAAW,CAAS;IAEtB,2BAA2B,CAAW;IAE9C,YACE,QAAoC,EACpC,SAA4B;QAE5B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,qGAAqG;QACrG,IAAI,CAAC,sBAAsB,GAAG,SAAS,CAAC,OAAO,CAAC,mBAAmB,CAAC;QACpE,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC;QAC/D,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,QAA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,CAAC,WAAW,CAAC,CAAC;YAC7B,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,aAAa,+BAA+B,WAAW,EAAE,CAAC,CAAC;YACrF,CAAC;QACH,CAAC;IACH,CAAC;IAED,iCAAiC;IACvB,UAAU;QAClB,IAAI,IAAI,CAAC,sBAAsB,CAAC,mBAAmB,EAAE,CAAC;YACpD,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;CAKF"}
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import type { CharacteristicValue, PlatformAccessory } from 'homebridge';
|
2
2
|
import { VirtualAccessoriesPlatform } from '../platform.js';
|
3
3
|
import { Accessory } from './virtualAccessory.js';
|
4
|
-
import { Switch } from './virtualAccessorySwitch.js';
|
5
4
|
/**
|
6
5
|
* Doorbell - Accessory implementation
|
7
6
|
*/
|
@@ -12,7 +11,7 @@ export declare class Doorbell extends Accessory {
|
|
12
11
|
static readonly LONG_PRESS: number;
|
13
12
|
private companionSensorResetTimerId;
|
14
13
|
private states;
|
15
|
-
|
14
|
+
private companionSwitch?;
|
16
15
|
constructor(platform: VirtualAccessoriesPlatform, accessory: PlatformAccessory);
|
17
16
|
getProgrammableSwitchEvent(): Promise<CharacteristicValue>;
|
18
17
|
setVolume(value: CharacteristicValue): Promise<void>;
|
@@ -27,16 +27,6 @@ export class Doorbell extends Accessory {
|
|
27
27
|
this.service.getCharacteristic(this.platform.Characteristic.Volume)
|
28
28
|
.onSet(this.setVolume.bind(this))
|
29
29
|
.onGet(this.getVolume.bind(this));
|
30
|
-
/**
|
31
|
-
* Creating multiple services of the same type.
|
32
|
-
*
|
33
|
-
* To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
|
34
|
-
* when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
|
35
|
-
* this.accessory.getService('NAME') || this.accessory.addService(this.platform.Service.Lightbulb, 'NAME', 'USER_DEFINED_SUBTYPE_ID');
|
36
|
-
*
|
37
|
-
* The USER_DEFINED_SUBTYPE must be unique to the platform accessory (if you platform exposes multiple accessories, each accessory
|
38
|
-
* can use the same subtype id.)
|
39
|
-
*/
|
40
30
|
// Create switch service
|
41
31
|
this.companionSwitch = AccessoryFactory.createVirtualCompanionSwitch(this.platform, this.accessory, this.accessoryConfiguration.accessoryName + ' Switch');
|
42
32
|
// Overwrite the "onSet" handler to trigger doorbell
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"virtualAccessoryDoorbell.js","sourceRoot":"","sources":["../../src/accessories/virtualAccessoryDoorbell.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAErD;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,SAAS;IAErC,MAAM,CAAU,mBAAmB,GAAW,UAAU,CAAC;IAEzD,MAAM,CAAU,YAAY,GAAW,CAAC,CAAC,CAAE,sDAAsD;IACjG,MAAM,CAAU,YAAY,GAAW,CAAC,CAAC,CAAE,sDAAsD;IACjG,MAAM,CAAU,UAAU,GAAW,CAAC,CAAC,CAAI,qDAAqD;IAExF,2BAA2B,CAA4C;IAEvE,MAAM,GAAG;QACf,MAAM,EAAE,GAAG;KACZ,CAAC;
|
1
|
+
{"version":3,"file":"virtualAccessoryDoorbell.js","sourceRoot":"","sources":["../../src/accessories/virtualAccessoryDoorbell.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC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,CAAC,CAAC;gBAAC,SAAS,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;YAAC,CAAC;QAC1C,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC"}
|
@@ -15,8 +15,9 @@ export declare class Lightbulb extends Accessory {
|
|
15
15
|
private readonly brightnessStorageKey;
|
16
16
|
private readonly colorTemperatureStorageKey;
|
17
17
|
private type;
|
18
|
+
private isCompanionLightbulb;
|
18
19
|
private states;
|
19
|
-
constructor(platform: VirtualAccessoriesPlatform, accessory: PlatformAccessory);
|
20
|
+
constructor(platform: VirtualAccessoriesPlatform, accessory: PlatformAccessory, companionLightbulbName?: string, companionLightbulbBrightness?: number);
|
20
21
|
setOn(value: CharacteristicValue): Promise<void>;
|
21
22
|
getOn(): Promise<CharacteristicValue>;
|
22
23
|
setBrightness(value: CharacteristicValue): Promise<void>;
|
@@ -14,45 +14,61 @@ export class Lightbulb extends Accessory {
|
|
14
14
|
stateStorageKey = 'LightbulbState';
|
15
15
|
brightnessStorageKey = 'LightbulbBrightness';
|
16
16
|
colorTemperatureStorageKey = 'LightbulbColorTemperature';
|
17
|
-
type;
|
17
|
+
type = Lightbulb.WHITE;
|
18
|
+
isCompanionLightbulb = false;
|
18
19
|
states = {
|
19
20
|
LightbulbState: Lightbulb.OFF,
|
20
|
-
LightbulbBrightness:
|
21
|
+
LightbulbBrightness: 0,
|
21
22
|
LightbulbColorTemperature: 2700, // Kelvin
|
22
23
|
// TODO: Add Brightness, Hue, Saturation
|
23
24
|
};
|
24
|
-
constructor(platform, accessory) {
|
25
|
+
constructor(platform, accessory, companionLightbulbName, companionLightbulbBrightness) {
|
25
26
|
super(platform, accessory);
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
this.states.LightbulbState = this.defaultState;
|
32
|
-
this.states.LightbulbBrightness = brightness;
|
33
|
-
if (this.type === Lightbulb.AMBIANCE) {
|
34
|
-
this.states.LightbulbColorTemperature = colorTemperatureKelvin;
|
27
|
+
if (companionLightbulbName !== undefined) {
|
28
|
+
this.accessoryName = companionLightbulbName;
|
29
|
+
this.isCompanionLightbulb = true;
|
30
|
+
this.states.LightbulbBrightness = (companionLightbulbBrightness !== undefined) ? companionLightbulbBrightness : this.states.LightbulbBrightness;
|
31
|
+
this.states.LightbulbState = (this.states.LightbulbBrightness === 0) ? Lightbulb.OFF : Lightbulb.ON;
|
35
32
|
}
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
const
|
41
|
-
const
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
this.states.LightbulbBrightness = cachedBrightness;
|
33
|
+
if (!this.isCompanionLightbulb) {
|
34
|
+
this.type = this.accessoryConfiguration.lightbulb.type;
|
35
|
+
// First configure the device based on the accessory details
|
36
|
+
this.defaultState = this.accessoryConfiguration.lightbulb.defaultState === 'on' ? Lightbulb.ON : Lightbulb.OFF;
|
37
|
+
const brightness = this.accessoryConfiguration.lightbulb.brightness;
|
38
|
+
const colorTemperatureKelvin = this.accessoryConfiguration.lightbulb.colorTemperatureKelvin;
|
39
|
+
this.states.LightbulbState = this.defaultState;
|
40
|
+
this.states.LightbulbBrightness = brightness;
|
41
|
+
if (this.type === Lightbulb.AMBIANCE) {
|
42
|
+
this.states.LightbulbColorTemperature = colorTemperatureKelvin;
|
47
43
|
}
|
48
|
-
|
49
|
-
|
44
|
+
// If the accessory is stateful retrieve stored state
|
45
|
+
if (this.accessoryConfiguration.accessoryIsStateful) {
|
46
|
+
const accessoryState = this.loadAccessoryState(this.storagePath);
|
47
|
+
const cachedState = accessoryState[this.stateStorageKey];
|
48
|
+
const cachedBrightness = accessoryState[this.brightnessStorageKey];
|
49
|
+
const cachedColorTemperature = accessoryState[this.colorTemperatureStorageKey];
|
50
|
+
if (cachedState !== undefined) {
|
51
|
+
this.states.LightbulbState = cachedState;
|
52
|
+
}
|
53
|
+
if (cachedBrightness !== undefined) {
|
54
|
+
this.states.LightbulbBrightness = cachedBrightness;
|
55
|
+
}
|
56
|
+
if (this.type === Lightbulb.AMBIANCE && cachedColorTemperature !== undefined) {
|
57
|
+
this.states.LightbulbColorTemperature = cachedColorTemperature;
|
58
|
+
}
|
50
59
|
}
|
51
60
|
}
|
52
|
-
|
53
|
-
|
61
|
+
if (!this.isCompanionLightbulb) {
|
62
|
+
this.service = this.accessory.getService(this.platform.Service.Lightbulb) || this.accessory.addService(this.platform.Service.Lightbulb);
|
63
|
+
this.service.setCharacteristic(this.platform.Characteristic.Name, this.accessoryConfiguration.accessoryName);
|
64
|
+
}
|
65
|
+
else {
|
66
|
+
this.service = this.accessory.getService(companionLightbulbName) ||
|
67
|
+
this.accessory.addService(this.platform.Service.Lightbulb, companionLightbulbName, accessory.UUID + companionLightbulbName);
|
68
|
+
this.service.setCharacteristic(this.platform.Characteristic.Name, companionLightbulbName);
|
69
|
+
}
|
54
70
|
// Update the initial state of the accessory
|
55
|
-
this.log.debug(`[${this.
|
71
|
+
this.log.debug(`[${this.accessoryName}] Setting Lightbulb Current State: ${Lightbulb.getStateName(this.states.LightbulbState)}`);
|
56
72
|
this.service.updateCharacteristic(this.platform.Characteristic.On, (this.states.LightbulbState));
|
57
73
|
this.service.updateCharacteristic(this.platform.Characteristic.Brightness, (this.states.LightbulbBrightness));
|
58
74
|
// register handlers
|
@@ -81,31 +97,35 @@ export class Lightbulb extends Accessory {
|
|
81
97
|
async setOn(value) {
|
82
98
|
this.states.LightbulbState = value;
|
83
99
|
this.storeState();
|
84
|
-
|
100
|
+
if (this.states.LightbulbState === Lightbulb.OFF) {
|
101
|
+
this.states.LightbulbBrightness = 0;
|
102
|
+
this.service?.updateCharacteristic(this.platform.Characteristic.Brightness, (this.states.LightbulbBrightness));
|
103
|
+
}
|
104
|
+
this.log.info(`[${this.accessoryName}] Setting State: ${Lightbulb.getStateName(this.states.LightbulbState)}`);
|
85
105
|
}
|
86
106
|
async getOn() {
|
87
107
|
const lightbulbState = this.states.LightbulbState;
|
88
|
-
this.log.debug(`[${this.
|
108
|
+
this.log.debug(`[${this.accessoryName}] Getting State: ${Lightbulb.getStateName(lightbulbState)}`);
|
89
109
|
return lightbulbState;
|
90
110
|
}
|
91
111
|
async setBrightness(value) {
|
92
112
|
this.states.LightbulbBrightness = value;
|
93
113
|
this.storeState();
|
94
|
-
this.log.info(`[${this.
|
114
|
+
this.log.info(`[${this.accessoryName}] Setting Brightness: ${this.states.LightbulbBrightness}%`);
|
95
115
|
}
|
96
116
|
async getBrightness() {
|
97
117
|
const lightbulbBrightness = this.states.LightbulbBrightness;
|
98
|
-
this.log.debug(`[${this.
|
118
|
+
this.log.debug(`[${this.accessoryName}] Getting Brightness: ${lightbulbBrightness}%`);
|
99
119
|
return lightbulbBrightness;
|
100
120
|
}
|
101
121
|
async setColorTemperature(miredValue) {
|
102
122
|
this.states.LightbulbColorTemperature = this.miredToKelvin(miredValue);
|
103
123
|
this.storeState();
|
104
|
-
this.log.debug(`[${this.
|
124
|
+
this.log.debug(`[${this.accessoryName}] Setting Color Temperature: ${this.states.LightbulbColorTemperature}K (${miredValue} Mired)`);
|
105
125
|
}
|
106
126
|
async getColorTemperature() {
|
107
127
|
const miredValue = this.kelvinToMired(this.states.LightbulbColorTemperature);
|
108
|
-
this.log.debug(`[${this.
|
128
|
+
this.log.debug(`[${this.accessoryName}] Getting Color Temperature: ${this.states.LightbulbColorTemperature}K (${miredValue} Mired)`);
|
109
129
|
return miredValue;
|
110
130
|
}
|
111
131
|
getJsonState() {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"virtualAccessoryLightbulb.js","sourceRoot":"","sources":["../../src/accessories/virtualAccessoryLightbulb.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"virtualAccessoryLightbulb.js","sourceRoot":"","sources":["../../src/accessories/virtualAccessoryLightbulb.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;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AAC,EAAE,IAAI,CAAC,MAAM,CAAC,yBAAyB,EAAE,CAAC,CAAC;QACzG,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAEvC,OAAO,IAAI,CAAC;IACd,CAAC;IAES,oBAAoB;QAC5B,OAAO,SAAS,CAAC,mBAAmB,CAAC;IACvC,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,KAAc;QAChC,IAAI,SAAiB,CAAC;QAEtB,QAAQ,KAAK,EAAE,CAAC;YAChB,KAAK,SAAS,CAAC,CAAC,CAAC;gBAAC,SAAS,GAAG,WAAW,CAAC;gBAAC,MAAM;YAAC,CAAC;YACnD,KAAK,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;gBAAC,SAAS,GAAG,IAAI,CAAC;gBAAC,MAAM;YAAC,CAAC;YAC/C,KAAK,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;gBAAC,SAAS,GAAG,KAAK,CAAC;gBAAC,MAAM;YAAC,CAAC;YACjD,OAAO,CAAC,CAAC,CAAC;gBAAC,SAAS,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;YAAA,CAAC;QACzC,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,0FAA0F;IAClF,aAAa,CACnB,MAAc;QAEd,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC;IACtC,CAAC;IAEO,aAAa,CACnB,KAAa;QAEb,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;IACrC,CAAC"}
|
@@ -12,7 +12,16 @@ export declare class Switch extends Accessory {
|
|
12
12
|
private readonly timerStartTimeStorageKey;
|
13
13
|
private readonly timerDurationStorageKey;
|
14
14
|
private readonly timerIsRunningStorageKey;
|
15
|
+
private readonly timerSliderSecondsStorageKey;
|
16
|
+
private readonly timerSliderMinutesStorageKey;
|
17
|
+
private readonly timerSliderHoursStorageKey;
|
18
|
+
private readonly timerSliderDaysStorageKey;
|
15
19
|
private durationTimer?;
|
20
|
+
private timerSecondsSlider?;
|
21
|
+
private timerMinutesSlider?;
|
22
|
+
private timerHoursSlider?;
|
23
|
+
private timerDaysSlider?;
|
24
|
+
private companionSensor?;
|
16
25
|
private isCompanionSwitch;
|
17
26
|
private companionSwitchPostfix;
|
18
27
|
private states;
|
@@ -25,4 +34,10 @@ export declare class Switch extends Accessory {
|
|
25
34
|
private determineSensorState;
|
26
35
|
private convertDurationToSeconds;
|
27
36
|
static getStateName(state: boolean): string;
|
37
|
+
private setupResetTimer;
|
38
|
+
private setupCompanionSensor;
|
39
|
+
private setupResetTimerSliders;
|
40
|
+
private createSlider;
|
41
|
+
private restoreTimerSliders;
|
42
|
+
private restoreRunningTimer;
|
28
43
|
}
|