State const

This commit is contained in:
Yegor Vialov
2018-11-14 15:14:46 +02:00
parent 3190b45db3
commit 87f89b63e1
15 changed files with 116 additions and 42 deletions

View File

@ -40,8 +40,8 @@ class CoverEntity extends Entity {
double get currentPosition => _getDoubleAttributeValue('current_position');
double get currentTiltPosition => _getDoubleAttributeValue('current_tilt_position');
bool get canBeOpened => ((state != "opening") && (state != "open")) || (state == "open" && currentPosition != null && currentPosition > 0.0 && currentPosition < 100.0);
bool get canBeClosed => ((state != "closing") && (state != "closed"));
bool get canBeOpened => ((state != EntityState.opening) && (state != EntityState.open)) || (state == EntityState.open && currentPosition != null && currentPosition > 0.0 && currentPosition < 100.0);
bool get canBeClosed => ((state != EntityState.closing) && (state != EntityState.closed));
bool get canTiltBeOpened => currentTiltPosition < 100;
bool get canTiltBeClosed => currentTiltPosition > 0;