diff --git a/lib/entity_class/camera_entity.class.dart b/lib/entity_class/camera_entity.class.dart index 3c310d8..bb9ffd5 100644 --- a/lib/entity_class/camera_entity.class.dart +++ b/lib/entity_class/camera_entity.class.dart @@ -6,7 +6,7 @@ class CameraEntity extends Entity { CameraEntity(Map rawData) : super(rawData); - bool get supportOnOff => ((attributes["supported_features"] & + bool get supportOnOff => ((supportedFeatures & CameraEntity.SUPPORT_ON_OFF) == CameraEntity.SUPPORT_ON_OFF); diff --git a/lib/entity_class/climate_entity.class.dart b/lib/entity_class/climate_entity.class.dart index 6766853..b25e42f 100644 --- a/lib/entity_class/climate_entity.class.dart +++ b/lib/entity_class/climate_entity.class.dart @@ -23,44 +23,44 @@ class ClimateEntity extends Entity { static const SUPPORT_AUX_HEAT = 2048; static const SUPPORT_ON_OFF = 4096; - bool get supportTargetTemperature => ((attributes["supported_features"] & + bool get supportTargetTemperature => ((supportedFeatures & ClimateEntity.SUPPORT_TARGET_TEMPERATURE) == ClimateEntity.SUPPORT_TARGET_TEMPERATURE); - bool get supportTargetTemperatureHigh => ((attributes["supported_features"] & + bool get supportTargetTemperatureHigh => ((supportedFeatures & ClimateEntity.SUPPORT_TARGET_TEMPERATURE_HIGH) == ClimateEntity.SUPPORT_TARGET_TEMPERATURE_HIGH); - bool get supportTargetTemperatureLow => ((attributes["supported_features"] & + bool get supportTargetTemperatureLow => ((supportedFeatures & ClimateEntity.SUPPORT_TARGET_TEMPERATURE_LOW) == ClimateEntity.SUPPORT_TARGET_TEMPERATURE_LOW); - bool get supportTargetHumidity => ((attributes["supported_features"] & + bool get supportTargetHumidity => ((supportedFeatures & ClimateEntity.SUPPORT_TARGET_HUMIDITY) == ClimateEntity.SUPPORT_TARGET_HUMIDITY); - bool get supportTargetHumidityHigh => ((attributes["supported_features"] & + bool get supportTargetHumidityHigh => ((supportedFeatures & ClimateEntity.SUPPORT_TARGET_HUMIDITY_HIGH) == ClimateEntity.SUPPORT_TARGET_HUMIDITY_HIGH); - bool get supportTargetHumidityLow => ((attributes["supported_features"] & + bool get supportTargetHumidityLow => ((supportedFeatures & ClimateEntity.SUPPORT_TARGET_HUMIDITY_LOW) == ClimateEntity.SUPPORT_TARGET_HUMIDITY_LOW); bool get supportFanMode => - ((attributes["supported_features"] & ClimateEntity.SUPPORT_FAN_MODE) == + ((supportedFeatures & ClimateEntity.SUPPORT_FAN_MODE) == ClimateEntity.SUPPORT_FAN_MODE); - bool get supportOperationMode => ((attributes["supported_features"] & + bool get supportOperationMode => ((supportedFeatures & ClimateEntity.SUPPORT_OPERATION_MODE) == ClimateEntity.SUPPORT_OPERATION_MODE); bool get supportHoldMode => - ((attributes["supported_features"] & ClimateEntity.SUPPORT_HOLD_MODE) == + ((supportedFeatures & ClimateEntity.SUPPORT_HOLD_MODE) == ClimateEntity.SUPPORT_HOLD_MODE); bool get supportSwingMode => - ((attributes["supported_features"] & ClimateEntity.SUPPORT_SWING_MODE) == + ((supportedFeatures & ClimateEntity.SUPPORT_SWING_MODE) == ClimateEntity.SUPPORT_SWING_MODE); bool get supportAwayMode => - ((attributes["supported_features"] & ClimateEntity.SUPPORT_AWAY_MODE) == + ((supportedFeatures & ClimateEntity.SUPPORT_AWAY_MODE) == ClimateEntity.SUPPORT_AWAY_MODE); bool get supportAuxHeat => - ((attributes["supported_features"] & ClimateEntity.SUPPORT_AUX_HEAT) == + ((supportedFeatures & ClimateEntity.SUPPORT_AUX_HEAT) == ClimateEntity.SUPPORT_AUX_HEAT); bool get supportOnOff => - ((attributes["supported_features"] & ClimateEntity.SUPPORT_ON_OFF) == + ((supportedFeatures & ClimateEntity.SUPPORT_ON_OFF) == ClimateEntity.SUPPORT_ON_OFF); List get operationList => attributes["operation_list"] != null diff --git a/lib/entity_class/cover_entity.class.dart b/lib/entity_class/cover_entity.class.dart index 6b6b544..3d31e68 100644 --- a/lib/entity_class/cover_entity.class.dart +++ b/lib/entity_class/cover_entity.class.dart @@ -11,29 +11,29 @@ class CoverEntity extends Entity { static const SUPPORT_STOP_TILT = 64; static const SUPPORT_SET_TILT_POSITION = 128; - bool get supportOpen => ((attributes["supported_features"] & + bool get supportOpen => ((supportedFeatures & CoverEntity.SUPPORT_OPEN) == CoverEntity.SUPPORT_OPEN); - bool get supportClose => ((attributes["supported_features"] & + bool get supportClose => ((supportedFeatures & CoverEntity.SUPPORT_CLOSE) == CoverEntity.SUPPORT_CLOSE); - bool get supportSetPosition => ((attributes["supported_features"] & + bool get supportSetPosition => ((supportedFeatures & CoverEntity.SUPPORT_SET_POSITION) == CoverEntity.SUPPORT_SET_POSITION); - bool get supportStop => ((attributes["supported_features"] & + bool get supportStop => ((supportedFeatures & CoverEntity.SUPPORT_STOP) == CoverEntity.SUPPORT_STOP); - bool get supportOpenTilt => ((attributes["supported_features"] & + bool get supportOpenTilt => ((supportedFeatures & CoverEntity.SUPPORT_OPEN_TILT) == CoverEntity.SUPPORT_OPEN_TILT); - bool get supportCloseTilt => ((attributes["supported_features"] & + bool get supportCloseTilt => ((supportedFeatures & CoverEntity.SUPPORT_CLOSE_TILT) == CoverEntity.SUPPORT_CLOSE_TILT); - bool get supportStopTilt => ((attributes["supported_features"] & + bool get supportStopTilt => ((supportedFeatures & CoverEntity.SUPPORT_STOP_TILT) == CoverEntity.SUPPORT_STOP_TILT); - bool get supportSetTiltPosition => ((attributes["supported_features"] & + bool get supportSetTiltPosition => ((supportedFeatures & CoverEntity.SUPPORT_SET_TILT_POSITION) == CoverEntity.SUPPORT_SET_TILT_POSITION); diff --git a/lib/entity_class/entity.class.dart b/lib/entity_class/entity.class.dart index 9f070a0..eb89590 100644 --- a/lib/entity_class/entity.class.dart +++ b/lib/entity_class/entity.class.dart @@ -91,6 +91,7 @@ class Entity { String get lastUpdated => _getLastUpdatedFormatted(); bool get isHidden => attributes["hidden"] ?? false; double get doubleState => double.tryParse(state) ?? 0.0; + int get supportedFeatures => attributes["supported_features"] ?? 0; Entity(Map rawData) { update(rawData); diff --git a/lib/entity_class/fan_entity.class.dart b/lib/entity_class/fan_entity.class.dart index e10a5ad..601b7c0 100644 --- a/lib/entity_class/fan_entity.class.dart +++ b/lib/entity_class/fan_entity.class.dart @@ -8,13 +8,13 @@ class FanEntity extends Entity { FanEntity(Map rawData) : super(rawData); - bool get supportSetSpeed => ((attributes["supported_features"] & + bool get supportSetSpeed => ((supportedFeatures & FanEntity.SUPPORT_SET_SPEED) == FanEntity.SUPPORT_SET_SPEED); - bool get supportOscillate => ((attributes["supported_features"] & + bool get supportOscillate => ((supportedFeatures & FanEntity.SUPPORT_OSCILLATE) == FanEntity.SUPPORT_OSCILLATE); - bool get supportDirection => ((attributes["supported_features"] & + bool get supportDirection => ((supportedFeatures & FanEntity.SUPPORT_DIRECTION) == FanEntity.SUPPORT_DIRECTION); diff --git a/lib/entity_class/light_entity.class.dart b/lib/entity_class/light_entity.class.dart index 210f0d7..730279e 100644 --- a/lib/entity_class/light_entity.class.dart +++ b/lib/entity_class/light_entity.class.dart @@ -10,25 +10,25 @@ class LightEntity extends Entity { static const SUPPORT_TRANSITION = 32; static const SUPPORT_WHITE_VALUE = 128; - bool get supportBrightness => ((attributes["supported_features"] & + bool get supportBrightness => ((supportedFeatures & LightEntity.SUPPORT_BRIGHTNESS) == LightEntity.SUPPORT_BRIGHTNESS); - bool get supportColorTemp => ((attributes["supported_features"] & + bool get supportColorTemp => ((supportedFeatures & LightEntity.SUPPORT_COLOR_TEMP) == LightEntity.SUPPORT_COLOR_TEMP); - bool get supportEffect => ((attributes["supported_features"] & + bool get supportEffect => ((supportedFeatures & LightEntity.SUPPORT_EFFECT) == LightEntity.SUPPORT_EFFECT); - bool get supportFlash => ((attributes["supported_features"] & + bool get supportFlash => ((supportedFeatures & LightEntity.SUPPORT_FLASH) == LightEntity.SUPPORT_FLASH); - bool get supportColor => ((attributes["supported_features"] & + bool get supportColor => ((supportedFeatures & LightEntity.SUPPORT_COLOR) == LightEntity.SUPPORT_COLOR); - bool get supportTransition => ((attributes["supported_features"] & + bool get supportTransition => ((supportedFeatures & LightEntity.SUPPORT_TRANSITION) == LightEntity.SUPPORT_TRANSITION); - bool get supportWhiteValue => ((attributes["supported_features"] & + bool get supportWhiteValue => ((supportedFeatures & LightEntity.SUPPORT_WHITE_VALUE) == LightEntity.SUPPORT_WHITE_VALUE); @@ -38,7 +38,7 @@ class LightEntity extends Entity { double get maxMireds => _getDoubleAttributeValue("max_mireds"); double get minMireds => _getDoubleAttributeValue("min_mireds"); HSVColor get color => _getColor(); - bool get isAdditionalControls => ((attributes["supported_features"] != null) && (attributes["supported_features"] != 0)); + bool get isAdditionalControls => ((supportedFeatures != null) && (supportedFeatures != 0)); List get effectList => getStringListAttributeValue("effect_list"); LightEntity(Map rawData) : super(rawData); diff --git a/lib/entity_class/media_player_entity.class.dart b/lib/entity_class/media_player_entity.class.dart index f0d86e1..2fe87d7 100644 --- a/lib/entity_class/media_player_entity.class.dart +++ b/lib/entity_class/media_player_entity.class.dart @@ -22,53 +22,53 @@ class MediaPlayerEntity extends Entity { MediaPlayerEntity(Map rawData) : super(rawData); - bool get supportPause => ((attributes["supported_features"] & + bool get supportPause => ((supportedFeatures & MediaPlayerEntity.SUPPORT_PAUSE) == MediaPlayerEntity.SUPPORT_PAUSE); - bool get supportSeek => ((attributes["supported_features"] & + bool get supportSeek => ((supportedFeatures & MediaPlayerEntity.SUPPORT_SEEK) == MediaPlayerEntity.SUPPORT_SEEK); - bool get supportVolumeSet => ((attributes["supported_features"] & + bool get supportVolumeSet => ((supportedFeatures & MediaPlayerEntity.SUPPORT_VOLUME_SET) == MediaPlayerEntity.SUPPORT_VOLUME_SET); - bool get supportVolumeMute => ((attributes["supported_features"] & + bool get supportVolumeMute => ((supportedFeatures & MediaPlayerEntity.SUPPORT_VOLUME_MUTE) == MediaPlayerEntity.SUPPORT_VOLUME_MUTE); - bool get supportPreviousTrack => ((attributes["supported_features"] & + bool get supportPreviousTrack => ((supportedFeatures & MediaPlayerEntity.SUPPORT_PREVIOUS_TRACK) == MediaPlayerEntity.SUPPORT_PREVIOUS_TRACK); - bool get supportNextTrack => ((attributes["supported_features"] & + bool get supportNextTrack => ((supportedFeatures & MediaPlayerEntity.SUPPORT_NEXT_TRACK) == MediaPlayerEntity.SUPPORT_NEXT_TRACK); - bool get supportTurnOn => ((attributes["supported_features"] & + bool get supportTurnOn => ((supportedFeatures & MediaPlayerEntity.SUPPORT_TURN_ON) == MediaPlayerEntity.SUPPORT_TURN_ON); - bool get supportTurnOff => ((attributes["supported_features"] & + bool get supportTurnOff => ((supportedFeatures & MediaPlayerEntity.SUPPORT_TURN_OFF) == MediaPlayerEntity.SUPPORT_TURN_OFF); - bool get supportPlayMedia => ((attributes["supported_features"] & + bool get supportPlayMedia => ((supportedFeatures & MediaPlayerEntity.SUPPORT_PLAY_MEDIA) == MediaPlayerEntity.SUPPORT_PLAY_MEDIA); - bool get supportVolumeStep => ((attributes["supported_features"] & + bool get supportVolumeStep => ((supportedFeatures & MediaPlayerEntity.SUPPORT_VOLUME_STEP) == MediaPlayerEntity.SUPPORT_VOLUME_STEP); - bool get supportSelectSource => ((attributes["supported_features"] & + bool get supportSelectSource => ((supportedFeatures & MediaPlayerEntity.SUPPORT_SELECT_SOURCE) == MediaPlayerEntity.SUPPORT_SELECT_SOURCE); - bool get supportStop => ((attributes["supported_features"] & + bool get supportStop => ((supportedFeatures & MediaPlayerEntity.SUPPORT_STOP) == MediaPlayerEntity.SUPPORT_STOP); - bool get supportClearPlaylist => ((attributes["supported_features"] & + bool get supportClearPlaylist => ((supportedFeatures & MediaPlayerEntity.SUPPORT_CLEAR_PLAYLIST) == MediaPlayerEntity.SUPPORT_CLEAR_PLAYLIST); - bool get supportPlay => ((attributes["supported_features"] & + bool get supportPlay => ((supportedFeatures & MediaPlayerEntity.SUPPORT_PLAY) == MediaPlayerEntity.SUPPORT_PLAY); - bool get supportShuffleSet => ((attributes["supported_features"] & + bool get supportShuffleSet => ((supportedFeatures & MediaPlayerEntity.SUPPORT_SHUFFLE_SET) == MediaPlayerEntity.SUPPORT_SHUFFLE_SET); - bool get supportSelectSoundMode => ((attributes["supported_features"] & + bool get supportSelectSoundMode => ((supportedFeatures & MediaPlayerEntity.SUPPORT_SELECT_SOUND_MODE) == MediaPlayerEntity.SUPPORT_SELECT_SOUND_MODE); diff --git a/lib/main.dart b/lib/main.dart index 71be275..cf44e84 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -93,8 +93,7 @@ part 'ui_widgets/card_header_widget.dart'; EventBus eventBus = new EventBus(); const String appName = "HA Client"; -const appVersion = "0.4.0"; -const appBuild = "91"; +const appVersion = "0.4.1"; String homeAssistantWebHost; @@ -383,8 +382,7 @@ class _MainPageState extends State with WidgetsBindingObserver { ) ], applicationName: appName, - applicationVersion: appVersion, - applicationLegalese: "build $appBuild", + applicationVersion: appVersion ) ]); } diff --git a/pubspec.yaml b/pubspec.yaml index 8080df8..8f9cb6c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: hass_client description: Home Assistant Android Client -version: 0.4.0+91 +version: 0.4.1+92 environment: sdk: ">=2.0.0-dev.68.0 <3.0.0"