How do I learn sensor data from knx group address for c#?

174 Views Asked by At
static void Main(string[] args)
        {

            var connection = new KnxConnectionRouting();

            connection.Connect();
            connection.KnxEventDelegate += Event;
            connection.Action("1/0/1", false);
            Thread.Sleep(5000);

        }

        static void Event(string address, string state)
        {
            var connection = new KnxConnectionRouting();

            if (address == "1/0/1")
            {
                decimal temp = (decimal)connection.FromDataPoint("1.001", state);
                Console.WriteLine("New Event: device " + address + " has status " + temp);
                return;
            }

            Console.WriteLine("New Event: device " + address + " has status " + state);
        }

"state" variable returning from "Event" method returns null.temp value always gives zero result.

Any suggestion ?

I used KNXLib

1

There are 1 best solutions below

0
On BEST ANSWER

So what datapoint type does your group address 1/0/1 actually have?

If it is supposed to be a sensor value, probably 9.001, or? I this case, change connection.FromDataPoint("1.001", state) to connection.FromDataPoint("9.001", state).

But then sending a boolean value to the same group address (connection.Action("1/0/1", false)) makes no sense.