@@ -3,7 +3,7 @@ import 'package:borneo_app/features/chores/models/actions/power_action.dart';
33import 'package:borneo_app/features/chores/models/actions/chore_action.dart' ;
44import 'package:borneo_app/core/services/devices/device_manager.dart' ;
55import 'package:borneo_app/core/models/scene_entity.dart' ;
6- import 'package:borneo_kernel_abstractions/models/bound_device .dart' ;
6+ import 'package:lw_wot/thing .dart' ;
77
88import '../../../shared/models/base_entity.dart' ;
99
@@ -22,9 +22,8 @@ abstract class AbstractChore with BaseEntity {
2222 });
2323
2424 bool checkAvailable (SceneEntity scene, IDeviceManager deviceManager) {
25- final devices = deviceManager.getBoundDevicesInCurrentScene ();
26- final isAvailable = devices.any ((d) => matchAllCapabilities (d, deviceManager));
27-
25+ final things = deviceManager.wotThingsInCurrentScene;
26+ final isAvailable = things.any (matchAllCapabilities);
2827 return isAvailable;
2928 }
3029
@@ -36,22 +35,20 @@ abstract class AbstractChore with BaseEntity {
3635
3736 Future <List <Map <String , dynamic >>> execute (SceneEntity currentScene, IDeviceManager deviceManager);
3837
39- bool matchAllCapabilities (BoundDevice bound, IDeviceManager deviceManager ) {
40- return requiredCapabilities.every ((capability) => _hasCapability (bound , capability, deviceManager ));
38+ bool matchAllCapabilities (WotThing thing ) {
39+ return requiredCapabilities.every ((capability) => _hasCapability (thing , capability));
4140 }
4241
43- bool _hasCapability (BoundDevice bound, String capability, IDeviceManager deviceManager) {
44- final wotThing = deviceManager.getWotThing (bound.device.id);
45-
46- final types = wotThing.type;
42+ bool _hasCapability (WotThing thing, String capability) {
43+ final types = thing.type;
4744 if (types.contains (capability)) return true ;
4845
4946 // Check for capability-specific properties that indicate the capability
5047 switch (capability) {
5148 case "OnOffSwitch" :
52- return wotThing .hasProperty ("on" );
53- case "LyfiDevice " :
54- return wotThing .hasProperty ("state" ) && wotThing .hasProperty ("mode" );
49+ return thing .hasProperty ("on" );
50+ case "LyfiThing " :
51+ return thing .hasProperty ("state" ) && thing .hasProperty ("mode" );
5552 default :
5653 return false ;
5754 }
0 commit comments