File tree Expand file tree Collapse file tree 3 files changed +15
-16
lines changed Expand file tree Collapse file tree 3 files changed +15
-16
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,10 @@ impl GoveeApiClient {
147
147
& self ,
148
148
device : & HttpDeviceInfo ,
149
149
) -> anyhow:: Result < Vec < DeviceCapability > > {
150
+ if !device. supports_dynamic_scenes ( ) {
151
+ return Ok ( vec ! [ ] ) ;
152
+ }
153
+
150
154
let key = format ! ( "scene-list-diy-{}-{}" , device. sku, device. device) ;
151
155
cache_get (
152
156
CacheGetOptions {
@@ -181,6 +185,10 @@ impl GoveeApiClient {
181
185
& self ,
182
186
device : & HttpDeviceInfo ,
183
187
) -> anyhow:: Result < Vec < DeviceCapability > > {
188
+ if !device. supports_dynamic_scenes ( ) {
189
+ return Ok ( vec ! [ ] ) ;
190
+ }
191
+
184
192
let key = format ! ( "scene-list-{}-{}" , device. sku, device. device) ;
185
193
cache_get (
186
194
CacheGetOptions {
@@ -635,6 +643,13 @@ impl HttpDeviceInfo {
635
643
self . capability_by_instance ( "brightness" ) . is_some ( )
636
644
}
637
645
646
+ pub fn supports_dynamic_scenes ( & self ) -> bool {
647
+ self
648
+ . capabilities
649
+ . iter ( )
650
+ . any ( |cap| cap. kind == DeviceCapabilityKind :: DynamicScene )
651
+ }
652
+
638
653
/// If supported, returns the number of segments
639
654
pub fn supports_segmented_rgb ( & self ) -> Option < std:: ops:: Range < u32 > > {
640
655
let cap = self . capability_by_instance ( "segmentedColorRgb" ) ?;
Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ pub struct Quirk {
14
14
pub ble_only : bool ,
15
15
pub lan_api_capable : bool ,
16
16
pub device_type : DeviceType ,
17
- pub supports_scenes : Option < bool > ,
18
17
}
19
18
20
19
impl Quirk {
@@ -29,7 +28,6 @@ impl Quirk {
29
28
icon : icon. into ( ) ,
30
29
lan_api_capable : false ,
31
30
device_type : DeviceType :: Light ,
32
- supports_scenes : None ,
33
31
}
34
32
}
35
33
@@ -44,15 +42,9 @@ impl Quirk {
44
42
icon : "mdi:air-humidifier" . into ( ) ,
45
43
lan_api_capable : false ,
46
44
device_type : DeviceType :: Humidifier ,
47
- supports_scenes : None ,
48
45
}
49
46
}
50
47
51
- pub fn with_scenes ( mut self , supports_scenes : Option < bool > ) -> Self {
52
- self . supports_scenes = supports_scenes;
53
- self
54
- }
55
-
56
48
pub fn with_rgb ( mut self ) -> Self {
57
49
self . supports_rgb = true ;
58
50
self
@@ -119,7 +111,6 @@ fn load_quirks() -> HashMap<String, Quirk> {
119
111
Quirk :: humidifier ( "H7160" )
120
112
. with_broken_platform ( )
121
113
. with_rgb ( )
122
- . with_scenes ( Some ( false ) )
123
114
. with_brightness ( ) ,
124
115
// Lights from the list of LAN API enabled devices
125
116
// at <https://app-h5.govee.com/user-manual/wlan-guide>
Original file line number Diff line number Diff line change @@ -488,13 +488,6 @@ impl State {
488
488
489
489
pub async fn device_list_scenes ( & self , device : & Device ) -> anyhow:: Result < Vec < String > > {
490
490
// TODO: some plumbing to maintain offline scene controls for preferred-LAN control
491
-
492
- if let Some ( quirk) = device. resolve_quirk ( ) {
493
- if quirk. supports_scenes == Some ( false ) {
494
- return Ok ( vec ! [ ] ) ;
495
- }
496
- }
497
-
498
491
if let Some ( client) = self . get_platform_client ( ) . await {
499
492
if let Some ( info) = & device. http_device_info {
500
493
return Ok ( sort_and_dedup_scenes ( client. list_scene_names ( info) . await ?) ) ;
You can’t perform that action at this time.
0 commit comments