Beispiel #1
0
        /// <summary>
        /// If TV is turned on, turn off lights
        /// If TV is turned off, turn on lights
        /// </summary>
        private static IPAutomationBroker InitializeTVIpListener(ConsoleColor consoleColor)
        {
            var notifiers = new List<INotifier>
            {
                new HueNotifier(HueIp, new List<int> {CinemaHueLamp}),
                new MyStromNotifier(MyStromIp)
            };

            var listener = new IPListenerService(TvIp);

            var ipAutomation = new IPAutomationBroker(listener, notifiers);
            ipAutomation.OnMessage += message => OutputMessage(message, consoleColor);

            OutputMessage(string.Format("Tv {0}", TvIp), consoleColor);

            return ipAutomation;
        }
Beispiel #2
0
        /// <summary>
        /// If Xbox is turned on, turn off lights
        /// If Xbox is turned off, turn on lights
        /// </summary>
        private static IPAutomationBroker InitializeXboxIpListener(ConsoleColor consoleColor)
        {
            var notifiers = new List <INotifier>
            {
                new HueNotifier(HueIp, new List <int> {
                    CinemaHueLamp
                }),
                new MyStromNotifier(MyStromIp)
            };

            var listener = new IPListenerService(XboxIp);

            var ipAutomation = new IPAutomationBroker(listener, notifiers);

            ipAutomation.OnMessage += message => OutputMessage(message, consoleColor);

            OutputMessage(string.Format("Xbox {0}", XboxIp), consoleColor);

            return(ipAutomation);
        }