|
|
|
@ -193,6 +193,7 @@ namespace IoTNode.DeviceServices.FBee
|
|
|
|
|
Clients.TryGetValue(gateway.Number, out TcpClientWrapper client);
|
|
|
|
|
if (client.Ip != gateway.Ip)
|
|
|
|
|
{
|
|
|
|
|
client.Ip = gateway.Ip;
|
|
|
|
|
this.Connect(client);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -687,7 +688,7 @@ namespace IoTNode.DeviceServices.FBee
|
|
|
|
|
}
|
|
|
|
|
else if (deviceId == 0x0051)
|
|
|
|
|
{
|
|
|
|
|
//this.X8D07020000(sn, ieee);
|
|
|
|
|
this.X8D07020000(sn, ieee);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
@ -950,8 +951,8 @@ namespace IoTNode.DeviceServices.FBee
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void X8D07020000(string sn, string ieee)
|
|
|
|
|
{
|
|
|
|
|
var list = new List<byte>() { 0x02, 0x07, 0x00, 0x00, 0x00 };
|
|
|
|
|
this.Write(sn, RequestType.xa7, ieee, list, 2);
|
|
|
|
|
this.Write(sn, RequestType.xa7, ieee, new List<byte>() { 0x02, 0x07, 0x00, 0x00, 0x00 }, 2);
|
|
|
|
|
this.Write(sn, RequestType.xa7, ieee, new List<byte>() { 0x02, 0x07, 0x0b, 0x05, 0x00 }, 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
@ -1364,6 +1365,26 @@ namespace IoTNode.DeviceServices.FBee
|
|
|
|
|
}
|
|
|
|
|
else if (deviceId == 0x0051)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in props)
|
|
|
|
|
{
|
|
|
|
|
if (item.Key == 0x0000)
|
|
|
|
|
{
|
|
|
|
|
var tempBytes = new List<byte>();
|
|
|
|
|
tempBytes.AddRange(item.Value);
|
|
|
|
|
tempBytes.Add(0x00);
|
|
|
|
|
tempBytes.Add(0x00);
|
|
|
|
|
var electricity = BitConverter.ToUInt64(tempBytes.ToArray()) / 10000f;
|
|
|
|
|
System.Diagnostics.Debug.WriteLine($"~~~~~~~~~~~~~~~~~~~electricity:{electricity}");
|
|
|
|
|
this.UpdateData(deviceRepo, device, device.CreateData(Keys.Electricity, electricity.ToString("f2"), DeviceDataType.Float, "电量", "kWh", timestamp: timestamp));
|
|
|
|
|
}
|
|
|
|
|
else if (item.Key == 0x050b)
|
|
|
|
|
{
|
|
|
|
|
var power = BitConverter.ToUInt16(item.Value.ToArray());
|
|
|
|
|
System.Diagnostics.Debug.WriteLine($"~~~~~~~~~~~~~~~~~~~power:{power}");
|
|
|
|
|
this.UpdateData(deviceRepo, device, device.CreateData(Keys.Power, power, DeviceDataType.Float, "功率", "W", timestamp: timestamp));
|
|
|
|
|
}
|
|
|
|
|
System.Diagnostics.Debug.WriteLine($"~~~~~~~~~~~~~~~~~~~{item.Key.ToString("X")}:{System.BitConverter.ToString(item.Value)}");
|
|
|
|
|
}
|
|
|
|
|
if (clusterId == ClusterId.SummationDivisor)
|
|
|
|
|
{
|
|
|
|
|
this.X8D07020000(sn, device.Number);
|
|
|
|
|