Exemplo n.º 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.");
        }
Exemplo n.º 2
0
        public WeMoNetwork(HomeAutomationNetworkContext context)
            : base(context)
        {
            Address = "WeMo";
            Name = Address;

            _devices = new List<WeMoDevice>();
            Devices = _devices;
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
        public PiEngineeringNetwork(HomeAutomationNetworkContext context, string address)
            : base(context)
        {
            _devices = new List<PiEngineeringDevice>();
            base.Devices = _devices;

            Address = address;
            Name = Address;

            Connect();
        }
Exemplo n.º 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();
        }
Exemplo n.º 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.");
        }
Exemplo n.º 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();
        }
Exemplo n.º 8
0
 public Network(HomeAutomationNetworkContext context)
 {
     Context = context;
     Devices = new List<Device>();
 }
Exemplo n.º 9
0
 public Network(HomeAutomationNetworkContext context)
 {
     Context = context;
     Devices = new List <Device>();
 }