File tree Expand file tree Collapse file tree 4 files changed +37
-1
lines changed Expand file tree Collapse file tree 4 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ export enum RingDeviceType {
14
14
CoAlarm = 'alarm.co' ,
15
15
SmokeCoListener = 'listener.smoke-co' ,
16
16
MultiLevelSwitch = 'switch.multilevel' ,
17
+ MultiLevelBulb = 'switch.multilevel.bulb' ,
18
+ Switch = 'switch' ,
17
19
BeamsMotionSensor = 'motion-sensor.beams' ,
18
20
BeamsSwitch = 'switch.multilevel.beams' ,
19
21
BeamsLightGroupSwitch = 'group.light-group.beams' ,
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ HomeKit with a snapshot from the camera
129
129
* Smart Locks
130
130
* Lights/Switches
131
131
* On/Off
132
- * Brightness Level
132
+ * Brightness Level (if applicable)
133
133
* Hue/Sat/Color Temp are _ possible_ , but currently not supported.
134
134
Please open an issue if you have a device that you would be able to
135
135
test these on.
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import { SmokeCoListener } from './smoke-co-listener'
12
12
import { RingPlatformConfig } from './config'
13
13
import { Beam } from './beam'
14
14
import { MultiLevelSwitch } from './multi-level-switch'
15
+ import { Switch } from './switch'
15
16
import { Camera } from './camera'
16
17
import { RingAuth } from '../api/rest-client'
17
18
import { platformName , pluginName } from './plugin-info'
@@ -46,7 +47,10 @@ function getAccessoryClass(device: RingDevice | RingCamera) {
46
47
case RingDeviceType . BeamsLightGroupSwitch :
47
48
return Beam
48
49
case RingDeviceType . MultiLevelSwitch :
50
+ case RingDeviceType . MultiLevelBulb :
49
51
return MultiLevelSwitch
52
+ case RingDeviceType . Switch :
53
+ return Switch
50
54
}
51
55
52
56
if ( / ^ l o c k ( $ | \. ) / . test ( deviceType ) ) {
Original file line number Diff line number Diff line change
1
+ import { BaseDeviceAccessory } from './base-device-accessory'
2
+ import { RingDevice } from '../api'
3
+ import { HAP , hap } from './hap'
4
+ import { RingPlatformConfig } from './config'
5
+
6
+ export class Switch extends BaseDeviceAccessory {
7
+ constructor (
8
+ public readonly device : RingDevice ,
9
+ public readonly accessory : HAP . Accessory ,
10
+ public readonly logger : HAP . Log ,
11
+ public readonly config : RingPlatformConfig
12
+ ) {
13
+ super ( )
14
+
15
+ const { Characteristic, Service } = hap
16
+
17
+ this . registerCharacteristic (
18
+ Characteristic . On ,
19
+ Service . On ,
20
+ data => Boolean ( data . on ) ,
21
+ value => this . setOnState ( value )
22
+ )
23
+ }
24
+
25
+ setOnState ( on : boolean ) {
26
+ this . logger . info ( `Turning ${ this . device . name } ${ on ? 'On' : 'Off' } ` )
27
+
28
+ return this . device . setInfo ( { device : { v1 : { on } } } )
29
+ }
30
+ }
You can’t perform that action at this time.
0 commit comments