Beispiel #1
0
        protected override void Execute_HomeAutomationDefinition(HomeAutomationCommandContext context)
        {
            var interpreter = context.Interpreter;
            var networks    = context.Networks;
            var streamStore = context.StreamStore;
            var ip          = context.ReadParameter("IP").Value;

            var appDataRepository = new AppDataRepository(streamStore);
            var appData           = appDataRepository.Load();

            if (string.IsNullOrEmpty(ip))
            {
                interpreter.WriteEvent("Searching for Hue bridge...");

                ip = FindIp();
                interpreter.WriteEvent("Found " + ip);
            }

            var networkContext = new HomeAutomationNetworkContext(context.Engine, context.ThreadPool);
            var network        = new Q42HueNetwork(networkContext, ip, appData, () => interpreter.WriteEvent("Press the link button on the Hue bridge."));

            networks.Add(network);

            appDataRepository.Save(appData);

            interpreter.WriteEvent("Done.");
        }
Beispiel #2
0
        public WeMoNetwork(HomeAutomationNetworkContext context)
            : base(context)
        {
            Address = "WeMo";
            Name    = Address;

            _devices = new List <WeMoDevice>();
            Devices  = _devices;
        }
Beispiel #3
0
        public Q42HueNetwork(HomeAutomationNetworkContext context, string ip, IAppData appData, Action notifyPressLinkButton) : base(context)
        {
            _devices = new List <Q42HueDevice>();
            Devices  = _devices;

            _client = new LocalHueClient(ip);

            Connect(appData, notifyPressLinkButton);
        }
Beispiel #4
0
        public PiEngineeringNetwork(HomeAutomationNetworkContext context, string address)
            : base(context)
        {
            _devices     = new List <PiEngineeringDevice>();
            base.Devices = _devices;

            Address = address;
            Name    = Address;

            Connect();
        }
Beispiel #5
0
        public ZWaveNetwork(HomeAutomationNetworkContext context)
            : base(context)
        {
            ZWaveController = new global::ControlThink.ZWave.ZWaveController();
            this.Devices    = new ZWaveDeviceCollection(this);
            base.Devices    = this.Devices;

            WorkQueue = new ParallelWorkQueue();

            Connect();
        }
Beispiel #6
0
        protected override void Execute_HomeAutomationDefinition(HomeAutomationCommandContext context)
        {
            var interpreter = context.Interpreter;
            var networks    = context.Networks;

            var networkContext = new HomeAutomationNetworkContext(context.Engine, context.ThreadPool);
            var network        = new WeMoNetwork(networkContext);

            networks.Add(network);

            interpreter.WriteEvent("Done.");
        }
Beispiel #7
0
        public OpenZWaveNetwork(HomeAutomationNetworkContext context, string serialPortName)
            : base(context)
        {
            _serialPortName = serialPortName;

            _devices = new List <OpenZWaveDevice>();
            Devices  = _devices;
            _notificationProcessor = new OpenZWaveNotificationProcessor(this);

            ConfigureOptions();

            Manager = new ZWManager();
            Manager.Create();
            Manager.OnNotification += OnNotification;

            Connect();
        }