示例#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);
        }