protected FusionStaticAsset FusionAddAsset(IFusionAsset asset) { try { uint key = 1; while (_fusionAssets.ContainsKey(key)) { key++; } Fusion.AddAsset(eAssetType.StaticAsset, key, asset.Name, asset.AssetType.ToString().SplitCamelCase(), Guid.NewGuid().ToString()); _fusionAssets.Add(key, asset); var newAsset = Fusion.UserConfigurableAssetDetails[key].Asset as FusionStaticAsset; if (newAsset == null) { return(null); } newAsset.ParamMake.Value = asset.ManufacturerName; newAsset.ParamModel.Value = asset.ModelName; newAsset.Connected.InputSig.BoolValue = asset.DeviceCommunicating; newAsset.AddSig(eSigType.String, 1, "Device Address", eSigIoMask.InputSigOnly); newAsset.AddSig(eSigType.String, 2, "Serial Number", eSigIoMask.InputSigOnly); newAsset.AddSig(eSigType.String, 3, "Version Info", eSigIoMask.InputSigOnly); asset.DeviceCommunicatingChange += FusionAssetOnDeviceCommunicatingChange; var deviceWithPower = asset as IPowerDevice; if (deviceWithPower != null) { deviceWithPower.PowerStatusChange += FusionAssetOnPowerStatusChange; newAsset.PowerOn.InputSig.BoolValue = deviceWithPower.Power; } } catch (Exception e) { CloudLog.Error("Error registering Fusion asset: {0} ({1}), {2}", asset.GetType().Name, asset.AssetType, e.Message); } return(null); }