我如何从 c# 的 knx 组地址中学习传感器数据?
How do I learn sensor data from knx group address for c#?
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" 从 "Event" 方法返回的变量 returns null.temp 值总是给出零结果。
有什么建议吗?
我用了KNXLib
那么你的组地址 1/0/1 实际上有什么数据点类型?
如果它应该是一个传感器值,可能是 9.001,或者?在这种情况下,将 connection.FromDataPoint("1.001", state)
更改为 connection.FromDataPoint("9.001", state)
。
但是向同一组地址 (connection.Action("1/0/1", false)
) 发送一个布尔值是没有意义的。
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" 从 "Event" 方法返回的变量 returns null.temp 值总是给出零结果。
有什么建议吗?
我用了KNXLib
那么你的组地址 1/0/1 实际上有什么数据点类型?
如果它应该是一个传感器值,可能是 9.001,或者?在这种情况下,将 connection.FromDataPoint("1.001", state)
更改为 connection.FromDataPoint("9.001", state)
。
但是向同一组地址 (connection.Action("1/0/1", false)
) 发送一个布尔值是没有意义的。