Resloves #133 Light support

This commit is contained in:
Yegor Vialov
2018-10-18 23:47:55 +03:00
parent c71ee568b0
commit ba09c36bd2
4 changed files with 47 additions and 34 deletions

View File

@ -518,9 +518,7 @@ class LightEntity extends Entity {
double get minMireds => _getDoubleAttributeValue("min_mireds");
Color get color => _getColor();
bool get isAdditionalControls => ((attributes["supported_features"] != null) && (attributes["supported_features"] != 0));
List<String> get effectList => attributes["effect_list"] != null
? (attributes["effect_list"] as List).cast<String>()
: null;
List<String> get effectList => _getEffectList();
LightEntity(Map rawData) : super(rawData);
@ -537,6 +535,15 @@ class LightEntity extends Entity {
}
}
List<String> _getEffectList() {
if (attributes["effect_list"] != null) {
List<String> result = (attributes["effect_list"] as List).cast<String>();
return result;
} else {
return null;
}
}
@override
Widget _buildStatePart(BuildContext context) {
return SwitchStateWidget();