GetNodeID() public méthode

public GetNodeID ( ) : Task
Résultat Task
Exemple #1
0
        public async Task <VersionCommandClassReport[]> GetSupportedCommandClasses()
        {
            // is this node the controller?
            if (await Controller.GetNodeID() == NodeID)
            {
                // yes, so return an empty collection. GetSupportedCommandClasses is not supported by the controller
                return(new VersionCommandClassReport[0]);
            }

            var version = GetCommandClass <CommandClasses.Version>();
            var commandClassVersions = new Dictionary <CommandClass, VersionCommandClassReport>();

            foreach (var commandClass in System.Enum.GetValues(typeof(CommandClass)).Cast <CommandClass>())
            {
                var report = await version.GetCommandClass(commandClass);

                commandClassVersions[commandClass] = report;
            }

            _commandClassVersions = commandClassVersions;
            lock (_commandClassVersions)
            {
                return(_commandClassVersions.Values.Where(r => r.Version > 0).ToArray());
            }
        }
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}");

            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 #4
0
        public async Task <VersionCommandClassReport[]> GetSupportedCommandClasses()
        {
            // is this node the controller?
            if (await Controller.GetNodeID() == NodeID)
            {
                // yes, so return an empty collection. GetSupportedCommandClasses is not supported by the controller
                return(new VersionCommandClassReport[0]);
            }

            var version = GetCommandClass <CommandClasses.Version>();
            var reports = new List <VersionCommandClassReport>();

            foreach (var commandClass in System.Enum.GetValues(typeof(CommandClass)).Cast <CommandClass>())
            {
                var report = await version.GetCommandClass(commandClass);

                if (report.Version == 0)
                {
                    continue;
                }

                reports.Add(report);
            }
            return(reports.ToArray());
        }
Exemple #5
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();
        }