Example #1
0
        static void Main(string[] args)
        {
            DisableConsoleQuickEdit.Go();

            Console.WriteLine("Plex-Automation-Client starting...");

            PlexAutomationBroker plexAutomation = InitializePlexListener(PlexColor);

            plexAutomation.Start();

            //IPAutomationBroker tvIpAutomation = InitializeTVIpListener(TvColor);
            //tvIpAutomation.Start();

            //IPAutomationBroker xboxIpAutomation = InitializeXboxIpListener(XboxColor);
            //xboxIpAutomation.Start();

            HueAutomationBroker hueAutomation = InitializeHueListner(HueColor);

            hueAutomation.Start();

            DenonAutomationBroker denonAutomation = InitializeDenonListener(DenonColor);

            denonAutomation.Start();

            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("Press <ENTER> to stop the Plex-Automation-Client");
            Console.ReadKey();
        }
Example #2
0
        /// <summary>
        /// If plex starts playing turn off lights
        /// If plex stops playing turn on lights
        /// </summary>
        private static PlexAutomationBroker InitializePlexListener(ConsoleColor consoleColor)
        {
            var notifiers = new List<INotifier>
            {
                new HueNotifier(HueIp, new List<int> {CinemaHueLamp}),
                new MyStromNotifier(MyStromIp)
            };

            var listener = new PlexListenerService(PlexIp);

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

            return plexAutomation;
        }
Example #3
0
        /// <summary>
        /// If plex starts playing turn off lights
        /// If plex stops playing turn on lights
        /// </summary>
        private static PlexAutomationBroker InitializePlexListener(ConsoleColor consoleColor)
        {
            var notifiers = new List <INotifier>
            {
                new HueNotifier(HueIp, new List <int> {
                    CinemaHueLamp
                }),
                new MyStromNotifier(MyStromIp)
            };

            var listener = new PlexListenerService(PlexIp);

            var plexAutomation = new PlexAutomationBroker(listener, notifiers);

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

            return(plexAutomation);
        }