GetHomeID() public méthode

public GetHomeID ( ) : Task
Résultat Task
Exemple #1
0
        static private async Task Run(ZWaveController controller)
        {
            LogMessage($"Version: {await controller.GetVersion()}");
            LogMessage($"HomeID: {await controller.GetHomeID():X}");

            var controllerNodeID = await controller.GetNodeID();
            LogMessage($"ControllerID: {controllerNodeID:D3}");

            var nodes = await controller.GetNodes();
            unknownDevices = new List<byte>();
            unknownDevices.AddRange(nodes.Select(el => el.NodeID));

            foreach (var node in nodes.Where(el => el.NodeID != controllerNodeID))
            {
                try
                {
                    await RequestNodeType(node);
                }
                catch
                {
                    LogMessage($"Node: {node} not found, waiting for wake up event");
                    // subcribe to changes
                    Subscribe(node);
                }
            }

            LogMessage($"Waiting for wake up events from {unknownDevices.Count} unknown nodes");
            Console.ReadLine();
        }
Exemple #2
0
        static private async Task Run(ZWaveController controller)
        {
            LogMessage($"Version: {await controller.GetVersion()}");
            LogMessage($"HomeID: {await controller.GetHomeID():X}");

            var controllerNodeID = await controller.GetNodeID();
            LogMessage($"ControllerID: {controllerNodeID:D3}");

            var nodes = await controller.GetNodes();
            foreach (var node in nodes)
            {
                var protocolInfo = await node.GetProtocolInfo();
                LogMessage($"Node: {node}, Generic = {protocolInfo.GenericType}, Basic = {protocolInfo.BasicType}, Listening = {protocolInfo.IsListening} ");

                var neighbours = await node.GetNeighbours();
                LogMessage($"Node: {node}, Neighbours = {string.Join(", ", neighbours.Cast<object>().ToArray())}");

                // subcribe to changes
                Subscribe(node);
            }


            //await InitializeWallPlug(nodes[2]);
            //await InitializeWallPlug(nodes[3]);
            //await InitializeShockSensor(nodes[4]);
            //await InitializeGarageDoorSensor(nodes[5]);
            //await InitializeThermostat(nodes[6]);
            //await InitializeMultiSensor(nodes[7]);
            await InitializeDoorSensor(nodes[10]);

            Console.ReadLine();
        }
Exemple #3
0
        static private async Task Run(ZWaveController controller)
        {
            LogMessage($"Version: {await controller.GetVersion()}");
            LogMessage($"HomeID: {await controller.GetHomeID():X}");

            var controllerNodeID = await controller.GetNodeID();

            LogMessage($"ControllerID: {controllerNodeID:D3}");


            await controller.DiscoverNodes();

            var nodes = await controller.GetNodes();

            await Task.Delay(2000);

            foreach (var node in nodes)
            {
                var protocolInfo = await node.GetProtocolInfo();

                LogMessage($"Node: {node}, Generic = {protocolInfo.GenericType}, Basic = {protocolInfo.BasicType}, Listening = {protocolInfo.IsListening} ");

                var neighbours = await node.GetNeighbours();

                LogMessage($"Node: {node}, Neighbours = {string.Join(", ", neighbours.Cast<object>().ToArray())}");

                // subcribe to changes
                Subscribe(node);
            }
            //var command =nodes[2].GetCommandClass<SwitchBinary>();
            var command = nodes[5].GetCommandClass <MultiChannel>();
            //await Task.Delay(2000);

            await Task.Delay(1000);

            await command.BinarySwitchSet(1, true);

            await Task.Delay(1000);

            await command.BinarySwitchSet(2, true);

            await Task.Delay(1000);

            await command.BinarySwitchSet(1, false);

            await Task.Delay(1000);

            await command.BinarySwitchSet(2, false);

            await Task.Delay(1000);

            await command.BinarySwitchSet(2, true);

            await Task.Delay(1000);

            await command.BinarySwitchSet(1, false);

            await Task.Delay(1000);

            await command.BinarySwitchSet(2, false);

            //await InitializeWallPlug(nodes[2]);
            //await InitializeWallPlug(nodes[3]);
            //await InitializeShockSensor(nodes[4]);
            //await InitializeGarageDoorSensor(nodes[5]);
            //await InitializeThermostat(nodes[6]);
            //await InitializeMultiSensor(nodes[18]);
            //await InitializeDoorSensor(nodes[10]);
            //await InitializePowerSwitch(nodes[19]);
            //await InitializePowerSwitch(nodes[20]);
            //await InitializePowerSwitch(nodes[24]);
            //await InitializePowerSwitch(nodes[25]);
            //await InitializePowerSwitch(nodes[2]);
            //var neighborUpdateStatus = await nodes[19].RequestNeighborUpdate((status) => LogMessage($"RequestNeighborUpdate: {status} "));

            Console.ReadLine();
        }