Пример #1
0
        public Light FindLight(ZWaveValueIdentity identity)
        {
            var light = AllLights.SingleOrDefault(x => x.ZWaveIdentity.Equals(identity));

            if (light == null)
            {
                throw new InvalidOperationException(string.Format("Could not find light with identity: {0}", identity));
            }
            return(light);
        }
Пример #2
0
        public void AssignLightToGroup(ZWaveValueIdentity identity, Guid groupId)
        {
            var light = FindLight(identity);

            if (light.IsInGroup)
            {
                light.Unassign();
            }
            else
            {
                _unassignedLights.Remove(light);
            }
            FindGroup(groupId).AddLight(light);
        }