@jay-d-tyler/homebridge-somfy-protect-automate 1.0.0
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/LICENSE +190 -0
- package/README.md +210 -0
- package/config.schema.json +38 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +113 -0
- package/dist/index.js.map +1 -0
- package/package.json +64 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Support. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 Jay Tyler
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# Homebridge Somfy Protect Automate
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/%40jay-d-tyler%2Fhomebridge-somfy-protect-automate)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
6
|
+
A Homebridge plugin that provides a stateless switch to disarm Somfy Protect alarms via HomeKit automations.
|
|
7
|
+
|
|
8
|
+
## Why This Plugin?
|
|
9
|
+
|
|
10
|
+
HomeKit has a built-in security restriction that prevents automations from directly disarming security alarms. This is a safety feature to prevent unauthorized access. However, other accessories (like switches) can still control the alarm programmatically.
|
|
11
|
+
|
|
12
|
+
This plugin creates a workaround by providing a **stateless switch** that, when activated, automatically disarms your Somfy Protect alarm. You can then use this switch in HomeKit automations, effectively giving you the ability to automate alarm disarming.
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
- 🔘 **Stateless Switch**: Acts like a button that automatically resets after use
|
|
17
|
+
- 🔍 **Auto-Detection**: Automatically finds your Somfy Protect alarm accessory
|
|
18
|
+
- 🔒 **One-Way Operation**: Only disarms (prevents accidental arming via automation)
|
|
19
|
+
- ⚡ **Instant Response**: Triggers immediately when activated
|
|
20
|
+
- 🎯 **Simple Setup**: Minimal configuration required
|
|
21
|
+
|
|
22
|
+
## Prerequisites
|
|
23
|
+
|
|
24
|
+
This plugin requires the main Somfy Protect plugin to be installed and configured:
|
|
25
|
+
|
|
26
|
+
- [@jay-d-tyler/homebridge-somfy-protect](https://github.com/jay-d-tyler/homebridge-somfy-protect)
|
|
27
|
+
|
|
28
|
+
Make sure your Somfy Protect alarm is working in HomeKit before installing this automation helper.
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
### Option 1: Homebridge Config UI X (Recommended)
|
|
33
|
+
|
|
34
|
+
1. Search for `@jay-d-tyler/homebridge-somfy-protect-automate` in the Homebridge Config UI X plugin search
|
|
35
|
+
2. Click **Install**
|
|
36
|
+
3. Configure the plugin (see Configuration section below)
|
|
37
|
+
4. Restart Homebridge
|
|
38
|
+
|
|
39
|
+
### Option 2: Manual Installation
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install -g @jay-d-tyler/homebridge-somfy-protect-automate
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Then add the platform to your `config.json` (see Configuration section below).
|
|
46
|
+
|
|
47
|
+
## Configuration
|
|
48
|
+
|
|
49
|
+
Add this platform to your Homebridge `config.json`:
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"platforms": [
|
|
54
|
+
{
|
|
55
|
+
"platform": "SomfyProtectAutomate",
|
|
56
|
+
"name": "Somfy Protect Automate",
|
|
57
|
+
"buttonLabel": "Disarm Somfy"
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Configuration Options
|
|
64
|
+
|
|
65
|
+
| Option | Type | Required | Default | Description |
|
|
66
|
+
|--------|------|----------|---------|-------------|
|
|
67
|
+
| `platform` | string | Yes | `SomfyProtectAutomate` | Must be `SomfyProtectAutomate` |
|
|
68
|
+
| `name` | string | Yes | `Somfy Protect Automate` | The name that appears in Homebridge logs |
|
|
69
|
+
| `buttonLabel` | string | No | `Disarm Somfy` | The name of the switch in the Home app |
|
|
70
|
+
|
|
71
|
+
## Usage
|
|
72
|
+
|
|
73
|
+
### Setting Up HomeKit Automations
|
|
74
|
+
|
|
75
|
+
1. **Add the Switch to HomeKit**
|
|
76
|
+
- After restarting Homebridge, the switch will appear in your Home app
|
|
77
|
+
- It will be named according to your `buttonLabel` configuration
|
|
78
|
+
|
|
79
|
+
2. **Create an Automation**
|
|
80
|
+
- Open the Home app
|
|
81
|
+
- Go to the Automation tab
|
|
82
|
+
- Create a new automation (e.g., "When I arrive home")
|
|
83
|
+
- Add action: Turn on the "Disarm Somfy" switch
|
|
84
|
+
- The alarm will disarm automatically when the automation runs
|
|
85
|
+
|
|
86
|
+
3. **Example Automations**
|
|
87
|
+
- **Arrive Home**: Disarm when you arrive home
|
|
88
|
+
- **Wake Up**: Disarm at a specific time in the morning
|
|
89
|
+
- **Scene-Based**: Disarm when you activate a "Good Morning" scene
|
|
90
|
+
- **Geofencing**: Disarm when family members arrive
|
|
91
|
+
|
|
92
|
+
### How It Works
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
HomeKit Automation → Turns on Switch → Plugin Detects Switch On →
|
|
96
|
+
Plugin Finds Somfy Alarm → Plugin Sends Disarm Command →
|
|
97
|
+
Switch Resets to Off (stateless)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The switch automatically resets to the "off" state after 1 second, making it act like a momentary button rather than a persistent switch.
|
|
101
|
+
|
|
102
|
+
## Troubleshooting
|
|
103
|
+
|
|
104
|
+
### The switch doesn't disarm the alarm
|
|
105
|
+
|
|
106
|
+
1. **Check that Somfy Protect is working**:
|
|
107
|
+
- Open the Home app
|
|
108
|
+
- Try manually disarming the alarm using the main Somfy Protect accessory
|
|
109
|
+
- If this doesn't work, the issue is with the main Somfy plugin
|
|
110
|
+
|
|
111
|
+
2. **Check Homebridge logs**:
|
|
112
|
+
```bash
|
|
113
|
+
tail -f ~/.homebridge/homebridge.log
|
|
114
|
+
```
|
|
115
|
+
Look for messages starting with `[Somfy Protect Automate]`
|
|
116
|
+
|
|
117
|
+
3. **Verify the alarm is detected**:
|
|
118
|
+
- Look for log message: `Found Somfy Protect security system: [name]`
|
|
119
|
+
- If you don't see this, the plugin cannot find your alarm
|
|
120
|
+
|
|
121
|
+
### The switch doesn't appear in HomeKit
|
|
122
|
+
|
|
123
|
+
1. Remove the accessory from HomeKit and re-add it
|
|
124
|
+
2. Restart Homebridge
|
|
125
|
+
3. Check that the platform is correctly configured in `config.json`
|
|
126
|
+
|
|
127
|
+
### The alarm name doesn't contain "Somfy" or "Protect"
|
|
128
|
+
|
|
129
|
+
The plugin looks for accessories with these keywords. If your alarm has a different name, you may need to modify the detection logic. Open a GitHub issue with your alarm's name.
|
|
130
|
+
|
|
131
|
+
## Advanced Usage
|
|
132
|
+
|
|
133
|
+
### Multiple Alarms
|
|
134
|
+
|
|
135
|
+
Currently, the plugin will disarm the **first** Somfy Protect alarm it finds. If you have multiple alarms and need to control them separately, you'll need to:
|
|
136
|
+
|
|
137
|
+
1. Create multiple instances of this plugin with different names
|
|
138
|
+
2. Modify the code to target specific alarms (custom development)
|
|
139
|
+
|
|
140
|
+
Open a GitHub issue if you need this feature!
|
|
141
|
+
|
|
142
|
+
## Development
|
|
143
|
+
|
|
144
|
+
### Building from Source
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Clone the repository
|
|
148
|
+
git clone https://github.com/jay-d-tyler/homebridge-somfy-protect-automate.git
|
|
149
|
+
cd homebridge-somfy-protect-automate
|
|
150
|
+
|
|
151
|
+
# Install dependencies
|
|
152
|
+
npm install
|
|
153
|
+
|
|
154
|
+
# Build
|
|
155
|
+
npm run build
|
|
156
|
+
|
|
157
|
+
# Link for local development
|
|
158
|
+
npm link
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Project Structure
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
homebridge-somfy-protect-automate/
|
|
165
|
+
├── src/
|
|
166
|
+
│ └── index.ts # Main plugin code
|
|
167
|
+
├── config.schema.json # Homebridge UI configuration schema
|
|
168
|
+
├── package.json
|
|
169
|
+
├── tsconfig.json
|
|
170
|
+
└── README.md
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Contributing
|
|
174
|
+
|
|
175
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
176
|
+
|
|
177
|
+
1. Fork the repository
|
|
178
|
+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
|
|
179
|
+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
|
180
|
+
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
|
181
|
+
5. Open a Pull Request
|
|
182
|
+
|
|
183
|
+
## License
|
|
184
|
+
|
|
185
|
+
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
|
|
186
|
+
|
|
187
|
+
## Related Projects
|
|
188
|
+
|
|
189
|
+
- [@jay-d-tyler/homebridge-somfy-protect](https://github.com/jay-d-tyler/homebridge-somfy-protect) - The main Somfy Protect plugin
|
|
190
|
+
|
|
191
|
+
## Author
|
|
192
|
+
|
|
193
|
+
**Jay Tyler**
|
|
194
|
+
|
|
195
|
+
## Acknowledgments
|
|
196
|
+
|
|
197
|
+
- Thanks to the Homebridge community for the excellent platform
|
|
198
|
+
- Thanks to Somfy for their API documentation
|
|
199
|
+
|
|
200
|
+
## Changelog
|
|
201
|
+
|
|
202
|
+
### 1.0.0
|
|
203
|
+
- Initial release
|
|
204
|
+
- Stateless switch for disarming Somfy Protect alarms
|
|
205
|
+
- Auto-detection of Somfy accessories
|
|
206
|
+
- Basic configuration options
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
**Note**: This plugin is not officially associated with Somfy. It is an independent project created to enhance HomeKit automation capabilities.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"pluginAlias": "SomfyProtectAutomate",
|
|
3
|
+
"pluginType": "platform",
|
|
4
|
+
"singular": false,
|
|
5
|
+
"schema": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"title": "Name",
|
|
10
|
+
"type": "string",
|
|
11
|
+
"default": "Somfy Protect Automate",
|
|
12
|
+
"required": true,
|
|
13
|
+
"description": "The name that will appear in your Homebridge log."
|
|
14
|
+
},
|
|
15
|
+
"buttonLabel": {
|
|
16
|
+
"title": "Button Label",
|
|
17
|
+
"type": "string",
|
|
18
|
+
"default": "Disarm Somfy",
|
|
19
|
+
"required": false,
|
|
20
|
+
"description": "The name of the switch that will appear in HomeKit."
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"layout": [
|
|
25
|
+
{
|
|
26
|
+
"type": "fieldset",
|
|
27
|
+
"title": "Plugin Settings",
|
|
28
|
+
"expandable": false,
|
|
29
|
+
"items": [
|
|
30
|
+
"name",
|
|
31
|
+
{
|
|
32
|
+
"key": "buttonLabel",
|
|
33
|
+
"description": "This is the name that will appear in the Home app. You can use this switch in automations to disarm your Somfy Protect alarm."
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,EAQJ,MAAM,YAAY,CAAC;yBAUV,KAAK,GAAG;AAAlB,kBAEE"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const PLUGIN_NAME = '@jay-d-tyler/homebridge-somfy-protect-automate';
|
|
3
|
+
const PLATFORM_NAME = 'SomfyProtectAutomate';
|
|
4
|
+
class SomfyProtectAutomatePlatform {
|
|
5
|
+
log;
|
|
6
|
+
config;
|
|
7
|
+
api;
|
|
8
|
+
Service;
|
|
9
|
+
Characteristic;
|
|
10
|
+
accessories = [];
|
|
11
|
+
constructor(log, config, api) {
|
|
12
|
+
this.log = log;
|
|
13
|
+
this.config = config;
|
|
14
|
+
this.api = api;
|
|
15
|
+
this.Service = this.api.hap.Service;
|
|
16
|
+
this.Characteristic = this.api.hap.Characteristic;
|
|
17
|
+
this.log.debug('Finished initializing platform:', this.config.name);
|
|
18
|
+
this.api.on('didFinishLaunching', () => {
|
|
19
|
+
this.log.debug('Executed didFinishLaunching callback');
|
|
20
|
+
this.discoverDevices();
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
configureAccessory(accessory) {
|
|
24
|
+
this.log.info('Loading accessory from cache:', accessory.displayName);
|
|
25
|
+
this.accessories.push(accessory);
|
|
26
|
+
}
|
|
27
|
+
discoverDevices() {
|
|
28
|
+
const buttonLabel = this.config.buttonLabel || 'Disarm Somfy';
|
|
29
|
+
const uuid = this.api.hap.uuid.generate(buttonLabel);
|
|
30
|
+
const existingAccessory = this.accessories.find(accessory => accessory.UUID === uuid);
|
|
31
|
+
if (existingAccessory) {
|
|
32
|
+
this.log.info('Restoring existing accessory from cache:', existingAccessory.displayName);
|
|
33
|
+
new SomfyDisarmSwitch(this, existingAccessory);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this.log.info('Adding new accessory:', buttonLabel);
|
|
37
|
+
const accessory = new this.api.platformAccessory(buttonLabel, uuid);
|
|
38
|
+
new SomfyDisarmSwitch(this, accessory);
|
|
39
|
+
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
class SomfyDisarmSwitch {
|
|
44
|
+
platform;
|
|
45
|
+
accessory;
|
|
46
|
+
service;
|
|
47
|
+
switchState = false;
|
|
48
|
+
constructor(platform, accessory) {
|
|
49
|
+
this.platform = platform;
|
|
50
|
+
this.accessory = accessory;
|
|
51
|
+
this.accessory.getService(this.platform.Service.AccessoryInformation)
|
|
52
|
+
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'Jay Tyler')
|
|
53
|
+
.setCharacteristic(this.platform.Characteristic.Model, 'Somfy Disarm Switch')
|
|
54
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, 'SDS-001');
|
|
55
|
+
this.service = this.accessory.getService(this.platform.Service.Switch)
|
|
56
|
+
|| this.accessory.addService(this.platform.Service.Switch);
|
|
57
|
+
this.service.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
58
|
+
this.service.getCharacteristic(this.platform.Characteristic.On)
|
|
59
|
+
.onSet(this.setOn.bind(this))
|
|
60
|
+
.onGet(this.getOn.bind(this));
|
|
61
|
+
}
|
|
62
|
+
async setOn(value) {
|
|
63
|
+
const isOn = value;
|
|
64
|
+
this.platform.log.debug('Set Characteristic On ->', isOn);
|
|
65
|
+
if (isOn) {
|
|
66
|
+
await this.disarmSomfyAlarm();
|
|
67
|
+
setTimeout(() => {
|
|
68
|
+
this.switchState = false;
|
|
69
|
+
this.service.updateCharacteristic(this.platform.Characteristic.On, false);
|
|
70
|
+
this.platform.log.debug('Switch reset to OFF (stateless)');
|
|
71
|
+
}, 1000);
|
|
72
|
+
}
|
|
73
|
+
this.switchState = isOn;
|
|
74
|
+
}
|
|
75
|
+
getOn() {
|
|
76
|
+
return this.switchState;
|
|
77
|
+
}
|
|
78
|
+
async disarmSomfyAlarm() {
|
|
79
|
+
try {
|
|
80
|
+
this.platform.log.info('Attempting to disarm Somfy Protect alarm...');
|
|
81
|
+
const allAccessories = this.platform.api.platformAccessories || [];
|
|
82
|
+
this.platform.log.debug(`Searching through ${allAccessories.length} accessories...`);
|
|
83
|
+
for (const accessory of allAccessories) {
|
|
84
|
+
const context = accessory.context;
|
|
85
|
+
const isSomfyProtect = accessory.displayName.toLowerCase().includes('somfy') ||
|
|
86
|
+
accessory.displayName.toLowerCase().includes('protect') ||
|
|
87
|
+
(context && context.manufacturer === 'Somfy');
|
|
88
|
+
if (isSomfyProtect) {
|
|
89
|
+
this.platform.log.debug(`Found potential Somfy accessory: ${accessory.displayName}`);
|
|
90
|
+
const securityService = accessory.getService(this.platform.Service.SecuritySystem);
|
|
91
|
+
if (securityService) {
|
|
92
|
+
this.platform.log.info(`Found Somfy Protect security system: ${accessory.displayName}`);
|
|
93
|
+
const targetStateChar = securityService.getCharacteristic(this.platform.Characteristic.SecuritySystemTargetState);
|
|
94
|
+
if (targetStateChar) {
|
|
95
|
+
const DISARM = this.platform.Characteristic.SecuritySystemTargetState.DISARM;
|
|
96
|
+
await targetStateChar.setValue(DISARM);
|
|
97
|
+
this.platform.log.info(`Successfully sent DISARM command to ${accessory.displayName}`);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
this.platform.log.warn('No Somfy Protect security system found. Make sure @jay-d-tyler/homebridge-somfy-protect is installed and configured.');
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
this.platform.log.error('Error disarming Somfy alarm:', error);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
module.exports = (api) => {
|
|
111
|
+
api.registerPlatform(PLATFORM_NAME, SomfyProtectAutomatePlatform);
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAWA,MAAM,WAAW,GAAG,gDAAgD,CAAC;AACrE,MAAM,aAAa,GAAG,sBAAsB,CAAC;AAW7C,MAAM,4BAA4B;IAMd;IACA;IACA;IAPF,OAAO,CAAiB;IACxB,cAAc,CAAwB;IACtC,WAAW,GAAwB,EAAE,CAAC;IAEtD,YACkB,GAAW,EACX,MAA0C,EAC1C,GAAQ;QAFR,QAAG,GAAH,GAAG,CAAQ;QACX,WAAM,GAAN,MAAM,CAAoC;QAC1C,QAAG,GAAH,GAAG,CAAK;QAExB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC;QACpC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC;QAClD,IAAI,CAAC,GAAG,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AC,CAAC;AACpE,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jay-d-tyler/homebridge-somfy-protect-automate",
|
|
3
|
+
"displayName": "Homebridge Somfy Protect Automate",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"private": false,
|
|
6
|
+
"description": "A Homebridge plugin that provides a stateless switch to disarm Somfy Protect alarms via automations",
|
|
7
|
+
"author": "Jay Tyler",
|
|
8
|
+
"license": "Apache-2.0",
|
|
9
|
+
"homepage": "https://github.com/jay-d-tyler/homebridge-somfy-protect-automate#readme",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/jay-d-tyler/homebridge-somfy-protect-automate.git"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/jay-d-tyler/homebridge-somfy-protect-automate/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"homebridge-plugin",
|
|
19
|
+
"somfy",
|
|
20
|
+
"somfy protect",
|
|
21
|
+
"security",
|
|
22
|
+
"alarm",
|
|
23
|
+
"automation",
|
|
24
|
+
"homekit"
|
|
25
|
+
],
|
|
26
|
+
"main": "dist/index.js",
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"config.schema.json",
|
|
30
|
+
"LICENSE",
|
|
31
|
+
"README.md"
|
|
32
|
+
],
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": "^20.18.0 || ^22.10.0 || ^24.0.0",
|
|
35
|
+
"homebridge": "^1.8.0 || ^2.0.0-beta.0"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "rimraf ./dist && tsc",
|
|
39
|
+
"lint": "eslint . --max-warnings=0",
|
|
40
|
+
"test": "jest",
|
|
41
|
+
"test:watch": "jest --watch",
|
|
42
|
+
"test:coverage": "jest --coverage",
|
|
43
|
+
"verify-build": "test -d dist && test -f dist/index.js || (echo 'ERROR: dist folder not built! Run npm run build first.' && exit 1)",
|
|
44
|
+
"prepublishOnly": "npm run lint && npm run build && npm run verify-build",
|
|
45
|
+
"watch": "npm run build && npm link && nodemon"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@eslint/js": "^9.39.1",
|
|
49
|
+
"@types/jest": "^29.5.14",
|
|
50
|
+
"@types/node": "^24.10.1",
|
|
51
|
+
"eslint": "^9.39.1",
|
|
52
|
+
"homebridge": "^2.0.0-beta.55",
|
|
53
|
+
"jest": "^29.7.0",
|
|
54
|
+
"nodemon": "^3.1.11",
|
|
55
|
+
"rimraf": "^6.1.0",
|
|
56
|
+
"ts-jest": "^29.4.6",
|
|
57
|
+
"ts-node": "^10.9.2",
|
|
58
|
+
"typescript": "^5.9.3",
|
|
59
|
+
"typescript-eslint": "^8.46.4"
|
|
60
|
+
},
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"homebridge": "^1.6.0"
|
|
63
|
+
}
|
|
64
|
+
}
|