예제 #1
0
파일: Lamp.cs 프로젝트: wuzhenda/HA4IoT
        public override IComponentFeatureStateCollection GetState()
        {
            var state = new ComponentFeatureStateCollection()
                        .With(new PowerState(_powerState));

            if (_adapter.SupportsColor)
            {
                return(state.With(_colorState));
            }

            return(state);
        }
예제 #2
0
        public override IComponentFeatureStateCollection GetState()
        {
            var state = new ComponentFeatureStateCollection().With(
                new StateMachineFeatureState(_activeState?.Id));

            if (this.GetSupportsOffState())
            {
                state.With(
                    new PowerState(_activeState?.Id == StateMachineStateExtensions.OffStateId
                        ? PowerStateValue.Off
                        : PowerStateValue.On));
            }

            return(state);
        }